Search in sources :

Example 11 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class AbstractWiresShapeViewText method setUp.

public void setUp() {
    this.text = new Text("test");
    this.layout = new LabelLayout.Builder().horizontalAlignment(DirectionLayout.HorizontalAlignment.CENTER).verticalAlignment(DirectionLayout.VerticalAlignment.MIDDLE).referencePosition(DirectionLayout.ReferencePosition.INSIDE).build();
    when(textDecorator.getView()).thenReturn(text);
    when(textDecorator.getLabelLayout()).thenReturn(layout);
    this.tested = spy(createInstance());
    this.tested.setTextViewDecorator(textDecorator);
    verify(tested, never()).addLabel(any(), any());
}
Also used : Text(com.ait.lienzo.client.core.shape.Text) LabelLayout(com.ait.lienzo.client.core.shape.wires.layout.label.LabelLayout)

Example 12 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class WiresTextDecoratorTest method testMoveTitleToFront.

@Test
public void testMoveTitleToFront() throws NoSuchFieldException, IllegalAccessException {
    final Text text = spy(new Text(""));
    final WiresTextDecorator localDecorator = new WiresTextDecorator(eventHandlerManager, shape);
    final NFastArrayList<WiresShape> children = new NFastArrayList<>();
    children.add(child1);
    children.add(child2);
    when(child1.getGroup()).thenReturn(mock(Group.class));
    when(child2.getGroup()).thenReturn(mock(Group.class));
    when(shape.getChildShapes()).thenReturn(children);
    final Field field = localDecorator.getClass().getDeclaredField("text");
    field.setAccessible(true);
    field.set(localDecorator, text);
    localDecorator.moveTitleToTop();
    InOrder order = inOrder(text, child1.getGroup(), child2.getGroup());
    order.verify(text).moveToTop();
    order.verify(child1.getGroup()).moveToTop();
    order.verify(child2.getGroup()).moveToTop();
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Group(com.ait.lienzo.client.core.shape.Group) Field(java.lang.reflect.Field) InOrder(org.mockito.InOrder) NFastArrayList(com.ait.tooling.nativetools.client.collection.NFastArrayList) Text(com.ait.lienzo.client.core.shape.Text) Test(org.junit.Test)

Example 13 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class WiresTextDecoratorTest method testBatch.

@Test
public void testBatch() throws IllegalAccessException, NoSuchFieldException {
    Text text = spy(new Text(""));
    final WiresTextDecorator localDecorator = new WiresTextDecorator(eventHandlerManager, shape);
    final Field field = localDecorator.getClass().getDeclaredField("text");
    field.setAccessible(true);
    field.set(localDecorator, text);
    localDecorator.batch();
    verify(text).batch();
}
Also used : Field(java.lang.reflect.Field) Text(com.ait.lienzo.client.core.shape.Text) Test(org.junit.Test)

Example 14 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class RendererUtils method getEditableHeaderText.

public static Group getEditableHeaderText(final EditableHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double blockHeight) {
    final Group headerGroup = GWT.create(Group.class);
    final GridRenderer renderer = context.getRenderer();
    final GridRendererTheme theme = renderer.getTheme();
    final Text text = theme.getHeaderText();
    final String value = headerMetaData.getTitle();
    text.setX(blockWidth / 2);
    text.setY(blockHeight / 2);
    text.setText(value);
    text.setListening(false);
    headerGroup.add(text);
    return headerGroup;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridRendererTheme(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme) Text(com.ait.lienzo.client.core.shape.Text) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)

Example 15 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class RendererUtils method getEditableHeaderPlaceHolderText.

public static Group getEditableHeaderPlaceHolderText(final EditableHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double blockHeight) {
    final Group headerGroup = GWT.create(Group.class);
    headerMetaData.getPlaceHolder().ifPresent(placeHolder -> {
        final GridRenderer renderer = context.getRenderer();
        final GridRendererTheme theme = renderer.getTheme();
        final Text text = theme.getPlaceholderText();
        text.setX(blockWidth / 2);
        text.setY(blockHeight / 2);
        text.setText(placeHolder);
        text.setListening(false);
        headerGroup.add(text);
    });
    return headerGroup;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridRendererTheme(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme) Text(com.ait.lienzo.client.core.shape.Text) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)

Aggregations

Text (com.ait.lienzo.client.core.shape.Text)26 Group (com.ait.lienzo.client.core.shape.Group)10 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)6 GridRendererTheme (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme)6 Test (org.junit.Test)5 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)4 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)3 TextBoundsWrap (com.ait.lienzo.client.core.shape.TextBoundsWrap)2 Field (java.lang.reflect.Field)2 GridBodyCellRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext)2 AnimationProperties (com.ait.lienzo.client.core.animation.AnimationProperties)1 IAnimation (com.ait.lienzo.client.core.animation.IAnimation)1 IAnimationCallback (com.ait.lienzo.client.core.animation.IAnimationCallback)1 IAnimationHandle (com.ait.lienzo.client.core.animation.IAnimationHandle)1 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)1 ITextWrapper (com.ait.lienzo.client.core.shape.ITextWrapper)1 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 Node (com.ait.lienzo.client.core.shape.Node)1 TextLineBreakWrap (com.ait.lienzo.client.core.shape.TextLineBreakWrap)1 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)1