Search in sources :

Example 1 with SelectionControl

use of org.kie.workbench.common.stunner.core.client.canvas.controls.select.SelectionControl in project kie-wb-common by kiegroup.

the class FormsCanvasSessionHandler method show.

@SuppressWarnings("unchecked")
public void show(final Command callback) {
    if (null != session) {
        // Obtain first element selected on session, if any.
        String selectedItemUUID = null;
        final SelectionControl selectionControl = featuresSessionProvider.getSelectionControl(session);
        if (null != selectionControl) {
            final Collection<String> selectedItems = selectionControl.getSelectedItems();
            if (null != selectedItems && !selectedItems.isEmpty()) {
                selectedItemUUID = selectedItems.iterator().next();
            }
        } else {
            LOGGER.log(Level.WARNING, "Cannot show properties as session type does not provides " + "selection control's support.");
        }
        if (null == selectedItemUUID) {
            final Diagram<?, ?> diagram = getDiagram();
            if (null != diagram) {
                final String cRoot = diagram.getMetadata().getCanvasRootUUID();
                // Check if there exist any canvas root element.
                if (!isEmpty(cRoot)) {
                    selectedItemUUID = cRoot;
                }
            }
        }
        if (null != selectedItemUUID) {
            render(selectedItemUUID, callback);
        }
    }
}
Also used : SelectionControl(org.kie.workbench.common.stunner.core.client.canvas.controls.select.SelectionControl)

Example 2 with SelectionControl

use of org.kie.workbench.common.stunner.core.client.canvas.controls.select.SelectionControl in project kie-wb-common by kiegroup.

the class CaseManagementCanvasFactoryTest method testControls.

@Test
public void testControls() {
    ConnectionAcceptorControl connectionAcceptorControl = factory.newControl(ConnectionAcceptorControl.class);
    assertNotNull(connectionAcceptorControl);
    ContainmentAcceptorControl containmentAcceptorControl = factory.newControl(ContainmentAcceptorControl.class);
    assertNotNull(containmentAcceptorControl);
    DockingAcceptorControl dockingAcceptorControl = factory.newControl(DockingAcceptorControl.class);
    assertNotNull(dockingAcceptorControl);
    CanvasInPlaceTextEditorControl canvasInPlaceTextEditorControl = factory.newControl(CanvasInPlaceTextEditorControl.class);
    assertNotNull(canvasInPlaceTextEditorControl);
    SelectionControl selectionControl = factory.newControl(SelectionControl.class);
    assertNotNull(selectionControl);
    ElementBuilderControl elementBuilderControl = factory.newControl(ElementBuilderControl.class);
    assertNotNull(elementBuilderControl);
    NodeBuilderControl nodeBuilderControl = factory.newControl(NodeBuilderControl.class);
    assertNotNull(nodeBuilderControl);
    EdgeBuilderControl edgeBuilderControl = factory.newControl(EdgeBuilderControl.class);
    assertNotNull(edgeBuilderControl);
    ZoomControl zoomControl = factory.newControl(ZoomControl.class);
    assertNotNull(zoomControl);
    PanControl panControl = factory.newControl(PanControl.class);
    assertNotNull(panControl);
    KeyboardControl keyboardControl = factory.newControl(KeyboardControl.class);
    assertNotNull(keyboardControl);
}
Also used : ZoomControl(org.kie.workbench.common.stunner.core.client.canvas.controls.zoom.ZoomControl) PanControl(org.kie.workbench.common.stunner.core.client.canvas.controls.pan.PanControl) KeyboardControl(org.kie.workbench.common.stunner.core.client.canvas.controls.keyboard.KeyboardControl) EdgeBuilderControl(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.EdgeBuilderControl) CaseManagementNodeBuilderControl(org.kie.workbench.common.stunner.cm.client.canvas.controls.builder.CaseManagementNodeBuilderControl) NodeBuilderControl(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.NodeBuilderControl) ConnectionAcceptorControl(org.kie.workbench.common.stunner.core.client.canvas.controls.connection.ConnectionAcceptorControl) ElementBuilderControl(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.ElementBuilderControl) CaseManagementElementBuilderControl(org.kie.workbench.common.stunner.cm.client.canvas.controls.builder.CaseManagementElementBuilderControl) ContainmentAcceptorControl(org.kie.workbench.common.stunner.core.client.canvas.controls.containment.ContainmentAcceptorControl) SelectionControl(org.kie.workbench.common.stunner.core.client.canvas.controls.select.SelectionControl) DockingAcceptorControl(org.kie.workbench.common.stunner.core.client.canvas.controls.docking.DockingAcceptorControl) CanvasInPlaceTextEditorControl(org.kie.workbench.common.stunner.core.client.canvas.controls.actions.CanvasInPlaceTextEditorControl) Test(org.junit.Test)

Aggregations

SelectionControl (org.kie.workbench.common.stunner.core.client.canvas.controls.select.SelectionControl)2 Test (org.junit.Test)1 CaseManagementElementBuilderControl (org.kie.workbench.common.stunner.cm.client.canvas.controls.builder.CaseManagementElementBuilderControl)1 CaseManagementNodeBuilderControl (org.kie.workbench.common.stunner.cm.client.canvas.controls.builder.CaseManagementNodeBuilderControl)1 CanvasInPlaceTextEditorControl (org.kie.workbench.common.stunner.core.client.canvas.controls.actions.CanvasInPlaceTextEditorControl)1 EdgeBuilderControl (org.kie.workbench.common.stunner.core.client.canvas.controls.builder.EdgeBuilderControl)1 ElementBuilderControl (org.kie.workbench.common.stunner.core.client.canvas.controls.builder.ElementBuilderControl)1 NodeBuilderControl (org.kie.workbench.common.stunner.core.client.canvas.controls.builder.NodeBuilderControl)1 ConnectionAcceptorControl (org.kie.workbench.common.stunner.core.client.canvas.controls.connection.ConnectionAcceptorControl)1 ContainmentAcceptorControl (org.kie.workbench.common.stunner.core.client.canvas.controls.containment.ContainmentAcceptorControl)1 DockingAcceptorControl (org.kie.workbench.common.stunner.core.client.canvas.controls.docking.DockingAcceptorControl)1 KeyboardControl (org.kie.workbench.common.stunner.core.client.canvas.controls.keyboard.KeyboardControl)1 PanControl (org.kie.workbench.common.stunner.core.client.canvas.controls.pan.PanControl)1 ZoomControl (org.kie.workbench.common.stunner.core.client.canvas.controls.zoom.ZoomControl)1