当前位置: 首页>>代码示例>>Java>>正文


Java GridWidget.getHeight方法代码示例

本文整理汇总了Java中org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java GridWidget.getHeight方法的具体用法?Java GridWidget.getHeight怎么用?Java GridWidget.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget的用法示例。


在下文中一共展示了GridWidget.getHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateGridWidgetConnectors

import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入方法依赖的package包/类
private void updateGridWidgetConnectors() {
    for (Map.Entry<GridWidgetConnector, Line> e : gridWidgetConnectors.entrySet()) {
        final GridWidgetConnector connector = e.getKey();
        final Line line = e.getValue();
        final GridColumn<?> sourceGridColumn = connector.getSourceColumn();
        final GridColumn<?> targetGridColumn = connector.getTargetColumn();
        final GridWidget sourceGridWidget = getLinkedGridWidget(sourceGridColumn);
        final GridWidget targetGridWidget = getLinkedGridWidget(targetGridColumn);

        final Point2D sp = new Point2D(sourceGridWidget.getX() + sourceGridWidget.getWidth() / 2,
                                       sourceGridWidget.getY() + sourceGridWidget.getHeight() / 2);
        final Point2D ep = new Point2D(targetGridWidget.getX() + targetGridWidget.getWidth() / 2,
                                       targetGridWidget.getY() + targetGridWidget.getHeight() / 2);

        line.setPoints(new Point2DArray(sp,
                                        ep));
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:DefaultGridLayer.java

示例2: getUiRowIndex

import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入方法依赖的package包/类
/**
 * Gets the row index corresponding to the provided Canvas y-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 cy y-coordinate relative to the GridWidget.
 * @return The row index or null if the coordinate did not map to a cell.
 */
public static Integer getUiRowIndex(final GridWidget gridWidget,
                                    final double cy) {
    final Group header = gridWidget.getHeader();
    final GridData gridModel = gridWidget.getModel();
    final GridRenderer renderer = gridWidget.getRenderer();
    final double headerMaxY = (header == null ? renderer.getHeaderHeight() : renderer.getHeaderHeight() + header.getY());

    if (cy < headerMaxY || cy > gridWidget.getHeight()) {
        return null;
    }
    if (gridModel.getRowCount() == 0) {
        return null;
    }

    //Get row index
    GridRow row;
    int uiRowIndex = 0;
    double offsetY = cy - renderer.getHeaderHeight();
    while ((row = gridModel.getRow(uiRowIndex)).getHeight() < offsetY) {
        offsetY = offsetY - row.getHeight();
        uiRowIndex++;
    }
    if (uiRowIndex > gridModel.getRowCount() - 1) {
        return null;
    }

    return uiRowIndex;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:36,代码来源:CoordinateUtilities.java

示例3: addGridWidgetConnectors

import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入方法依赖的package包/类
private void addGridWidgetConnectors() {
    for (GridWidget gridWidget : gridWidgets) {
        final GridData gridModel = gridWidget.getModel();
        for (GridColumn<?> gridColumn : gridModel.getColumns()) {
            if (gridColumn.isVisible()) {
                if (gridColumn.isLinked()) {
                    final GridWidget linkedGridWidget = getLinkedGridWidget(gridColumn.getLink());
                    if (linkedGridWidget != null) {
                        final Point2D sp = new Point2D(gridWidget.getX() + gridWidget.getWidth() / 2,
                                                       gridWidget.getY() + gridWidget.getHeight() / 2);
                        final Point2D ep = new Point2D(linkedGridWidget.getX() + linkedGridWidget.getWidth() / 2,
                                                       linkedGridWidget.getY() + linkedGridWidget.getHeight() / 2);

                        final GridWidgetConnector connector = new GridWidgetConnector(gridColumn,
                                                                                      gridColumn.getLink());

                        if (!gridWidgetConnectors.containsKey(connector)) {
                            final Line line = new Line(sp,
                                                       ep)
                                    .setVisible(!isGridPinned())
                                    .setStrokeColor(ColorName.DARKGRAY)
                                    .setFillColor(ColorName.TAN)
                                    .setStrokeWidth(2.0);
                            gridWidgetConnectors.put(connector,
                                                     line);
                            super.add(line);
                            line.moveToBottom();
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:35,代码来源:DefaultGridLayer.java

示例4: findGridColumn

import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入方法依赖的package包/类
protected void findGridColumn(final NodeMouseMoveEvent event) {
    state.reset();
    setCursor(state.getCursor());

    for (GridWidget gridWidget : layer.getGridWidgets()) {

        gridWidget.setDraggable(false);

        if (!gridWidget.isVisible()) {
            continue;
        }
        if (!gridWidget.getModel().isColumnDraggingEnabled()) {
            continue;
        }

        final Group header = gridWidget.getHeader();
        final GridRenderer renderer = gridWidget.getRenderer();

        final double headerHeight = renderer.getHeaderHeight();
        final double headerRowsYOffset = getHeaderRowsYOffset(gridWidget,
                                                              renderer);
        final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);
        final double headerMaxY = (header == null ? headerHeight : headerHeight + header.getY());

        final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget,
                                                                          new Point2D(event.getX(),
                                                                                      event.getY()));

        final double cx = ap.getX();
        final double cy = ap.getY();

        //If over Grid's drag handle prime for dragging
        if (!layer.isGridPinned()) {
            if (gridWidget.onDragHandle(event)) {
                state.setActiveGridWidget(gridWidget);
                state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.GRID_MOVE_PENDING);
                continue;
            }
        }

        //Check bounds
        if (cx < 0 || cx > gridWidget.getWidth()) {
            continue;
        }
        if (cy < headerMinY || cy > gridWidget.getHeight()) {
            continue;
        }

        if (cy < headerMaxY) {
            //Check for column moving
            findMovableColumns(gridWidget,
                               headerHeight - headerRowsYOffset,
                               headerMinY,
                               cx,
                               cy);
        } else {
            //Check for movable rows
            findMovableRows(gridWidget,
                            cx,
                            cy);

            //Check for column resizing
            findResizableColumn(gridWidget,
                                cx);
        }

        //If over Grid but no operation has been identified default to Grid dragging; when unpinned
        if (!layer.isGridPinned()) {
            if (state.getActiveGridWidget() == null) {
                state.setActiveGridWidget(gridWidget);
                state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.GRID_MOVE_PENDING);
            }
        }
    }

    for (IMediator mediator : layer.getViewport().getMediators()) {
        mediator.setEnabled(state.getActiveGridWidget() == null);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:80,代码来源:GridWidgetDnDMouseMoveHandler.java

示例5: handleRowMove

import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //导入方法依赖的package包/类
protected void handleRowMove(final NodeMouseMoveEvent event) {
    final GridWidget activeGridWidget = state.getActiveGridWidget();
    final List<GridRow> activeGridRows = state.getActiveGridRows();

    final GridData activeGridModel = activeGridWidget.getModel();
    final List<GridColumn<?>> allGridColumns = activeGridModel.getColumns();

    final BaseGridRendererHelper rendererHelper = activeGridWidget.getRendererHelper();
    final GridRenderer renderer = activeGridWidget.getRenderer();
    final double headerHeight = renderer.getHeaderHeight();

    final GridRow leadRow = activeGridRows.get(0);
    final int leadRowIndex = activeGridModel.getRows().indexOf(leadRow);

    final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(activeGridWidget,
                                                                      new Point2D(event.getX(),
                                                                                  event.getY()));
    final double cy = ap.getY();
    if (cy < headerHeight || cy > activeGridWidget.getHeight()) {
        return;
    }

    //Find new row index
    GridRow row;
    int uiRowIndex = 0;
    double offsetY = cy - headerHeight;
    while ((row = activeGridModel.getRow(uiRowIndex)).getHeight() < offsetY) {
        offsetY = offsetY - row.getHeight();
        uiRowIndex++;
    }
    if (uiRowIndex < 0 || uiRowIndex > activeGridModel.getRowCount() - 1) {
        return;
    }

    if (uiRowIndex == leadRowIndex) {
        //Don't move if the new rowIndex equals the index of the row(s) being moved
        return;
    } else if (uiRowIndex < activeGridModel.getRows().indexOf(leadRow)) {
        //Don't move up if the pointer is in the bottom half of the target row.
        if (offsetY > activeGridModel.getRow(uiRowIndex).getHeight() / 2) {
            return;
        }
    } else if (uiRowIndex > activeGridModel.getRows().indexOf(leadRow)) {
        //Don't move down if the pointer is in the top half of the target row.
        if (offsetY < activeGridModel.getRow(uiRowIndex).getHeight() / 2) {
            return;
        }
    }

    //Move row(s) and update highlight
    destroyColumns(allGridColumns);
    activeGridModel.moveRowsTo(uiRowIndex,
                               activeGridRows);

    final double rowOffsetY = rendererHelper.getRowOffset(leadRow) + headerHeight;
    state.getEventColumnHighlight().setY(activeGridWidget.getAbsoluteY() + rowOffsetY);
    layer.batch();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:59,代码来源:GridWidgetDnDMouseMoveHandler.java


注:本文中的org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。