Search in sources :

Example 6 with Text

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

the class RendererUtils method makeExpressionText.

private static Text makeExpressionText(final GridRendererTheme theme) {
    final Text t = theme.getBodyText();
    t.setFontFamily(BaseExpressionGridTheme.FONT_FAMILY_EXPRESSION);
    return t;
}
Also used : Text(com.ait.lienzo.client.core.shape.Text)

Example 7 with Text

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

the class RendererUtils method getNameAndDataTypeText.

private static Group getNameAndDataTypeText(final GridRendererTheme theme, final String name, final QName typeRef, final double blockWidth, final double blockHeight) {
    final Group headerGroup = GWT.create(Group.class);
    final Text tName = theme.getHeaderText();
    tName.setText(name);
    tName.setListening(false);
    tName.setX(blockWidth / 2);
    tName.setY(blockHeight / 2 - SPACING);
    final Text tTypeRef = theme.getHeaderText();
    tTypeRef.setFontStyle(FONT_STYLE_TYPE_REF);
    tTypeRef.setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0);
    tTypeRef.setText("(" + typeRef.toString() + ")");
    tTypeRef.setListening(false);
    tTypeRef.setX(blockWidth / 2);
    tTypeRef.setY(blockHeight / 2 + SPACING);
    headerGroup.add(tName);
    headerGroup.add(tTypeRef);
    return headerGroup;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Text(com.ait.lienzo.client.core.shape.Text)

Example 8 with Text

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

the class RendererUtils method getExpressionText.

private static Group getExpressionText(final GridRendererTheme theme, final String text) {
    final Group g = GWT.create(Group.class);
    final Text t = makeExpressionText(theme);
    t.setText(text);
    t.setListening(false);
    t.setX(EXPRESSION_TEXT_PADDING);
    t.setY(EXPRESSION_TEXT_PADDING);
    t.setTextAlign(TextAlign.LEFT);
    t.setWrapper(new TextLineBreakWrap(t));
    g.add(t);
    return g;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Text(com.ait.lienzo.client.core.shape.Text) TextLineBreakWrap(com.ait.lienzo.client.core.shape.TextLineBreakWrap)

Example 9 with Text

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

the class BaseNameAndDataTypeHeaderMetaDataTest method testRender.

@Test
public void testRender() {
    final QName typeRef = BuiltInType.DATE.asQName();
    final GridRenderer renderer = mock(GridRenderer.class);
    final GridRendererTheme theme = mock(GridRendererTheme.class);
    final Text tName = mock(Text.class);
    final InformationItemPrimary hasExpressionVariable = new InformationItemPrimary();
    hasExpressionVariable.setTypeRef(typeRef);
    hasExpression.setVariable(hasExpressionVariable);
    final Decision decision = new Decision();
    decision.setName(NAME);
    setup(Optional.of(decision));
    when(theme.getHeaderText()).thenReturn(tName);
    when(context.getRenderer()).thenReturn(renderer);
    when(renderer.getTheme()).thenReturn(theme);
    when(hasTypeRef.getTypeRef()).thenReturn(typeRef);
    metaData.render(context, BLOCK_WIDTH, BLOCK_HEIGHT);
    verify(tName).setText(NAME.getValue());
    verify(tName, times(2)).setListening(false);
    verify(tName, times(2)).setX(BLOCK_WIDTH / 2);
    verify(tName).setY(BLOCK_HEIGHT / 2 - SPACING);
    verify(tName).setFontStyle(FONT_STYLE_TYPE_REF);
    verify(tName).setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0);
    verify(tName).setText("(" + typeRef.toString() + ")");
    verify(tName).setY(BLOCK_HEIGHT / 2 + SPACING);
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) 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) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 10 with Text

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

the class BaseValueAndDataTypeHeaderMetaDataTest method testRenderPlaceHolder.

@Test
public void testRenderPlaceHolder() {
    final GridRenderer renderer = mock(GridRenderer.class);
    final GridRendererTheme theme = mock(GridRendererTheme.class);
    final Text text = mock(Text.class);
    setup(Optional.empty());
    when(context.getRenderer()).thenReturn(renderer);
    when(renderer.getTheme()).thenReturn(theme);
    when(theme.getPlaceholderText()).thenReturn(text);
    metaData.renderPlaceHolder(context, BLOCK_WIDTH, BLOCK_HEIGHT);
    verify(text).setX(BLOCK_WIDTH / 2);
    verify(text).setY(BLOCK_HEIGHT / 2);
    verify(text).setText(PLACEHOLDER);
    verify(text).setListening(false);
}
Also used : 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) Test(org.junit.Test)

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