Search in sources :

Example 1 with PaletteShape

use of org.uberfire.ext.wires.core.client.palette.PaletteShape in project drools-wb by kiegroup.

the class GuidedDecisionTreePaletteGroup method addStencil.

public void addStencil(final ShapeFactory factory, final GuidedDecisionTreeStencilPaletteBuilder stencilBuilder, final FactoryHelper helper, final boolean isReadOnly) {
    final LienzoPanel panel = new FocusableLienzoPanel(GuidedDecisionTreeStencilPaletteBuilder.STENCIL_WIDTH, GuidedDecisionTreeStencilPaletteBuilder.STENCIL_HEIGHT + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING);
    final Layer layer = new Layer();
    panel.getScene().add(layer);
    // Create a new PaletteShape from the given factory
    final PaletteShape shape = stencilBuilder.build(panel, helper, factory, isReadOnly);
    layer.add(shape);
    layer.batch();
    add(panel);
}
Also used : LienzoPanel(com.ait.lienzo.client.widget.LienzoPanel) FocusableLienzoPanel(org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel) PaletteShape(org.uberfire.ext.wires.core.client.palette.PaletteShape) Layer(com.ait.lienzo.client.core.shape.Layer) FocusableLienzoPanel(org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel)

Example 2 with PaletteShape

use of org.uberfire.ext.wires.core.client.palette.PaletteShape in project drools-wb by kiegroup.

the class GuidedDecisionTreeStencilPaletteBuilder method build.

public PaletteShape build(final LienzoPanel dragProxyParentPanel, final FactoryHelper helper, final ShapeFactory factory, final boolean isReadOnly) {
    // If the Editor is not Read Only delegate to super class
    if (!isReadOnly) {
        return super.build(dragProxyParentPanel, helper, factory);
    }
    // Otherwise make a Read Only Stencil
    final PaletteShape paletteShape = new PaletteShape();
    final ShapeGlyph glyph = drawGlyph(factory, helper);
    final Text description = drawDescription(factory, helper);
    final Rectangle bounding = drawBoundingBox(factory, helper);
    // Build Palette Shape
    paletteShape.setBounding(bounding);
    paletteShape.setGroup(scaleGlyph(glyph));
    paletteShape.setDescription(description);
    return paletteShape;
}
Also used : ShapeGlyph(org.uberfire.ext.wires.core.api.factories.ShapeGlyph) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Text(com.ait.lienzo.client.core.shape.Text) PaletteShape(org.uberfire.ext.wires.core.client.palette.PaletteShape)

Aggregations

PaletteShape (org.uberfire.ext.wires.core.client.palette.PaletteShape)2 Layer (com.ait.lienzo.client.core.shape.Layer)1 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)1 Text (com.ait.lienzo.client.core.shape.Text)1 LienzoPanel (com.ait.lienzo.client.widget.LienzoPanel)1 ShapeGlyph (org.uberfire.ext.wires.core.api.factories.ShapeGlyph)1 FocusableLienzoPanel (org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel)1