use of com.ait.lienzo.client.core.shape.Group 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 com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class RendererUtils method getCenteredCellText.
public static Group getCenteredCellText(final GridBodyCellRenderContext context, final GridCell<String> gridCell) {
final GridRenderer gridRenderer = context.getRenderer();
final GridRendererTheme theme = gridRenderer.getTheme();
final Group g = GWT.create(Group.class);
String value = gridCell.getValue().getValue();
final Text t;
if (!StringUtils.isEmpty(value)) {
t = theme.getBodyText();
} else {
value = gridCell.getValue().getPlaceHolder();
t = theme.getPlaceholderText();
}
t.setText(value);
t.setListening(false);
t.setX(context.getCellWidth() / 2);
t.setY(context.getCellHeight() / 2);
g.add(t);
return g;
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class EditableHeaderUtilities method getEditableHeaderContent.
public static Group getEditableHeaderContent(final Supplier<Group> defaultHeaderContentSupplier, final List<GridColumn.HeaderMetaData> headerMetaData, final GridHeaderColumnRenderContext context, final int headerRowIndex, final double blockWidth, final double rowHeight) {
final Group headerGroup = GWT.create(Group.class);
if (headerRowIndex >= headerMetaData.size()) {
return headerGroup;
}
final GridColumn.HeaderMetaData headerRowMetaData = headerMetaData.get(headerRowIndex);
if (headerRowMetaData instanceof EditableHeaderMetaData) {
final EditableHeaderMetaData editableHeaderMetaData = (EditableHeaderMetaData) headerRowMetaData;
if (EditableHeaderUtilities.isPlaceHolderToBeShown(editableHeaderMetaData)) {
return editableHeaderMetaData.renderPlaceHolder(context, blockWidth, rowHeight);
}
return ((EditableHeaderMetaData) headerRowMetaData).render(context, blockWidth, rowHeight);
}
return defaultHeaderContentSupplier.get();
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class WiresShapeViewTest method testMove.
@Test
public void testMove() {
final LayoutContainer container = mock(LayoutContainer.class);
final Group group = mock(Group.class);
when(container.getGroup()).thenReturn(group);
when(container.refresh()).thenReturn(container);
when(container.execute()).thenReturn(container);
when(container.setOffset(any(Point2D.class))).thenReturn(container);
when(container.setSize(anyDouble(), anyDouble())).thenReturn(container);
this.tested = new WiresShapeView(PATH, container);
tested.moveToTop();
tested.moveToBottom();
tested.moveUp();
tested.moveDown();
verify(group, times(1)).moveToTop();
verify(group, times(1)).moveToBottom();
verify(group, times(1)).moveUp();
verify(group, times(1)).moveDown();
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class LienzoShapeGlyphRendererTest method testRender.
@Test
@SuppressWarnings("unchecked")
public void testRender() {
final Group group = tested.render(glyph, 150d, 351d);
assertEquals(this.group, group);
verify(this.group, times(1)).setScale(eq(1d), eq(1d));
}
Aggregations