Search in sources :

Example 1 with FormDisplayer

use of org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer in project kie-wb-common by kiegroup.

the class FormsContainer method getDisplayer.

private FormDisplayer getDisplayer(String graphUuid, Element<? extends Definition<?>> element) {
    FormDisplayerKey key = new FormDisplayerKey(graphUuid, element.getUUID());
    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, element.getUUID()), displayer);
    return displayer;
}
Also used : FormDisplayer(org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer)

Example 2 with FormDisplayer

use of org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer in project kie-wb-common by kiegroup.

the class FormsContainerTest method testRender.

private FormDisplayer testRender(NodeImpl node, int expectedDisplayers, int currentDisplayerRender) {
    formsContainer.render(GRAPH_UID, node, path, fieldChangeHandler);
    verify(displayersInstance, times(expectedDisplayers)).get();
    assertThat(activeDisplayers).isNotEmpty().hasSize(expectedDisplayers);
    FormDisplayer displayer = activeDisplayers.get(expectedDisplayers - 1);
    verify(displayer, times(currentDisplayerRender)).render(node, path, fieldChangeHandler);
    verify(displayer, times(currentDisplayerRender)).hide();
    verify(view, times(currentDisplayerRender)).addDisplayer(displayer);
    verify(displayer).show();
    return displayer;
}
Also used : FormDisplayer(org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer)

Example 3 with FormDisplayer

use of org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer in project kie-wb-common by kiegroup.

the class FormsContainerTest method testDestroyOneDisplayer.

@Test
public void testDestroyOneDisplayer() {
    NodeImpl firstNode = getNode(FIRST_ELEMENT_UID);
    FormDisplayer firstDisplayer = testRender(firstNode, 1, 1);
    NodeImpl secondNode = getNode(SECOND_ELEMENT_UID);
    FormDisplayer secondDisplayer = testRender(secondNode, 2, 1);
    formsContainer.clearFormDisplayer(GRAPH_UID, FIRST_ELEMENT_UID);
    verify(firstDisplayer, times(3)).hide();
    verify(view, times(1)).removeDisplayer(firstDisplayer);
    verify(displayersInstance, times(1)).destroy(firstDisplayer);
    verify(secondDisplayer, times(1)).hide();
    verify(view, never()).removeDisplayer(secondDisplayer);
    verify(displayersInstance, never()).destroy(secondDisplayer);
    formsContainer.clearFormDisplayer(GRAPH_UID, SECOND_ELEMENT_UID);
    verify(secondDisplayer, times(2)).hide();
    verify(view, times(1)).removeDisplayer(secondDisplayer);
    verify(displayersInstance, times(1)).destroy(secondDisplayer);
}
Also used : FormDisplayer(org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Test(org.junit.Test)

Example 4 with FormDisplayer

use of org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer in project kie-wb-common by kiegroup.

the class FormsContainerTest method testRenderExistingNode.

@Test
public void testRenderExistingNode() {
    NodeImpl firstNode = getNode(FIRST_ELEMENT_UID);
    FormDisplayer firstDisplayer = testRender(firstNode, 1, 1);
    NodeImpl secondNode = getNode(SECOND_ELEMENT_UID);
    FormDisplayer secondDisplayer = testRender(secondNode, 2, 1);
    formsContainer.render(GRAPH_UID, firstNode, path, fieldChangeHandler);
    verify(displayersInstance, times(2)).get();
    verify(secondDisplayer, times(2)).hide();
    verify(firstDisplayer, times(2)).show();
    verify(firstDisplayer, times(2)).render(firstNode, path, fieldChangeHandler);
}
Also used : FormDisplayer(org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Test(org.junit.Test)

Example 5 with FormDisplayer

use of org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer in project kie-wb-common by kiegroup.

the class FormsContainerTest method testDestroyDiagramDisplayers.

@Test
public void testDestroyDiagramDisplayers() {
    FormDisplayer firstDisplayer = testRender(getNode(FIRST_ELEMENT_UID), 1, 1);
    FormDisplayer secondDisplayer = testRender(getNode(SECOND_ELEMENT_UID), 2, 1);
    formsContainer.clearDiagramDisplayers(GRAPH_UID);
    verify(firstDisplayer, times(3)).hide();
    verify(view, times(1)).removeDisplayer(firstDisplayer);
    verify(displayersInstance, times(1)).destroy(firstDisplayer);
    verify(secondDisplayer, times(2)).hide();
    verify(view, times(1)).removeDisplayer(secondDisplayer);
    verify(displayersInstance, times(1)).destroy(secondDisplayer);
}
Also used : FormDisplayer(org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer) Test(org.junit.Test)

Aggregations

FormDisplayer (org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer)8 Test (org.junit.Test)3 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)2