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


Java RowSelectionStrategy类代码示例

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


RowSelectionStrategy类属于org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl包,在下文中一共展示了RowSelectionStrategy类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populate

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
/**
 * Populate a non-merged grid. Columns should already have been appended.
 * @param grid The grid to populate
 * @param rowCount The number of required rows
 */
public static void populate(final GridData grid,
                            final int rowCount) {
    final int columnCount = grid.getColumnCount();
    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        final GridRow row = new BaseGridRow(getRowHeight());
        grid.appendRow(row);
        for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) {
            final GridColumn<?> column = grid.getColumns().get(columnIndex);
            if (column instanceof RowNumberColumn) {
                grid.setCell(rowIndex,
                             columnIndex,
                             new BaseGridCellValue<Integer>(rowIndex + 1));
                grid.getCell(rowIndex,
                             columnIndex).setSelectionManager(RowSelectionStrategy.INSTANCE);
            } else if (Math.random() < FILL_FACTOR) {
                grid.setCell(rowIndex,
                             columnIndex,
                             new BaseGridCellValue<String>("(" + columnIndex + ", " + rowIndex + ")"));
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:28,代码来源:GridDataFactory.java

示例2: initialiseRowData

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
private void initialiseRowData(final int rowIndex) {
    final List<BaseColumn> modelColumns = model.getExpandedColumns();
    final List<DTCellValue52> modelRow = model.getData().get(rowIndex);
    for (int columnIndex = 0; columnIndex < modelColumns.size(); columnIndex++) {
        final BaseColumn modelColumn = modelColumns.get(columnIndex);
        final DTCellValue52 modelCell = makeModelCellValue(modelColumn);
        modelRow.add(modelCell);

        //BaseGridData is sparsely populated; only add values if needed.
        if (modelCell.hasValue()) {
            uiModel.setCellInternal(rowIndex,
                                    columnIndex,
                                    gridWidgetCellFactory.convertCell(modelCell,
                                                                      modelColumn,
                                                                      cellUtilities,
                                                                      columnUtilities));
        }
        uiModel.indexColumn(columnIndex);

        //Set-up SelectionManager for Row Number column, to select entire row.
        if (modelColumn instanceof RowNumberCol52) {
            uiModel.getCell(rowIndex,
                            columnIndex).setSelectionManager(RowSelectionStrategy.INSTANCE);
        }
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:27,代码来源:RowSynchronizer.java

示例3: initialiseRow

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
private void initialiseRow(final List<BaseColumn> columns,
                           final List<DTCellValue52> row) {
    final GridRow uiModelRow = new BaseGridRow(GuidedDecisionTableView.ROW_HEIGHT);
    final int rowIndex = uiModel.getRowCount();
    uiModel.appendRow(uiModelRow);

    for (int iModelColumn = 0; iModelColumn < row.size(); iModelColumn++) {
        final DTCellValue52 modelCell = row.get(iModelColumn);
        final BaseColumn modelColumn = columns.get(iModelColumn);

        // We cannot rely upon the values in the existing data as legacy tables aren't guaranteed to be sorted
        if (modelColumn instanceof RowNumberCol52) {
            modelCell.setNumericValue(uiModel.getRowCount());
        }

        //BaseGridData is sparsely populated; only add values if needed.
        if (modelCell.hasValue()) {
            uiModel.setCellInternal(rowIndex,
                                    iModelColumn,
                                    gridWidgetCellFactory.convertCell(modelCell,
                                                                      modelColumn,
                                                                      cellUtilities,
                                                                      columnUtilities));

            //Set-up SelectionManager for Row Number column, to select entire row.
            if (modelColumn instanceof RowNumberCol52) {
                uiModel.getCell(rowIndex,
                                iModelColumn).setSelectionManager(RowSelectionStrategy.INSTANCE);
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:drools-wb,代码行数:33,代码来源:GuidedDecisionTablePresenter.java

示例4: fromDMNModel

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Override
public void fromDMNModel(final int rowIndex,
                         final int columnIndex) {
    dmnModel.get().ifPresent(relation -> {
        final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, columnIndex);
        switch (section) {
            case ROW_INDEX:
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(rowIndex + 1));
                uiModel.get().getCell(rowIndex,
                                      columnIndex).setSelectionManager(RowSelectionStrategy.INSTANCE);
                break;
            case INFORMATION_ITEM:
                final org.kie.workbench.common.dmn.api.definition.v1_1.List row = relation.getRow().get(rowIndex);
                final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, columnIndex);
                final Expression e = row.getExpression().get(iiIndex);
                final Optional<Expression> expression = Optional.ofNullable(e);

                expression.ifPresent(ex -> {
                    // Whilst the DMN 1.1 specification allows for ANY expression to be used we have made the simplification
                    // to limit ourselves to LiteralExpressions. Our Grid-system supports ANY (nested) expression too; however
                    // the simplification has been made for the benefit of USERS.
                    final LiteralExpression le = (LiteralExpression) ex;
                    uiModel.get().setCell(rowIndex,
                                          columnIndex,
                                          new BaseGridCellValue<>(le.getText()));
                });
        }
    });
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:32,代码来源:RelationUIModelMapper.java

示例5: fromDMNModel

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Override
public void fromDMNModel(final int rowIndex,
                         final int columnIndex) {
    dmnModel.get().ifPresent(dtable -> {
        final DecisionRule rule = dtable.getRule().get(rowIndex);
        final DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, columnIndex);
        switch (section) {
            case ROW_INDEX:
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(rowIndex + 1));
                uiModel.get().getCell(rowIndex,
                                      columnIndex).setSelectionManager(RowSelectionStrategy.INSTANCE);
                break;
            case INPUT_CLAUSES:
                final int iei = DecisionTableUIModelMapperHelper.getInputEntryIndex(dtable, columnIndex);
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(rule.getInputEntry().get(iei).getText()));
                break;
            case OUTPUT_CLAUSES:
                final int oei = DecisionTableUIModelMapperHelper.getOutputEntryIndex(dtable, columnIndex);
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(rule.getOutputEntry().get(oei).getText()));
                break;
            case DESCRIPTION:
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(rule.getDescription().getValue()));
                break;
        }
    });
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:35,代码来源:DecisionTableUIModelMapper.java

示例6: fromDMNModel

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Override
public void fromDMNModel(final int rowIndex,
                         final int columnIndex) {
    dmnModel.get().ifPresent(invocation -> {
        switch (columnIndex) {
            case ROW_NUMBER_COLUMN_INDEX:
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(rowIndex + 1));
                uiModel.get().getCell(rowIndex,
                                      columnIndex).setSelectionManager(RowSelectionStrategy.INSTANCE);
                break;
            case BINDING_PARAMETER_COLUMN_INDEX:
                final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter();
                final String name = variable.getName().getValue();
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(name));
                break;
            case BINDING_EXPRESSION_COLUMN_INDEX:
                final Binding binding = invocation.getBinding().get(rowIndex);
                final Optional<Expression> expression = Optional.ofNullable(binding.getExpression());

                final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression);
                expressionEditorDefinition.ifPresent(ed -> {
                    final Optional<BaseExpressionGrid> editor = ed.getEditor(new GridCellTuple(rowIndex,
                                                                                               columnIndex,
                                                                                               uiModel.get()),
                                                                             binding,
                                                                             expression,
                                                                             Optional.ofNullable(binding.getParameter()),
                                                                             true);
                    uiModel.get().setCell(rowIndex,
                                          columnIndex,
                                          new ExpressionCellValue(editor));
                });
        }
    });
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:40,代码来源:InvocationUIModelMapper.java

示例7: fromDMNModel

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Override
public void fromDMNModel(final int rowIndex,
                         final int columnIndex) {
    dmnModel.get().ifPresent(context -> {
        final ContextUIModelMapperHelper.ContextSection section = ContextUIModelMapperHelper.getSection(columnIndex);
        switch (section) {
            case ROW_INDEX:
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      isLastRow(rowIndex) ? new BaseGridCellValue<>((Integer) null) : new BaseGridCellValue<>(rowIndex + 1));
                uiModel.get().getCell(rowIndex,
                                      columnIndex).setSelectionManager(RowSelectionStrategy.INSTANCE);
                break;
            case NAME:
                final InformationItem variable = context.getContextEntry().get(rowIndex).getVariable();
                final String name = variable == null ? DEFAULT_ROW_CAPTION : variable.getName().getValue();
                uiModel.get().setCell(rowIndex,
                                      columnIndex,
                                      new BaseGridCellValue<>(name));
                break;
            case EXPRESSION:
                final ContextEntry ce = context.getContextEntry().get(rowIndex);
                final Optional<Expression> expression = Optional.ofNullable(ce.getExpression());

                final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression);
                expressionEditorDefinition.ifPresent(ed -> {
                    final Optional<BaseExpressionGrid> editor = ed.getEditor(new GridCellTuple(rowIndex,
                                                                                               columnIndex,
                                                                                               uiModel.get()),
                                                                             ce,
                                                                             expression,
                                                                             Optional.ofNullable(ce.getVariable()),
                                                                             true);
                    uiModel.get().setCell(rowIndex,
                                          columnIndex,
                                          new ExpressionCellValue(editor));
                });
        }
    });
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:41,代码来源:ContextUIModelMapper.java

示例8: testFromDMNModelRowNumber

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Test
public void testFromDMNModelRowNumber() {
    mapper.fromDMNModel(0, 0);
    mapper.fromDMNModel(1, 0);

    assertEquals(1,
                 uiModel.getCell(0, 0).getValue().getValue());
    assertEquals(RowSelectionStrategy.INSTANCE,
                 uiModel.getCell(0, 0).getSelectionManager());

    assertEquals(2,
                 uiModel.getCell(1, 0).getValue().getValue());
    assertEquals(RowSelectionStrategy.INSTANCE,
                 uiModel.getCell(1, 0).getSelectionManager());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:16,代码来源:RelationUIModelMapperTest.java

示例9: testFromDMNModelRowNumber

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Test
public void testFromDMNModelRowNumber() {
    mapper.fromDMNModel(0, 0);

    assertEquals(1,
                 uiModel.getCell(0, 0).getValue().getValue());
    assertEquals(RowSelectionStrategy.INSTANCE,
                 uiModel.getCell(0, 0).getSelectionManager());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:10,代码来源:InvocationUIModelMapperTest.java

示例10: testFromDMNModelRowNumber

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Test
public void testFromDMNModelRowNumber() {
    mapper.fromDMNModel(0, 0);
    mapper.fromDMNModel(1, 0);

    assertEquals(1,
                 uiModel.getCell(0, 0).getValue().getValue());
    assertEquals(RowSelectionStrategy.INSTANCE,
                 uiModel.getCell(0, 0).getSelectionManager());

    assertNull(uiModel.getCell(1, 0).getValue().getValue());
    assertEquals(RowSelectionStrategy.INSTANCE,
                 uiModel.getCell(1, 0).getSelectionManager());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:15,代码来源:ContextUIModelMapperTest.java

示例11: testInitialSetupFromDefinition

import org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy; //导入依赖的package包/类
@Test
public void testInitialSetupFromDefinition() {
    final GridData uiModel = grid.getModel();
    assertTrue(uiModel instanceof ContextGridData);

    assertEquals(3,
                 uiModel.getColumnCount());
    assertTrue(uiModel.getColumns().get(0) instanceof RowNumberColumn);
    assertTrue(uiModel.getColumns().get(1) instanceof NameColumn);
    assertTrue(uiModel.getColumns().get(2) instanceof ExpressionEditorColumn);

    assertEquals(2,
                 uiModel.getRowCount());

    assertEquals(1,
                 uiModel.getCell(0, 0).getValue().getValue());
    assertEquals(Name.DEFAULT_NAME,
                 uiModel.getCell(0, 1).getValue().getValue());
    assertNull(uiModel.getCell(0, 2));

    assertNotNull(uiModel.getCell(1, 0));
    assertNull(uiModel.getCell(1, 0).getValue().getValue());
    assertEquals(RowSelectionStrategy.INSTANCE,
                 uiModel.getCell(1, 0).getSelectionManager());
    assertEquals(ContextUIModelMapper.DEFAULT_ROW_CAPTION,
                 uiModel.getCell(1, 1).getValue().getValue());
    assertTrue(uiModel.getCell(1, 2).getValue() instanceof ExpressionCellValue);
    final ExpressionCellValue dcv = (ExpressionCellValue) uiModel.getCell(1, 2).getValue();
    assertEquals(literalExpressionEditor,
                 dcv.getValue().get());
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:32,代码来源:ContextGridTest.java


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