Package org.jbpm.formapi.shared.api

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


        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("form", form);
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void undoAction(UndoableEvent event) {
                FormRepresentation form = (FormRepresentation) event.getData("form");
                if (form != null) {
                    try {
                        service.saveForm(form);
                    } catch (FormBuilderException e) {
                        bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.ProblemRestoringForm(), e));
                    }
                }
            }
            @Override
            public void onEvent(UndoableEvent event) { }
            @Override
            public void doAction(UndoableEvent event) {
                FormRepresentation form = (FormRepresentation) event.getData("form");
                try {
                    service.deleteForm(form);
                } catch (FormBuilderException e) {
                    event.setData("form", null);
                    bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.ProblemDeletingForm(), e));
View Full Code Here


        super();
        bus.addHandler(GetFormRepresentationResponseEvent.TYPE, new GetFormRepresentationResponseHandler() {
            @Override
            public void onEvent(GetFormRepresentationResponseEvent event) {
                if (SAVE_TYPE.equals(event.getSaveType())) {
                    FormRepresentation form = event.getRepresentation();
                    showSavePanel(form);
                }
            }
        });
    }
View Full Code Here

       
        assertNotNull("json shouldn't be null", json);
        assertNotSame("json shouldn't be empty", "", json);
       
       
        FormRepresentation form = decoder.decode(json);
        assertNotNull("form shouldn't be null", form);
        String json2 = encoder.encode(form);
        FormRepresentation form2 = decoder.decode(json2);
        assertNotNull("json2 shouldn't be null", json2);
        assertNotSame("json2 shouldn't be empty", "", json2);
       
        assertNotNull("form2 shouldn't be null", form2);
        assertEquals("both forms should be the same in contents", form, form2);
View Full Code Here

   
    @Test
    public void testGetFormRepresentation() throws Exception {
        FBForm mockForm = EasyMock.createMock(FBForm.class);
        EasyMock.expect(view.getFormDisplay()).andReturn(mockForm);
        final FormRepresentation formRep = new FormRepresentation();
        final String saveType = "ANYTHING";
        EasyMock.expect(mockForm.createRepresentation()).andReturn(formRep);
        EasyMock.replay(view, drag, mockForm);
        bus.addHandler(GetFormRepresentationResponseEvent.TYPE, new GetFormRepresentationResponseHandler() {
            @Override
View Full Code Here

    public void testFormSaved() throws Exception {
        FBForm mockForm = EasyMock.createMock(FBForm.class);
        EasyMock.expect(view.getFormDisplay()).andReturn(mockForm).once();
        mockForm.setSaved(EasyMock.eq(true));
        EasyMock.expectLastCall().once();
        FormRepresentation formRep = new FormRepresentation();
       
        EasyMock.replay(view, drag, mockForm);
        new LayoutPresenter(view);
        bus.fireEvent(new FormSavedEvent(formRep));
        EasyMock.verify(view, drag, mockForm);
View Full Code Here

        EasyMock.verify(view, drag, mockForm);
    }

    @Test
    public void testUpdateFormView() throws Exception {
        final FormRepresentation formRep = new FormRepresentation();
        FBForm mockForm = EasyMock.createMock(FBForm.class);
        EasyMock.expect(view.getFormDisplay()).andReturn(mockForm).anyTimes();
        EasyMock.expect(mockForm.createRepresentation()).andReturn(formRep);
        mockForm.populate(formRep);
        EasyMock.expectLastCall().once();
View Full Code Here

                trimmedIo.setProcessId(row.getIoRef().getProcessId());
                trimmedIo.setProcessName(row.getIoRef().getProcessName());
                trimmedIo.setTaskId(row.getIoRef().getTaskId());
                trimmedIo.setInputs(new ArrayList<TaskPropertyRef>(getSelectedInputs()));
                trimmedIo.setOutputs(new ArrayList<TaskPropertyRef>(getSelectedOutputs()));
                FormRepresentation form = server.toBasicForm(trimmedIo);
                bus.fireEvent(new UpdateFormViewEvent(form));
                hide();
            }
        });
        buttons.add(okButton);
View Full Code Here

        Map<String, String> props = service.getFormBuilderProperties();
        String langsProperty = props.get("form.builder.languages"); //"gwt,ftl"
        String[] langs = langsProperty.split(","); //{ "gwt", "ftl" }
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        String json = getFormTestJsonRepresentation();
        FormRepresentation form = decoder.decode(json);
        Set<Throwable> errors = new HashSet<Throwable>();
        for (String language : langs) {
            try {
                Translator translator = TranslatorFactory.getInstance().getTranslator(language);
                assertNotNull("translator shouldn't be null", translator);
View Full Code Here

        EasyMock.expect(request.getParameter(EasyMock.eq("uuid"))).andReturn(uuid).once();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        TaskDefinitionService taskService = EasyMock.createMock(TaskDefinitionService.class);
        ExportTemplateServlet servlet = createServlet(formService, taskService);
        EasyMock.expect(taskService.getContainingPackage(EasyMock.eq(uuid))).andReturn("somePackage").once();
        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myParam");
        form.setProcessName("MY_PROCESS");
        form.setTaskId("MY_TASK");
        EasyMock.expect(formService.getFormByUUID(EasyMock.eq("somePackage"), EasyMock.eq(uuid))).andReturn(form).once();
        formService.saveTemplate(EasyMock.eq("somePackage"), EasyMock.eq("MY_TASK-taskform.ftl"), EasyMock.anyObject(String.class));
        EasyMock.expectLastCall().once();
       
        EasyMock.replay(request, response, taskService, formService);
View Full Code Here

        EasyMock.expect(request.getParameter(EasyMock.eq("uuid"))).andReturn(uuid).once();
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        TaskDefinitionService taskService = EasyMock.createMock(TaskDefinitionService.class);
        ExportTemplateServlet servlet = createServlet(formService, taskService);
        EasyMock.expect(taskService.getContainingPackage(EasyMock.eq(uuid))).andReturn("somePackage").once();
        FormRepresentation form = RESTAbstractTest.createMockForm("myForm", "myParam");
        form.setProcessName("");
        form.setTaskId("");
        EasyMock.expect(formService.getFormByUUID(EasyMock.eq("somePackage"), EasyMock.eq(uuid))).andReturn(form).once();
       
        EasyMock.replay(request, response, taskService, formService);
        servlet.doGet(request, response);
        EasyMock.verify(request, response, taskService, formService);
View Full Code Here

TOP

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

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.