本文整理汇总了Java中org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget类的典型用法代码示例。如果您正苦于以下问题:Java GridWidget类的具体用法?Java GridWidget怎么用?Java GridWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GridWidget类属于org.uberfire.ext.wires.core.grids.client.widget.grid包,在下文中一共展示了GridWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOnClose
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Test
public void testOnClose() {
doReturn(layer).when(gridWidget).getLayer();
doReturn(gridWidget).when(state).getGridWidget();
final Set<GridWidget> gridWidgets = new HashSet<>();
final Set<IPrimitive<?>> gridWidgetConnectors = new HashSet<>();
final List<Command> onExitPinnedModeCommands = new ArrayList<Command>() {{
add(command);
}};
final GridWidgetExitPinnedModeAnimation animation = new GridWidgetExitPinnedModeAnimation(state,
gridWidgets,
gridWidgetConnectors,
onCompleteCommand,
onExitPinnedModeCommands);
animation.doClose();
verify(layer).setListening(true);
verify(layer).batch();
verify(onCompleteCommand).execute();
verify(command).execute();
}
示例2: makeGridWidget
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
private GridWidget makeGridWidget(final Double x,
final Double y,
final Double width,
final Double height,
final boolean visible) {
final GridWidget mock = mock(GridWidget.class);
when(mock.getX()).thenReturn(x);
when(mock.getY()).thenReturn(y);
when(mock.getWidth()).thenReturn(width);
when(mock.getHeight()).thenReturn(height);
when(mock.isVisible()).thenReturn(visible);
return mock;
}
示例3: findGridColumnWithEmptyLayer
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Test
public void findGridColumnWithEmptyLayer() {
when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);
handler.onNodeMouseMove(event);
verify(handler,
times(1)).findGridColumn(eq(event));
verify(handler,
never()).findMovableColumns(any(GridWidget.class),
any(Double.class),
any(Double.class),
any(Double.class),
any(Double.class));
verify(handler,
never()).findMovableRows(any(GridWidget.class),
any(Double.class),
any(Double.class));
verify(handler,
never()).findResizableColumn(any(GridWidget.class),
any(Double.class));
}
示例4: checkScrollToGridWidgetWhenPinned
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Test
public void checkScrollToGridWidgetWhenPinned() {
final GridWidget gridWidget = makeGridWidget();
this.gridLayer.add(gridWidget);
gridLayer.enterPinnedMode(gridWidget,
new GridLayerRedrawManager.PrioritizedCommand(0) {
@Override
public void execute() {
//Do nothing
}
});
gridLayer.scrollToGridWidget(gridWidget);
verify(gridLayer,
never()).select(eq(gridWidget));
}
示例5: getUiColumnIndex
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的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;
}
示例6: onKeyDown
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Override
public void onKeyDown(final KeyDownEvent event) {
final GridWidget selectedGridWidget = getSelectedGridWidget();
if (selectedGridWidget == null) {
return;
}
final KeyboardOperation operation = getOperation(event);
if (operation == null) {
return;
}
final boolean redraw = operation.perform(selectedGridWidget,
event.isShiftKeyDown(),
event.isControlKeyDown());
event.preventDefault();
event.stopPropagation();
flushDOMElements(selectedGridWidget);
if (redraw) {
gridLayer.draw();
}
}
示例7: doFindMovableGridWhenOverDragHandle
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
private void doFindMovableGridWhenOverDragHandle(final boolean isPinned,
final Command assertion) {
state.setOperation(GridWidgetHandlersOperation.NONE);
when(gridWidget.isVisible()).thenReturn(true);
when(gridWidget.onDragHandle(any(INodeXYEvent.class))).thenReturn(true);
when(layer.isGridPinned()).thenReturn(isPinned);
when(layer.getGridWidgets()).thenReturn(new HashSet<GridWidget>() {{
add(gridWidget);
}});
//This location is top-left of the GridWidget; not within a column move/resize or row move hot-spot
when(event.getX()).thenReturn(100);
when(event.getY()).thenReturn(100);
handler.onNodeMouseMove(event);
verify(handler,
times(1)).findGridColumn(eq(event));
assertion.execute();
}
示例8: scrollSelectedCellIntoView
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
protected boolean scrollSelectedCellIntoView(final GridWidget gridWidget) {
if (!isSelectionOriginSet(gridWidget)) {
return false;
}
if (!(isGridWidgetRendered(gridWidget) || isGridColumnCandidateForScroll(gridWidget))) {
return false;
}
final double dx = getCellScrollDeltaX(gridWidget);
final double dy = getCellScrollDeltaY(gridWidget);
if (dx != 0 || dy != 0) {
adjustViewportTransform(gridLayer.getViewport(),
new Point2D(dx,
dy));
}
return true;
}
示例9: isGridColumnCandidateForScroll
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
private boolean isGridColumnCandidateForScroll(final GridWidget gridWidget) {
final GridData gridModel = gridWidget.getModel();
final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();
if (renderingInformation == null) {
return false;
}
final List<GridColumn<?>> columns = gridModel.getColumns();
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(columns,
origin.getColumnIndex());
final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();
final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();
final GridColumn<?> column = columns.get(uiColumnIndex);
return !floatingColumns.contains(column);
}
示例10: getCellScrollDeltaX
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
private double getCellScrollDeltaX(final GridWidget gridWidget) {
final GridData gridModel = gridWidget.getModel();
final List<GridColumn<?>> columns = gridModel.getColumns();
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(columns,
origin.getColumnIndex());
double dx = 0;
final Bounds bounds = gridLayer.getVisibleBounds();
final double columnWidth = columns.get(uiColumnIndex).getWidth();
final double gridCellX = gridWidget.getX() + gridWidget.getRendererHelper().getColumnOffset(uiColumnIndex);
if (gridCellX + columnWidth >= bounds.getX() + bounds.getWidth()) {
dx = bounds.getX() + bounds.getWidth() - gridCellX - columnWidth;
} else if (gridCellX <= bounds.getX()) {
dx = bounds.getX() - gridCellX;
}
return dx;
}
示例11: getCellScrollDeltaY
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
private double getCellScrollDeltaY(final GridWidget gridWidget) {
final GridData gridModel = gridWidget.getModel();
final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();
final int uiRowIndex = origin.getRowIndex();
double dy = 0;
final Bounds bounds = gridLayer.getVisibleBounds();
final double rowHeight = gridModel.getRow(uiRowIndex).getHeight();
final double headerHeight = gridWidget.getRenderer().getHeaderHeight();
final double gridCellY = gridWidget.getY() + headerHeight + gridWidget.getRendererHelper().getRowOffset(uiRowIndex);
if (gridCellY + rowHeight >= bounds.getY() + bounds.getHeight()) {
dy = bounds.getY() + bounds.getHeight() - gridCellY - rowHeight;
} else if (gridCellY <= bounds.getY() + headerHeight) {
dy = bounds.getY() + headerHeight - gridCellY;
}
return dy;
}
示例12: checkFlipToGridWidgetWhenPinned
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Test
public void checkFlipToGridWidgetWhenPinned() {
final GridWidget gridWidget = makeGridWidget();
this.gridLayer.add(gridWidget);
gridLayer.enterPinnedMode(gridWidget,
new GridLayerRedrawManager.PrioritizedCommand(0) {
@Override
public void execute() {
}
});
gridLayer.flipToGridWidget(gridWidget);
verify(gridLayer,
times(1)).updatePinnedContext(eq(gridWidget));
verify(gridLayer,
times(1)).batch(any(GridLayerRedrawManager.PrioritizedCommand.class));
}
示例13: showRowHighlight
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
protected void showRowHighlight(final GridWidget view,
final List<GridRow> activeGridRows) {
final BaseGridRendererHelper rendererHelper = view.getRendererHelper();
final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();
if (renderingInformation == null) {
return;
}
final Bounds bounds = renderingInformation.getBounds();
final GridRow row = activeGridRows.get(0);
final double rowOffsetY = rendererHelper.getRowOffset(row) + view.getRenderer().getHeaderHeight();
final double highlightWidth = Math.min(bounds.getX() + bounds.getWidth() - view.getAbsoluteX(),
view.getWidth());
final double highlightHeight = row.getHeight();
state.getEventColumnHighlight().setWidth(highlightWidth)
.setHeight(highlightHeight)
.setX(view.getAbsoluteX())
.setY(view.getAbsoluteY() + rowOffsetY);
layer.add(state.getEventColumnHighlight());
layer.getLayer().batch();
}
示例14: createDomElement
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Override
public TextBoxDOMElement createDomElement(final GridLayer gridLayer,
final GridWidget gridWidget,
final GridBodyCellRenderContext context) {
this.widget = createWidget();
this.e = new TextBoxDOMElement(widget,
gridLayer,
gridWidget);
widget.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
destroyResources();
gridLayer.batch();
gridPanel.setFocus(true);
}
});
return e;
}
示例15: createDomElement
import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入依赖的package包/类
@Override
public TextBoxDOMElement createDomElement(final GridLayer gridLayer,
final GridWidget gridWidget,
final GridBodyCellRenderContext context) {
final TextBox widget = createWidget();
final TextBoxDOMElement e = new TextBoxDOMElement(widget,
gridLayer,
gridWidget);
widget.addBlurHandler(new BlurHandler() {
@Override
public void onBlur(final BlurEvent event) {
e.flush(widget.getValue());
gridLayer.batch();
}
});
return e;
}