本文整理汇总了Java中org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.ColumnInformation方法的典型用法代码示例。如果您正苦于以下问题:Java BaseGridRendererHelper.ColumnInformation方法的具体用法?Java BaseGridRendererHelper.ColumnInformation怎么用?Java BaseGridRendererHelper.ColumnInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper
的用法示例。
在下文中一共展示了BaseGridRendererHelper.ColumnInformation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUiColumnIndex
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
/**
* Gets the column index corresponding to the provided Canvas x-coordinate relative to the grid. Grid-relative coordinates can be
* obtained from {@link INodeXYEvent} using {@link CoordinateUtilities#convertDOMToGridCoordinate(GridWidget, Point2D)}
* @param gridWidget GridWidget to check.
* @param cx x-coordinate relative to the GridWidget.
* @return The column index or null if the coordinate did not map to a cell.
*/
public static Integer getUiColumnIndex(final GridWidget gridWidget,
final double cx) {
final GridData gridModel = gridWidget.getModel();
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
if (cx < 0 || cx > gridWidget.getWidth()) {
return null;
}
//Get column index
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);
final GridColumn<?> column = ci.getColumn();
final int uiColumnIndex = ci.getUiColumnIndex();
if (column == null) {
return null;
}
if (uiColumnIndex < 0 || uiColumnIndex > gridModel.getColumnCount() - 1) {
return null;
}
return uiColumnIndex;
}
示例2: startEditingCell
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Override
public boolean startEditingCell(final Point2D ap) {
//Get row information
final Integer uiRowIndex = CoordinateUtilities.getUiRowIndex(gridWidget,
ap.getY());
if (uiRowIndex == null) {
return false;
}
//Get column information
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(ap.getX());
final GridColumn<?> column = ci.getColumn();
if (column == null) {
return false;
}
return edit(uiRowIndex,
ci);
}
示例3: getFloatingColumnInformation
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
private BaseGridRendererHelper.ColumnInformation getFloatingColumnInformation(final int uiColumnIndex) {
final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex);
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();
final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();
final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();
if (!floatingColumns.contains(column)) {
return null;
}
return new BaseGridRendererHelper.ColumnInformation(column,
uiColumnIndex,
floatingBlockInformation.getX() + rendererHelper.getColumnOffset(floatingColumns,
floatingColumns.indexOf(column)));
}
示例4: getBodyColumnInformation
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
private BaseGridRendererHelper.ColumnInformation getBodyColumnInformation(final int uiColumnIndex) {
final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex);
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();
final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();
final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();
if (!bodyColumns.contains(column)) {
return null;
}
return new BaseGridRendererHelper.ColumnInformation(column,
uiColumnIndex,
bodyBlockInformation.getX() + rendererHelper.getColumnOffset(bodyColumns,
bodyColumns.indexOf(column)));
}
示例5: basicCheckForBodyHandlerWithinBodyBounds
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
public void basicCheckForBodyHandlerWithinBodyBounds() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(200);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
handler.onNodeMouseClick(event);
verify(handler,
times(1)).handleBodyCellClick(any(NodeMouseClickEvent.class));
verify(gridWidget,
times(1)).selectCell(any(Point2D.class),
eq(false),
eq(false));
}
示例6: basicCheckForBodyHandlerOutsideBodyBounds
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
public void basicCheckForBodyHandlerOutsideBodyBounds() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(120);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
handler.onNodeMouseClick(event);
verify(handler,
times(1)).handleBodyCellClick(any(NodeMouseClickEvent.class));
verify(uiModel,
never()).getCell(any(Integer.class),
any(Integer.class));
}
示例7: basicCheckForBodyHandler
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
public void basicCheckForBodyHandler() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(200);
when(gridWidget.getLocation()).thenReturn(new Point2D(100,
100));
when(gridWidget.getHeight()).thenReturn(200.0);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
handler.onNodeMouseDoubleClick(event);
verify(handler,
times(1)).handleHeaderCellDoubleClick(any(NodeMouseDoubleClickEvent.class));
verify(handler,
times(1)).handleBodyCellDoubleClick(any(NodeMouseDoubleClickEvent.class));
}
示例8: selectVisibleGridBody
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
public void selectVisibleGridBody() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(200);
when(gridWidget.getLocation()).thenReturn(new Point2D(100,
100));
when(gridWidget.getHeight()).thenReturn(200.0);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
handler.onNodeMouseClick(event);
verify(handler,
times(1)).handleHeaderCellClick(any(NodeMouseClickEvent.class));
verify(handler,
times(1)).handleBodyCellClick(any(NodeMouseClickEvent.class));
verify(selectionManager,
times(1)).select(eq(gridWidget));
}
示例9: handleHeaderCellClick
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
/**
* Check if a MouseClickEvent happened on a "linked" column. If it does then
* delegate a response to GridSelectionManager.
* @param event
*/
protected boolean handleHeaderCellClick(final NodeMouseClickEvent event) {
//Convert Canvas co-ordinate to Grid co-ordinate
final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget,
new Point2D(event.getX(),
event.getY()));
final double cx = ap.getX();
final double cy = ap.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 index
final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);
final GridColumn<?> column = ci.getColumn();
if (column == null) {
return false;
}
//If linked scroll it into view
if (column.isLinked()) {
final GridColumn<?> link = column.getLink();
selectionManager.selectLinkedColumn(link);
return true;
}
return false;
}
示例10: selectVisibleGridHeaderNonLinkedColumn
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
public void selectVisibleGridHeaderNonLinkedColumn() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(100);
when(gridWidget.getLocation()).thenReturn(new Point2D(100,
100));
when(uiColumn.isLinked()).thenReturn(false);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
handler.onNodeMouseClick(event);
verify(handler,
times(1)).handleHeaderCellClick(any(NodeMouseClickEvent.class));
verify(handler,
times(1)).handleBodyCellClick(any(NodeMouseClickEvent.class));
verify(selectionManager,
times(1)).select(eq(gridWidget));
verify(selectionManager,
never()).selectLinkedColumn(eq(uiColumn));
}
示例11: selectVisibleGridHeaderLinkedColumn
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
public void selectVisibleGridHeaderLinkedColumn() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(100);
when(gridWidget.getAbsoluteX()).thenReturn(100.0);
when(gridWidget.getAbsoluteY()).thenReturn(100.0);
when(uiColumn.isLinked()).thenReturn(true);
when(uiColumn.getLink()).thenAnswer(invocation -> uiLinkedColumn);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
handler.onNodeMouseClick(event);
verify(handler,
times(1)).handleHeaderCellClick(any(NodeMouseClickEvent.class));
verify(handler,
never()).handleBodyCellClick(any(NodeMouseClickEvent.class));
verify(selectionManager,
never()).select(eq(gridWidget));
verify(selectionManager,
times(1)).selectLinkedColumn(eq(uiLinkedColumn));
}
示例12: handleHeaderCellDoubleClick
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Override
protected boolean handleHeaderCellDoubleClick(final NodeMouseDoubleClickEvent event) {
//Convert Canvas co-ordinate to Grid co-ordinate
final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget,
new Point2D(event.getX(),
event.getY()));
final double cx = ap.getX();
final double cy = ap.getY();
//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 (!hasEditableHeader(column)) {
return false;
}
//Get row index
final Integer uiHeaderRowIndex = EditableHeaderUtilities.getUiHeaderRowIndex(gridWidget,
column,
cy);
if (!isEditableHeader(column,
uiHeaderRowIndex)) {
return false;
}
//Get rendering information
final EditableHeaderMetaData headerMetaData = (EditableHeaderMetaData) column.getHeaderMetaData().get(uiHeaderRowIndex);
final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget,
ri,
ci,
uiHeaderRowIndex);
headerMetaData.edit(context);
return true;
}
示例13: edit
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
private boolean edit(final int uiRowIndex,
final BaseGridRendererHelper.ColumnInformation ci) {
final GridColumn<?> column = ci.getColumn();
final int uiColumnIndex = ci.getUiColumnIndex();
final double offsetX = ci.getOffsetX();
//Get rendering information
final GridRenderer renderer = gridWidget.getRenderer();
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();
if (renderingInformation == null) {
return false;
}
final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();
final double floatingX = floatingBlockInformation.getX();
final double floatingWidth = floatingBlockInformation.getWidth();
//Construct context of MouseEvent
final double cellX = gridWidget.getAbsoluteX() + offsetX;
final double cellY = gridWidget.getAbsoluteY() + renderer.getHeaderHeight() + getRowOffset(uiRowIndex,
uiColumnIndex,
rendererHelper);
final double cellHeight = getCellHeight(uiRowIndex,
uiColumnIndex);
final Group header = gridWidget.getHeader();
final double clipMinY = gridWidget.getAbsoluteY() + header.getY() + renderer.getHeaderHeight();
final double clipMinX = gridWidget.getAbsoluteX() + floatingX + floatingWidth;
final GridBodyCellRenderContext context = new GridBodyCellRenderContext(cellX,
cellY,
column.getWidth(),
cellHeight,
clipMinY,
clipMinX,
uiRowIndex,
uiColumnIndex,
floatingBlockInformation.getColumns().contains(column),
gridWidget.getViewport().getTransform(),
renderer);
doEdit(context);
return true;
}
示例14: selectSingleCell
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void selectSingleCell() {
when(gridWidget.isVisible()).thenReturn(true);
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(200);
when(uiModel.getCell(any(Integer.class),
any(Integer.class))).thenReturn(uiCell);
final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,
0,
0);
when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);
final BaseGridRendererHelper.RenderingInformation ri = new BaseGridRendererHelper.RenderingInformation(mock(Bounds.class),
new ArrayList<GridColumn<?>>() {{
add(uiColumn);
}},
mock(BaseGridRendererHelper.RenderingBlockInformation.class),
mock(BaseGridRendererHelper.RenderingBlockInformation.class),
0,
1,
new ArrayList<Double>() {{
add(64.0);
}},
false,
false,
0,
2,
0);
when(helper.getRenderingInformation()).thenReturn(ri);
handler.onNodeMouseClick(event);
verify(handler,
times(1)).handleBodyCellClick(any(NodeMouseClickEvent.class));
verify(gridWidget,
times(1)).selectCell(any(Point2D.class),
eq(false),
eq(false));
}
示例15: makeRenderContext
import org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper; //导入方法依赖的package包/类
public static GridBodyCellRenderContext makeRenderContext(final GridWidget gridWidget,
final BaseGridRendererHelper.RenderingInformation ri,
final BaseGridRendererHelper.ColumnInformation ci,
final int uiHeaderRowIndex) {
final GridColumn<?> column = ci.getColumn();
final GridRenderer renderer = gridWidget.getRenderer();
final Group header = gridWidget.getHeader();
final double headerRowsYOffset = ri.getHeaderRowsYOffset();
final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);
final double headerRowHeight = renderer.getHeaderRowHeight() / column.getHeaderMetaData().size();
final double cellX = gridWidget.getAbsoluteX() + ci.getOffsetX();
final double cellY = gridWidget.getAbsoluteY() + headerMinY + (headerRowHeight * uiHeaderRowIndex);
final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation();
final double floatingX = floatingBlockInformation.getX();
final double floatingWidth = floatingBlockInformation.getWidth();
final double clipMinX = gridWidget.getAbsoluteX() + floatingX + floatingWidth;
final double clipMinY = gridWidget.getAbsoluteY();
//Check and adjust for blocks of columns sharing equal HeaderMetaData
double blockCellX = cellX;
double blockCellWidth = column.getWidth();
final List<GridColumn<?>> gridColumns = ri.getAllColumns();
final GridColumn.HeaderMetaData clicked = column.getHeaderMetaData().get(uiHeaderRowIndex);
//Walk backwards to block start
if (ci.getUiColumnIndex() > 0) {
int uiLeadColumnIndex = ci.getUiColumnIndex() - 1;
GridColumn<?> lead = gridColumns.get(uiLeadColumnIndex);
while (uiLeadColumnIndex >= 0 && isSameHeaderMetaData(clicked,
lead.getHeaderMetaData(),
uiHeaderRowIndex)) {
blockCellX = blockCellX - lead.getWidth();
blockCellWidth = blockCellWidth + lead.getWidth();
if (--uiLeadColumnIndex >= 0) {
lead = gridColumns.get(uiLeadColumnIndex);
}
}
}
//Walk forwards to block end
if (ci.getUiColumnIndex() < gridColumns.size() - 1) {
int uiTailColumnIndex = ci.getUiColumnIndex() + 1;
GridColumn<?> tail = gridColumns.get(uiTailColumnIndex);
while (uiTailColumnIndex < gridColumns.size() && isSameHeaderMetaData(clicked,
tail.getHeaderMetaData(),
uiHeaderRowIndex)) {
blockCellWidth = blockCellWidth + tail.getWidth();
tail = gridColumns.get(uiTailColumnIndex);
if (++uiTailColumnIndex < gridColumns.size()) {
tail = gridColumns.get(uiTailColumnIndex);
}
}
}
return new GridBodyCellRenderContext(blockCellX,
cellY,
blockCellWidth,
headerRowHeight,
clipMinY,
clipMinX,
uiHeaderRowIndex,
ci.getUiColumnIndex(),
floatingBlockInformation.getColumns().contains(column),
gridWidget.getViewport().getTransform(),
renderer);
}