Examples of FBMenuItem


Examples of org.jbpm.formapi.client.menu.FBMenuItem

        this.contextPath = contextPath;
        //registered to save the menu items
        bus.addHandler(MenuItemAddedEvent.TYPE, new MenuItemAddedHandler() {
            @Override
            public void onEvent(MenuItemAddedEvent event) {
                FBMenuItem item = event.getMenuItem();
                saveMenuItem(event.getGroupName(), item);
                if (item instanceof CustomMenuItem) {
                    CustomMenuItem customItem = (CustomMenuItem) item;
                    String formItemName = customItem.getOptionName();
                    FormItemRepresentation formItem = customItem.getRepresentation();
                    saveFormItem(formItem, formItemName);
                }
            }
        });
        //registered to delete the menu items
        bus.addHandler(MenuItemRemoveEvent.TYPE, new MenuItemRemoveHandler() {
            @Override
            public void onEvent(MenuItemRemoveEvent event) {
                FBMenuItem item = event.getMenuItem();
                deleteMenuItem(event.getGroupName(), item);
                if (item instanceof CustomMenuItem) {
                    CustomMenuItem customItem = (CustomMenuItem) item;
                    String formItemName = customItem.getOptionName();
                    FormItemRepresentation formItem = customItem.getRepresentation();
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

    }
   
    @Override
    protected void createStyles() {
        final FBFormItem formItem = super.getItem();
        FBMenuItem menuItem = new CustomMenuItem(
                formItem.getRepresentation(),
                newMenuOptionName,
                formItem.getFormEffects(),
                groupName
        );
        if (formItem.getEventActions() != null) {
            for (String evtName : formItem.getEventActions().keySet()) {
                menuItem.addAllowedEvent(evtName);
            }
        }
        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("menuItem", menuItem);
        dataSnapshot.put("groupName", groupName);
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {  }
            @Override
            public void undoAction(UndoableEvent event) {
                FBMenuItem menuItem = (FBMenuItem) event.getData("menuItem");
                String groupName = (String) event.getData("groupName");
                MenuItemRemoveEvent mevent = new MenuItemRemoveEvent(menuItem, groupName);
                CommonGlobals.getInstance().getEventBus().fireEvent(mevent);
            }
            @Override
            public void doAction(UndoableEvent event) {
                FBMenuItem menuItem = (FBMenuItem) event.getData("menuItem");
                String groupName = (String) event.getData("groupName");
                MenuItemAddedEvent mevent = new MenuItemAddedEvent(menuItem, groupName);
                CommonGlobals.getInstance().getEventBus().fireEvent(mevent);
            }
        }));
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

    @Test
    public void testMenuItemAddedForUser() throws Exception {
        FormBuilderService service = EasyMock.createMock(FormBuilderService.class);
        FormBuilderGlobals.getInstance().registerService(service);
        FBMenuItem menuItem = EasyMock.createMock(FBMenuItem.class);
        String groupName = "group";
        service.getCurrentRoles(EasyMock.isA(FormBuilderService.RolesResponseHandler.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            @Override
            public Object answer() throws Throwable {
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

   
    @Test
    public void testMenuItemAddedForDesigner() throws Exception {
        FormBuilderService service = EasyMock.createMock(FormBuilderService.class);
        FormBuilderGlobals.getInstance().registerService(service);
        FBMenuItem menuItem = EasyMock.createMock(FBMenuItem.class);
        String groupName = "group";
        view.addItem(EasyMock.same(groupName), EasyMock.same(menuItem));
        EasyMock.expectLastCall().once();
        service.getCurrentRoles(EasyMock.isA(FormBuilderService.RolesResponseHandler.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

        EasyMock.verify(service, menuItem, view, drag);
    }

    @Test
    public void testMenuItemRemoved() throws Exception  {
        FBMenuItem menuItem = EasyMock.createMock(FBMenuItem.class);
        String groupName = "group";
        view.removeItem(EasyMock.same(groupName), EasyMock.same(menuItem));
        EasyMock.expectLastCall().once();
        EasyMock.replay(menuItem, view, drag);
        RoleUtils.getInstance().reload();
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

    @Test
    public void testMenuItemFromServerForUser() throws Exception {
        FormBuilderService service = EasyMock.createMock(FormBuilderService.class);
        FormBuilderGlobals.getInstance().registerService(service);
        FBMenuItem menuItem = EasyMock.createMock(FBMenuItem.class);
        String groupName = "group";
        service.getCurrentRoles(EasyMock.isA(FormBuilderService.RolesResponseHandler.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            @Override
            public Object answer() throws Throwable {
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

   
    @Test
    public void testMenuItemFromServerForDesigner() throws Exception {
        FormBuilderService service = EasyMock.createMock(FormBuilderService.class);
        FormBuilderGlobals.getInstance().registerService(service);
        FBMenuItem menuItem = EasyMock.createMock(FBMenuItem.class);
        String groupName = "group";
        view.addItem(EasyMock.same(groupName), EasyMock.same(menuItem));
        EasyMock.expectLastCall().once();
        service.getCurrentRoles(EasyMock.isA(FormBuilderService.RolesResponseHandler.class));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

            moveFormItem(drag, x, y);
        }
    }

    private void addMenuItem(Widget drag, int x, int y) {
        FBMenuItem menuItem = (FBMenuItem) drag;
        FBFormItem formItem = menuItem.buildWidget();
        formItem.setDesiredPosition(x, y);
        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("formItem", formItem);
        dataSnapshot.put("menuItem", menuItem);
        dataSnapshot.put("x", x);
        dataSnapshot.put("y", y);
        this.bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {  }
            @Override
            public void undoAction(UndoableEvent event) {
                FBFormItem formItem = (FBFormItem) event.getData("formItem");
                Integer x = (Integer) event.getData("x");
                Integer y = (Integer) event.getData("y");
                HasWidgets panel = layoutView.getUnderlyingLayout(x, y);
                panel.remove(formItem);
                bus.fireEvent(new FormItemRemovedEvent(formItem));
            }
            @Override
            public void doAction(UndoableEvent event) {
                FBFormItem formItem = (FBFormItem) event.getData("formItem");
                FBMenuItem menuItem = (FBMenuItem) event.getData("menuItem");
                Integer x = (Integer) event.getData("x");
                Integer y = (Integer) event.getData("y");
                if (formItem != null) {
                    HasWidgets panel = layoutView.getUnderlyingLayout(x, y);
                    if (panel instanceof FBForm) {
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

     */
    @Override
    public boolean remove(Widget w) {
        int index = getWidgetIndex(w);
        if (index != -1 && w instanceof FBMenuItem) {
            FBMenuItem item = ((FBMenuItem) w).cloneWidget();
            dragController.makeDraggable(item);
            insert(item, index);
        }
        return super.remove(w);
    }
View Full Code Here

Examples of org.jbpm.formapi.client.menu.FBMenuItem

        for (int index = 0; index < items.getLength(); index ++) {
            Node itemNode = items.item(index);
            String itemClassName = ((Element) itemNode).getAttribute("className");
            try {
                Object obj = ReflectionHelper.newInstance(itemClassName);
                FBMenuItem menuItem = null;
                if (obj instanceof CustomMenuItem) {
                    CustomMenuItem customItem = (CustomMenuItem) obj;
                    String optionName = ((Element) itemNode).getAttribute("optionName");
                    customItem.setRepresentation(makeRepresentation(itemNode));
                    customItem.setOptionName(optionName);
                    customItem.setGroupName(groupName);
                    menuItem = customItem;
                } else if (obj instanceof FBMenuItem) {
                    menuItem = (FBMenuItem) obj;
                } else {
                    throw new Exception(i18n.NotOfType(itemClassName, "FBMenuItem"));
                }
                NodeList effects = ((Element) itemNode).getElementsByTagName("effect");
                for (FBFormEffect effect : readItemEffects(effects)) {
                    menuItem.addEffect(effect);
                }
                NodeList allowedEvents = ((Element) itemNode).getElementsByTagName("allowedEvent");
                for (String allowedEventName : readAllowedEvents(allowedEvents)) {
                    menuItem.addAllowedEvent(allowedEventName);
                }
                menuItems.add(menuItem);
            } catch (Exception e) {
                menuItems.add(new ErrorMenuItem(e.getMessage()));
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.