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