Search in sources :

Example 66 with Group

use of com.ait.lienzo.client.core.shape.Group in project drools-wb by kiegroup.

the class BaseGuidedDecisionTreeShape method setupControls.

protected void setupControls() {
    ctrlGroupDeleteIcon = setupControl(GuidedDecisionTreeResources.INSTANCE.images().ctrlDelete(), new Command() {

        @Override
        public void execute() {
            shapesManager.deleteShape(BaseGuidedDecisionTreeShape.this);
        }
    });
    ctrlGroupEditIcon = setupControl(GuidedDecisionTreeResources.INSTANCE.images().ctrlEdit(), new Command() {

        @Override
        public void execute() {
            presenter.editModelNode(BaseGuidedDecisionTreeShape.this.getModelNode(), new Command() {

                @Override
                public void execute() {
                    updateLabels(BaseGuidedDecisionTreeShape.this);
                    BaseGuidedDecisionTreeShape.this.getLayer().batch();
                }

                private void updateLabels(final BaseGuidedDecisionTreeShape parent) {
                    parent.setNodeLabel(parent.getNodeLabel());
                    for (WiresBaseTreeNode child : parent.getChildren()) {
                        if (child instanceof BaseGuidedDecisionTreeShape) {
                            final BaseGuidedDecisionTreeShape cs = (BaseGuidedDecisionTreeShape) child;
                            cs.setNodeLabel(cs.getNodeLabel());
                            updateLabels(cs);
                        }
                    }
                }
            });
        }
    });
    ctrlGroupCollapseIcon = setupControl(GuidedDecisionTreeResources.INSTANCE.images().ctrlCollapse(), new Command() {

        @Override
        public void execute() {
            BaseGuidedDecisionTreeShape.this.collapse(new Command() {

                @Override
                public void execute() {
                // Nothing to do when the animation completes
                }
            });
            final List<Group> controls = new ArrayList<Group>() {

                {
                    add(ctrlGroupDeleteIcon);
                    add(ctrlGroupExpandIcon);
                }
            };
            BaseGuidedDecisionTreeShape.this.setControls(controls);
        }
    });
    ctrlGroupExpandIcon = setupControl(GuidedDecisionTreeResources.INSTANCE.images().ctrlExpand(), new Command() {

        @Override
        public void execute() {
            BaseGuidedDecisionTreeShape.this.expand(new Command() {

                @Override
                public void execute() {
                // Nothing to do when the animation completes
                }
            });
            final List<Group> controls = new ArrayList<Group>() {

                {
                    add(ctrlGroupDeleteIcon);
                    add(ctrlGroupEditIcon);
                    add(ctrlGroupCollapseIcon);
                }
            };
            BaseGuidedDecisionTreeShape.this.setControls(controls);
        }
    });
    controls.add(ctrlGroupDeleteIcon);
    controls.add(ctrlGroupEditIcon);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Command(org.uberfire.mvp.Command) WiresBaseTreeNode(org.uberfire.ext.wires.core.trees.client.shapes.WiresBaseTreeNode) ArrayList(java.util.ArrayList)

Aggregations

Group (com.ait.lienzo.client.core.shape.Group)66 Test (org.junit.Test)17 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)10 Before (org.junit.Before)10 Text (com.ait.lienzo.client.core.shape.Text)9 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)8 Layer (com.ait.lienzo.client.core.shape.Layer)7 Point2D (com.ait.lienzo.client.core.types.Point2D)7 Command (org.uberfire.mvp.Command)6 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)4 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)4 Line (com.ait.lienzo.client.core.shape.Line)3 ArrayList (java.util.ArrayList)3 SVGContainer (org.kie.workbench.common.stunner.svg.client.shape.view.SVGContainer)3 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)3 GridRendererTheme (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme)3 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)2 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)2 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)2 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)2