@Test public void testGetDisplayer() { FormDisplayer formDisplayer1 = mock(FormDisplayer.class); FormDisplayer formDisplayer2 = mock(FormDisplayer.class); ManagedInstance managedInstance = mock(ManagedInstance.class); when(managedInstance.get()).thenReturn(formDisplayer2); FormsContainerView formsContainerView = mock(FormsContainerView.class); FormsContainer formsContainer = new FormsContainer(formsContainerView, managedInstance, null); formsContainer.formDisplayers.put(new FormDisplayerKey(GRAPH_UUID, FIRST_ELEMENT_UUID), formDisplayer1); FormDisplayer result1 = formsContainer.getDisplayer(GRAPH_UUID, FIRST_ELEMENT_UUID); FormDisplayer result2 = formsContainer.getDisplayer(GRAPH_UUID, SECOND_ELEMENT_UUID); assertEquals(formDisplayer1, result1); assertEquals(formDisplayer2, result2); }
protected FormDisplayer getDisplayer(final String graphUuid, final String elementUuid) { FormDisplayerKey key = new FormDisplayerKey(graphUuid, elementUuid); FormDisplayer displayer = formDisplayers.get(key); LOGGER.fine("Getting form displayer for : " + key); if (displayer != null) { return displayer; } LOGGER.fine("Creating new form displayer for : " + key); displayer = displayersInstance.get(); displayer.hide(); view.addDisplayer(displayer); formDisplayers.put(new FormDisplayerKey(graphUuid, elementUuid), displayer); return displayer; }
FormsContainer implements IsElement { protected FormDisplayer getDisplayer(final String graphUuid, final String elementUuid) { FormDisplayerKey key = new FormDisplayerKey(graphUuid, elementUuid); FormDisplayer displayer = formDisplayers.get(key); LOGGER.fine("Getting form displayer for : " + key); if (displayer != null) { return displayer; } LOGGER.fine("Creating new form displayer for : " + key); displayer = displayersInstance.get(); displayer.hide(); view.addDisplayer(displayer); formDisplayers.put(new FormDisplayerKey(graphUuid, elementUuid), displayer); return displayer; } }
FormsContainer implements IsElement { protected FormDisplayer getDisplayer(final String graphUuid, final String elementUuid) { FormDisplayerKey key = new FormDisplayerKey(graphUuid, elementUuid); FormDisplayer displayer = formDisplayers.get(key); LOGGER.fine("Getting form displayer for : " + key); if (displayer != null) { return displayer; } LOGGER.fine("Creating new form displayer for : " + key); displayer = displayersInstance.get(); displayer.hide(); view.addDisplayer(displayer); formDisplayers.put(new FormDisplayerKey(graphUuid, elementUuid), displayer); return displayer; } @Inject  FormsContainer(final FormsContainerView view,
                          final @Any ManagedInstance<FormDisplayer> displayersInstance,
                          final Event<FormFieldChanged> formFieldChangedEvent); }
FormsContainer implements IsElement { protected FormDisplayer getDisplayer(final String graphUuid, final String elementUuid) { FormDisplayerKey key = new FormDisplayerKey(graphUuid, elementUuid); FormDisplayer displayer = formDisplayers.get(key); LOGGER.fine("Getting form displayer for : " + key); if (displayer != null) { return displayer; } LOGGER.fine("Creating new form displayer for : " + key); displayer = displayersInstance.get(); displayer.hide(); view.addDisplayer(displayer); formDisplayers.put(new FormDisplayerKey(graphUuid, elementUuid), displayer); return displayer; } @Inject  FormsContainer(final FormsContainerView view,
                          final @Any ManagedInstance<FormDisplayer> displayersInstance,
                          final Event<FormFieldChanged> formFieldChangedEvent); void render(final String graphUuid,
                       final String domainObjectUUID,
                       final Object domainObject,
                       final Path diagramPath,
                       final FieldChangeHandler changeHandler,
                       final RenderMode renderMode); void clearDiagramDisplayers(final String graphUuid); void clearFormDisplayer(final String graphUuid,
                                   final String elementUid); void flush(String graphUUID, String elementUUID); @Override HTMLElement getElement(); @PreDestroy void destroyAll(); }
FormsContainer implements IsElement { protected FormDisplayer getDisplayer(final String graphUuid, final String elementUuid) { FormDisplayerKey key = new FormDisplayerKey(graphUuid, elementUuid); FormDisplayer displayer = formDisplayers.get(key); LOGGER.fine("Getting form displayer for : " + key); if (displayer != null) { return displayer; } LOGGER.fine("Creating new form displayer for : " + key); displayer = displayersInstance.get(); displayer.hide(); view.addDisplayer(displayer); formDisplayers.put(new FormDisplayerKey(graphUuid, elementUuid), displayer); return displayer; } @Inject  FormsContainer(final FormsContainerView view,
                          final @Any ManagedInstance<FormDisplayer> displayersInstance,
                          final Event<FormFieldChanged> formFieldChangedEvent); void render(final String graphUuid,
                       final String domainObjectUUID,
                       final Object domainObject,
                       final Path diagramPath,
                       final FieldChangeHandler changeHandler,
                       final RenderMode renderMode); void clearDiagramDisplayers(final String graphUuid); void clearFormDisplayer(final String graphUuid,
                                   final String elementUid); void flush(String graphUUID, String elementUUID); @Override HTMLElement getElement(); @PreDestroy void destroyAll();  }