use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class ShapeGlyphDragHandlerImplTest method setUp.
@Before
public void setUp() throws Exception {
shapeGlyphDragHandler = new ShapeGlyphDragHandlerImpl(glyphLienzoGlyphRenderer);
when(item.getHeight()).thenReturn(0);
when(item.getWidth()).thenReturn(0);
when(item.getShape()).thenReturn(glyph);
when(glyphLienzoGlyphRenderer.render(glyph, 0, 0)).thenReturn(new Group());
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class EditableHeaderGridWidgetMouseDoubleClickHandler method handleHeaderCellDoubleClick.
@Override
protected boolean handleHeaderCellDoubleClick(final NodeMouseDoubleClickEvent event) {
// Convert Canvas co-ordinate to Grid co-ordinate
final Point2D rp = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget, new Point2D(event.getX(), event.getY()));
final double cx = rp.getX();
final double cy = rp.getY();
final Group header = gridWidget.getHeader();
final double headerRowsYOffset = getHeaderRowsYOffset();
final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);
final double headerMaxY = (header == null ? renderer.getHeaderHeight() : renderer.getHeaderHeight() + header.getY());
if (cx < 0 || cx > gridWidget.getWidth()) {
return false;
}
if (cy < headerMinY || cy > headerMaxY) {
return false;
}
// Get column information
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation();
if (ri == null) {
return false;
}
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);
final GridColumn<?> column = ci.getColumn();
if (column == null) {
return false;
}
if (!hasEditableHeader(column)) {
return false;
}
// Get row index
final Integer uiHeaderRowIndex = EditableHeaderUtilities.getUiHeaderRowIndex(gridWidget, column, cy);
if (uiHeaderRowIndex == null) {
return false;
}
if (!isEditableHeader(column, uiHeaderRowIndex)) {
return false;
}
// Get rendering information
final EditableHeaderMetaData headerMetaData = (EditableHeaderMetaData) column.getHeaderMetaData().get(uiHeaderRowIndex);
final GridBodyCellEditContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, uiHeaderRowIndex);
headerMetaData.edit(context);
return true;
}
use of com.ait.lienzo.client.core.shape.Group in project lienzo-core by ahome-it.
the class WiresConnector method setWiresConnectorHandler.
public void setWiresConnectorHandler(final HandlerRegistrationManager m_registrationManager, final WiresConnectorHandler handler) {
final Group group = getGroup();
m_registrationManager.register(group.addNodeDragStartHandler(handler));
m_registrationManager.register(group.addNodeDragMoveHandler(handler));
m_registrationManager.register(group.addNodeDragEndHandler(handler));
m_wiresConnectorHandler = handler;
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnRenderer method renderCell.
@Override
public Group renderCell(final GridCell<Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>>> cell, final GridBodyCellRenderContext context) {
if (cell == null || cell.getValue() == null) {
return null;
}
final Group g = GWT.create(Group.class);
if (cell.getValue() != null && cell.getValue() instanceof ExpressionCellValue) {
final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue();
ecv.getValue().ifPresent(editor -> {
g.add(editor.setX(editor.getPadding()).setY(editor.getPadding()));
registry.register(editor);
});
}
return g;
}
use of com.ait.lienzo.client.core.shape.Group 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;
}
Aggregations