@Test @SuppressWarnings("unchecked") public void testShowDomainObject() { tested.init(); final String fieldName = "fieldName"; final String fieldValue = "fieldValue"; final Command callback = mock(Command.class); when(formsCanvasSessionHandler.getDiagram()).thenReturn(diagram); when(domainObject.getDomainObjectUUID()).thenReturn(DOMAIN_OBJECT_UUID); when(domainObject.getDomainObjectNameTranslationKey()).thenReturn(DOMAIN_OBJECT_TRANSLATION_KEY); when(formsCanvasSessionHandler.getSession()).thenReturn(session); verify(formsCanvasSessionHandler).setRenderer(formRendererArgumentCaptor.capture()); final FormsCanvasSessionHandler.FormRenderer formRenderer = formRendererArgumentCaptor.getValue(); formRenderer.render(GRAPH_UUID, domainObject, callback); verify(formsContainer).render(eq(GRAPH_UUID), eq(DOMAIN_OBJECT_UUID), eq(domainObject), any(Path.class), fieldChangeHandlerArgumentCaptor.capture(), eq(RenderMode.EDIT_MODE)); final FieldChangeHandler fieldChangeHandler = fieldChangeHandlerArgumentCaptor.getValue(); fieldChangeHandler.onFieldChange(fieldName, fieldValue); verify(formsCanvasSessionHandler).executeUpdateDomainObjectProperty(eq(domainObject), eq(fieldName), eq(fieldValue)); verify(propertiesOpenedEvent).fire(formPropertiesOpenedArgumentCaptor.capture()); final FormPropertiesOpened formPropertiesOpened = formPropertiesOpenedArgumentCaptor.getValue(); assertThat(formPropertiesOpened.getUuid()).isEqualTo(DOMAIN_OBJECT_UUID); assertThat(formPropertiesOpened.getName()).isEqualTo(DOMAIN_OBJECT_TRANSLATION_KEY); assertThat(formPropertiesOpened.getSession()).isEqualTo(session); verify(callback).execute(); }
@PostConstruct @SuppressWarnings("unchecked") public void init() { log(Level.INFO, "FormPropertiesWidget instance build."); formsFlushManager.setCurrentContainer(formsContainer); formSessionHandler.setRenderer(new FormsCanvasSessionHandler.FormRenderer() { @Override public void render(String graphUuid, Element element, Command callback) { show(graphUuid, element, callback); } @Override public void render(String graphUuid, DomainObject domainObject, Command callback) { show(graphUuid, domainObject, callback); } @Override public void clear(String graphUuid, Element element) { formsContainer.clearFormDisplayer(graphUuid, element.getUUID()); } @Override public void clearAll(String graphUuid) { formsContainer.clearDiagramDisplayers(graphUuid); } @Override public void resetCache() { resetLastElementRenderedCache(); } @Override public boolean areLastPositionsSameForElement(final Element element) { return areLastPositionsForSameElementSame(element); } }); view.init(this); }
FormPropertiesWidget implements IsElement,
                                             FormPropertiesWidgetView.Presenter { @PostConstruct @SuppressWarnings("unchecked") public void init() { log(Level.INFO, "FormPropertiesWidget instance build."); formsFlushManager.setCurrentContainer(formsContainer); formSessionHandler.setRenderer(new FormsCanvasSessionHandler.FormRenderer() { @Override public void render(String graphUuid, Element element, Command callback) { show(graphUuid, element, callback); } @Override public void render(String graphUuid, DomainObject domainObject, Command callback) { show(graphUuid, domainObject, callback); } @Override public void clear(String graphUuid, Element element) { formsContainer.clearFormDisplayer(graphUuid, element.getUUID()); } @Override public void clearAll(String graphUuid) { formsContainer.clearDiagramDisplayers(graphUuid); } @Override public void resetCache() { resetLastElementRenderedCache(); } @Override public boolean areLastPositionsSameForElement(final Element element) { return areLastPositionsForSameElementSame(element); } }); view.init(this); } }
FormPropertiesWidget implements IsElement,
                                             FormPropertiesWidgetView.Presenter { @PostConstruct @SuppressWarnings("unchecked") public void init() { log(Level.INFO, "FormPropertiesWidget instance build."); formsFlushManager.setCurrentContainer(formsContainer); formSessionHandler.setRenderer(new FormsCanvasSessionHandler.FormRenderer() { @Override public void render(String graphUuid, Element element, Command callback) { show(graphUuid, element, callback); } @Override public void render(String graphUuid, DomainObject domainObject, Command callback) { show(graphUuid, domainObject, callback); } @Override public void clear(String graphUuid, Element element) { formsContainer.clearFormDisplayer(graphUuid, element.getUUID()); } @Override public void clearAll(String graphUuid) { formsContainer.clearDiagramDisplayers(graphUuid); } @Override public void resetCache() { resetLastElementRenderedCache(); } @Override public boolean areLastPositionsSameForElement(final Element element) { return areLastPositionsForSameElementSame(element); } }); view.init(this); } @Inject  FormPropertiesWidget(final FormPropertiesWidgetView view,
                                final DefinitionUtils definitionUtils,
                                final FormsCanvasSessionHandler formSessionHandler,
                                final Event<FormPropertiesOpened> propertiesOpenedEvent,
                                final FormsContainer formsContainer,
                                final FormsFlushManager formsFlushManager,
                                final TranslationService translationService); }
FormPropertiesWidget implements IsElement,
                                             FormPropertiesWidgetView.Presenter { @PostConstruct @SuppressWarnings("unchecked") public void init() { log(Level.INFO, "FormPropertiesWidget instance build."); formsFlushManager.setCurrentContainer(formsContainer); formSessionHandler.setRenderer(new FormsCanvasSessionHandler.FormRenderer() { @Override public void render(String graphUuid, Element element, Command callback) { show(graphUuid, element, callback); } @Override public void render(String graphUuid, DomainObject domainObject, Command callback) { show(graphUuid, domainObject, callback); } @Override public void clear(String graphUuid, Element element) { formsContainer.clearFormDisplayer(graphUuid, element.getUUID()); } @Override public void clearAll(String graphUuid) { formsContainer.clearDiagramDisplayers(graphUuid); } @Override public void resetCache() { resetLastElementRenderedCache(); } @Override public boolean areLastPositionsSameForElement(final Element element) { return areLastPositionsForSameElementSame(element); } }); view.init(this); } @Inject  FormPropertiesWidget(final FormPropertiesWidgetView view,
                                final DefinitionUtils definitionUtils,
                                final FormsCanvasSessionHandler formSessionHandler,
                                final Event<FormPropertiesOpened> propertiesOpenedEvent,
                                final FormsContainer formsContainer,
                                final FormsFlushManager formsFlushManager,
                                final TranslationService translationService); @PostConstruct @SuppressWarnings("unchecked") void init(); @Override HTMLElement getElement(); @Override HTMLElement getDisplayerElement(); FormsCanvasSessionHandler getFormSessionHandler(); @SuppressWarnings("unchecked") FormPropertiesWidget bind(final ClientSession session); @SuppressWarnings("unchecked") FormPropertiesWidget unbind(); @PreDestroy void destroy(); void show(); @SuppressWarnings("unchecked") void show(final Command callback); void resetLastElementRenderedCache(); boolean areLastPositionsForSameElementSame(final Element element); }
FormPropertiesWidget implements IsElement,
                                             FormPropertiesWidgetView.Presenter { @PostConstruct @SuppressWarnings("unchecked") public void init() { log(Level.INFO, "FormPropertiesWidget instance build."); formsFlushManager.setCurrentContainer(formsContainer); formSessionHandler.setRenderer(new FormsCanvasSessionHandler.FormRenderer() { @Override public void render(String graphUuid, Element element, Command callback) { show(graphUuid, element, callback); } @Override public void render(String graphUuid, DomainObject domainObject, Command callback) { show(graphUuid, domainObject, callback); } @Override public void clear(String graphUuid, Element element) { formsContainer.clearFormDisplayer(graphUuid, element.getUUID()); } @Override public void clearAll(String graphUuid) { formsContainer.clearDiagramDisplayers(graphUuid); } @Override public void resetCache() { resetLastElementRenderedCache(); } @Override public boolean areLastPositionsSameForElement(final Element element) { return areLastPositionsForSameElementSame(element); } }); view.init(this); } @Inject  FormPropertiesWidget(final FormPropertiesWidgetView view,
                                final DefinitionUtils definitionUtils,
                                final FormsCanvasSessionHandler formSessionHandler,
                                final Event<FormPropertiesOpened> propertiesOpenedEvent,
                                final FormsContainer formsContainer,
                                final FormsFlushManager formsFlushManager,
                                final TranslationService translationService); @PostConstruct @SuppressWarnings("unchecked") void init(); @Override HTMLElement getElement(); @Override HTMLElement getDisplayerElement(); FormsCanvasSessionHandler getFormSessionHandler(); @SuppressWarnings("unchecked") FormPropertiesWidget bind(final ClientSession session); @SuppressWarnings("unchecked") FormPropertiesWidget unbind(); @PreDestroy void destroy(); void show(); @SuppressWarnings("unchecked") void show(final Command callback); void resetLastElementRenderedCache(); boolean areLastPositionsForSameElementSame(final Element element);  }