Package org.jbpm.formapi.shared.api

Examples of org.jbpm.formapi.shared.api.FormItemRepresentation


                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();
                    deleteFormItem(formItemName, formItem);
                }
            }
        });
    }
View Full Code Here


            throws FormServiceException {
        List<Map.Entry<String, FormItemRepresentation>> list = items.get(pkgName);
        if (list == null) {
            throw new FormServiceException();
        }
        FormItemRepresentation item = null;
        for (Map.Entry<String, FormItemRepresentation> i : list) {
            if (formItemId.equals(i.getKey())) {
                item = i.getValue();
                break;
            }
View Full Code Here

    private MenuItemDescription toMenuItemDescription(SaveMenuItemDTO dto, boolean strict) throws MenuServiceException {
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        String json = dto.getClone();
        MenuItemDescription menuItem = new MenuItemDescription();
        try {
            FormItemRepresentation item = decoder.decodeItem(json);
            menuItem.setItemRepresentation(item);
        } catch (FormEncodingException e) {
            if (strict) {
                throw new MenuServiceException("Couldn't load formRepresentation from dto", e);
            }
View Full Code Here

    private void abstractTestSaveMenuItemProblem(final Class<?> exceptionType) throws Exception {
        GuvnorMenuService service = createMockedService(exceptionType);
        MenuItemDescription sampleDescription = new MenuItemDescription();
        sampleDescription.setAllowedEvents(new ArrayList<String>());
        sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
        FormItemRepresentation item = RESTAbstractTest.createMockForm("form", "param1").getFormItems().iterator().next();
        sampleDescription.setItemRepresentation(item);
        sampleDescription.setName("name");
        try {
            service.saveMenuItem("group", sampleDescription);
            fail("saveMenuItem shouldn't succeed");
View Full Code Here

    public void testSaveMenuItemEncodingProblem() throws Exception {
        GuvnorMenuService service = createMockedService(null);
        MenuItemDescription sampleDescription = new MenuItemDescription();
        sampleDescription.setAllowedEvents(new ArrayList<String>());
        sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
        FormItemRepresentation item = RESTAbstractTest.createMockForm("form", "param1").getFormItems().iterator().next();
        sampleDescription.setItemRepresentation(item);
        sampleDescription.setName("name");
        FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
        FormEncodingException exception = new FormEncodingException();
        @SuppressWarnings("unchecked")
View Full Code Here

        effDesc2.setClassName(DoneEffect.class.getName());
        effects.add(effDesc2);
        desc.setEffects(effects);
        File file = new File(getClass().getResource("testSaveMenuItem.json").getFile());
        String json = FileUtils.readFileToString(file);
        FormItemRepresentation itemRepresentation = decoder.decodeItem(json);
        desc.setName("test component");
        desc.setItemRepresentation(itemRepresentation);
       
        String groupName = "Test Components";
        service.saveMenuItem(groupName, desc);
View Full Code Here

        List<Object> mapItems = (List<Object>) data.get("items");
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        if (mapItems != null) {
            for (Object obj : mapItems) {
                Map<String, Object> itemMap = (Map<String, Object>) obj;
                FormItemRepresentation item = (FormItemRepresentation) decoder
                        .decode(itemMap);
                this.items.add(item);
            }
        }
    }
View Full Code Here

    @Override
    public FormItemRepresentation getRepresentation() {
        BorderPanelRepresentation rep = super.getRepresentation(new BorderPanelRepresentation());
        for (Map.Entry<Position, FBFormItem> entry : this.locations.entrySet()) {
            Position key = entry.getKey();
            FormItemRepresentation value = entry.getValue().getRepresentation();
            rep.putItem(key, value);
        }
        return rep;
    }
View Full Code Here

        List<Object> mapItems = (List<Object>) data.get("items");
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        if (mapItems != null) {
            for (Object obj : mapItems) {
                Map<String, Object> itemMap = (Map<String, Object>) obj;
                FormItemRepresentation item = (FormItemRepresentation) decoder.decode(itemMap);
                this.items.add(item);
            }
        }
    }
View Full Code Here

        this.tabContents.clear();
        for (Object tContent : tabContents) {
            Map<String, Object> subData = (Map<String, Object>) tContent;
            Integer index = Integer.valueOf(String.valueOf(subData.get("tabPanelIndex")));
            String string = (String) subData.get("tabPanelTitle");
            FormItemRepresentation subRep = (FormItemRepresentation) FormEncodingFactory.getDecoder().decode(subData);
            this.tabContents.put(new IndexedString(index, string), subRep);
        }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.formapi.shared.api.FormItemRepresentation

Copyright © 2018 www.massapicom. 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.