Search in sources :

Example 1 with GridRendererTheme

use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme 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 2 with GridRendererTheme

use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme 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)

Example 3 with GridRendererTheme

use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme 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 4 with GridRendererTheme

use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme 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)

Example 5 with GridRendererTheme

use of org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme in project kie-wb-common by kiegroup.

the class UndefinedExpressionColumnRenderer method renderCell.

@Override
public Group renderCell(final GridCell<String> cell, final GridBodyCellRenderContext context) {
    if (isToReturnNull(cell)) {
        return null;
    }
    final GridRenderer renderer = context.getRenderer();
    final GridRendererTheme theme = renderer.getTheme();
    final Text text = theme.getPlaceholderText();
    final String value = cell.getValue().getPlaceHolder();
    return internalRenderCell(cell, context, text, value);
}
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)

Aggregations

GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)8 GridRendererTheme (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme)8 Text (com.ait.lienzo.client.core.shape.Text)6 Group (com.ait.lienzo.client.core.shape.Group)3 Test (org.junit.Test)2 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)1 InformationItemPrimary (org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary)1 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)1