當前位置: 首頁>>代碼示例>>Java>>正文


Java GridWidget.getHeader方法代碼示例

本文整理匯總了Java中org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget.getHeader方法的典型用法代碼示例。如果您正苦於以下問題:Java GridWidget.getHeader方法的具體用法?Java GridWidget.getHeader怎麽用?Java GridWidget.getHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget的用法示例。


在下文中一共展示了GridWidget.getHeader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: showColumnHighlight

import org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected void showColumnHighlight(final GridWidget view,
                                   final List<GridColumn<?>> activeGridColumns) {
    final BaseGridRendererHelper rendererHelper = view.getRendererHelper();
    final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();
    if (renderingInformation == null) {
        return;
    }

    final Group header = view.getHeader();
    final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();
    final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);

    final Bounds bounds = renderingInformation.getBounds();
    final double activeColumnX = rendererHelper.getColumnOffset(activeGridColumns.get(0));
    final double highlightWidth = getHighlightWidth(activeGridColumns);
    final double highlightHeight = getHighlightHeight(bounds,
                                                      view,
                                                      headerMinY);

    state.getEventColumnHighlight().setWidth(highlightWidth)
            .setHeight(highlightHeight)
            .setX(view.getAbsoluteX() + activeColumnX)
            .setY(view.getAbsoluteY() + headerMinY);
    layer.add(state.getEventColumnHighlight());
    layer.getLayer().batch();
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:28,代碼來源:GridWidgetDnDMouseDownHandler.java

示例3: 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


注:本文中的org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget.getHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。