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);
}
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);
}
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;
}
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;
}
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);
}
Aggregations