GridData$SelectedCell
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.uberfire.ext.wires.core.grids.client.model.GridData$SelectedCell (Showing top 20 results out of 315)

origin: org.uberfire/uberfire-wires-core-grids

@Test
public void testAdjustSelectionDownInHeader() {
  col2.getHeaderMetaData().add(new BaseHeaderMetaData("col1", "second-row"));
  cellSelectionManager.selectHeaderCell(0,
                     1,
                     false,
                     false);
  cellSelectionManager.adjustSelection(SelectionExtension.DOWN, false);
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  Assertions.assertThat(selectedHeaderCells).hasSize(1);
  final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);
  Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);
  Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(1);
}
origin: kiegroup/appformer

@Test
public void testEditBodyCellWithMultipleSelectedCells() {
  when(uiModel.getSelectedCells()).thenReturn(Arrays.asList(new GridData.SelectedCell(0, 0),
                               new GridData.SelectedCell(0, 1)));
  assertThat(handler.onNodeMouseEvent(gridWidget,
                    relativeLocation,
                    Optional.empty(),
                    Optional.empty(),
                    Optional.of(0),
                    Optional.of(1),
                    event)).isFalse();
  verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());
  verify(gridWidget, never()).startEditingCell(any(Point2D.class));
}
origin: org.uberfire/uberfire-wires-core-grids

  protected void clearCells(final GridWidget gridWidget) {
    final GridData gridModel = gridWidget.getModel();
    final List<GridData.SelectedCell> selectedCells = gridModel.getSelectedCells();
    for (GridData.SelectedCell cell : selectedCells) {
      gridModel.deleteCell(cell.getRowIndex(),
                 cell.getColumnIndex());
    }
  }
}
origin: org.uberfire/uberfire-wires-core-grids

public void onMerge(final boolean isMerged) {
  if (isMerged) {
    final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
    final List<GridData.SelectedCell> cloneSelectedCells = new ArrayList<GridData.SelectedCell>(selectedCells);
    gridData.clearSelections();
    for (GridData.SelectedCell cell : cloneSelectedCells) {
      gridData.selectCells(cell.getRowIndex(),
                 ColumnIndexUtilities.findUiColumnIndex(gridData.getColumns(),
                                    cell.getColumnIndex()),
                 1,
                 1);
    }
  }
}
origin: org.uberfire/uberfire-wires-core-grids

public void onInsertColumn(final int index) {
  final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
  final List<Integer> rowsWithASelection = selectedCells.stream()
      .filter(sc -> {
        final int ri = sc.getRowIndex();
        final int ci = sc.getColumnIndex();
        final int _ci = ColumnIndexUtilities.findUiColumnIndex(gridData.getColumns(), ci);
        final GridCell<?> cell = gridData.getCell(ri, _ci);
        return cell != null && cell.getSelectionStrategy() instanceof RowSelectionStrategy;
      })
      .map(GridData.SelectedCell::getRowIndex)
      .collect(Collectors.toList());
  rowsWithASelection.forEach(rowIndex -> onSelectCell(rowIndex, index));
}
origin: kiegroup/drools-wb

  private EnableRightPanelEvent getEnableRightPanelEvent(final ScenarioGridColumn scenarioGridColumn,
                              final GridData.SelectedCell selectedHeaderCell,
                              final int uiColumnIndex) {
    final ScenarioHeaderMetaData scenarioHeaderMetaData =
        ScenarioSimulationGridHeaderUtilities.getColumnScenarioHeaderMetaData(scenarioGridColumn,
                                           selectedHeaderCell.getRowIndex());

    return ScenarioSimulationGridHeaderUtilities.getEnableRightPanelEvent(this,
                                       scenarioGridColumn,
                                       scenarioHeaderMetaData,
                                       uiColumnIndex,
                                       scenarioHeaderMetaData.getColumnGroup());
  }
}
origin: kiegroup/appformer

public void onInsertRow(final int rowIndex) {
  final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
  final List<GridData.SelectedCell> selectedCellsToUpdate = new ArrayList<GridData.SelectedCell>();
  for (GridData.SelectedCell sc : selectedCells) {
    if (sc.getRowIndex() >= rowIndex) {
      selectedCellsToUpdate.add(sc);
    }
  }
  selectedCells.removeAll(selectedCellsToUpdate);
  for (GridData.SelectedCell sc : selectedCellsToUpdate) {
    selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() + 1,
                          sc.getColumnIndex()));
  }
}
origin: org.uberfire/uberfire-wires-core-grids

@Test
public void testAdjustSelectionUpFromDataToHeader() {
  cellSelectionManager.selectCell(0,
                  1,
                  false,
                  false);
  cellSelectionManager.adjustSelection(SelectionExtension.UP, false);
  final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();
  Assertions.assertThat(selectedCells).isEmpty();
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  Assertions.assertThat(selectedHeaderCells).hasSize(1);
  final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);
  Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);
  Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(0);
}
origin: org.uberfire/uberfire-wires-core-grids

@Test
public void testAdjustSelectionDownFromHeaderToData() {
  cellSelectionManager.selectHeaderCell(0,
                     1,
                     false,
                     false);
  cellSelectionManager.adjustSelection(SelectionExtension.DOWN, false);
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  Assertions.assertThat(selectedHeaderCells).isEmpty();
  final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();
  Assertions.assertThat(selectedCells).hasSize(1);
  final GridData.SelectedCell selectedCell = selectedCells.get(0);
  Assertions.assertThat(selectedCell.getColumnIndex()).isEqualTo(1);
  Assertions.assertThat(selectedCell.getRowIndex()).isEqualTo(0);
}
origin: org.drools/drools-wb-guided-dtable-editor-client

@Override
public void onOtherwiseCell() {
  if (isReadOnly()) {
    return;
  }
  final List<GridData.SelectedCell> selections = uiModel.getSelectedCells();
  if (selections.size() != 1) {
    return;
  }
  final GridData.SelectedCell selection = selections.get(0);
  final int columnIndex = findUiColumnIndex(selection.getColumnIndex());
  synchronizer.setCellOtherwiseState(selection.getRowIndex(),
                    columnIndex);
  view.getLayer().draw();
}
origin: org.uberfire/uberfire-wires-core-grids

@Test
public void testEditBodyCellWithMultipleSelectedCells() {
  when(uiModel.getSelectedCells()).thenReturn(Arrays.asList(new GridData.SelectedCell(0, 0),
                               new GridData.SelectedCell(0, 1)));
  assertThat(handler.onNodeMouseEvent(gridWidget,
                    relativeLocation,
                    Optional.empty(),
                    Optional.empty(),
                    Optional.of(0),
                    Optional.of(1),
                    event)).isFalse();
  verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());
  verify(gridWidget, never()).startEditingCell(any(Point2D.class));
}
origin: kiegroup/appformer

public void onMerge(final boolean isMerged) {
  if (isMerged) {
    final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
    final List<GridData.SelectedCell> cloneSelectedCells = new ArrayList<GridData.SelectedCell>(selectedCells);
    gridData.clearSelections();
    for (GridData.SelectedCell cell : cloneSelectedCells) {
      gridData.selectCells(cell.getRowIndex(),
                 ColumnIndexUtilities.findUiColumnIndex(gridData.getColumns(),
                                    cell.getColumnIndex()),
                 1,
                 1);
    }
  }
}
origin: kiegroup/appformer

@Test
public void testAdjustSelectionDownInHeader() {
  col2.getHeaderMetaData().add(new BaseHeaderMetaData("col1", "second-row"));
  cellSelectionManager.selectHeaderCell(0,
                     1,
                     false,
                     false);
  cellSelectionManager.adjustSelection(SelectionExtension.DOWN, false);
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  Assertions.assertThat(selectedHeaderCells).hasSize(1);
  final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);
  Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);
  Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(1);
}
origin: kiegroup/appformer

  private void assertCellSelections(final int headerRowIndex,
                   final int headerColumnIndex,
                   final int selectedCellCount) {
    final List<GridData.SelectedCell> selectedCells = uiModel.getSelectedCells();
    final List<GridData.SelectedCell> selectedHeaderCells = uiModel.getSelectedHeaderCells();
    assertEquals(0,
           selectedCells.size());
    assertEquals(selectedCellCount,
           selectedHeaderCells.size());
    assertTrue(selectedHeaderCells.contains(new GridData.SelectedCell(headerRowIndex,
                                     headerColumnIndex)));
  }
}
origin: org.uberfire/uberfire-wires-core-grids

@Test
public void singleCellSelection() {
  strategy.handleSelection(uiModel,
               0,
               0,
               false,
               false);
  final List<SelectedCell> selectedCells = uiModel.getSelectedCells();
  assertEquals(2,
         selectedCells.size());
  assertTrue(selectedCells.contains(new SelectedCell(0,
                            0)));
  assertTrue(selectedCells.contains(new SelectedCell(1,
                            0)));
}
origin: kiegroup/appformer

@Test
public void selectCellPointCoordinateWithinGridBounds() {
  cellSelectionManager.selectCell(new Point2D(50,
                        42),
                  false,
                  false);
  final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();
  assertEquals(1,
         selectedCells.size());
  assertEquals(0,
         selectedCells.get(0).getRowIndex());
  assertEquals(0,
         selectedCells.get(0).getColumnIndex());
}
origin: kiegroup/appformer

@Test
public void selectHeaderCellWithPoint() {
  cellSelectionManager.selectHeaderCell(new Point2D(col1.getWidth() + col2.getWidth() / 2,
                           HEADER_HEIGHT / 2),
                     false,
                     false);
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  assertEquals(1,
         selectedHeaderCells.size());
  assertEquals(0,
         selectedHeaderCells.get(0).getRowIndex());
  assertEquals(1,
         selectedHeaderCells.get(0).getColumnIndex());
  assertNull(gridWidgetData.getSelectedCellsOrigin());
}
origin: kiegroup/appformer

@Test
public void testAdjustSelectionUpInHeader() {
  col2.getHeaderMetaData().add(new BaseHeaderMetaData("col1", "second-row"));
  cellSelectionManager.selectHeaderCell(1,
                     1,
                     false,
                     false);
  cellSelectionManager.adjustSelection(SelectionExtension.UP, false);
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  Assertions.assertThat(selectedHeaderCells).hasSize(1);
  final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);
  Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);
  Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(0);
}
origin: kiegroup/appformer

@Test
public void testAdjustSelectionDownFromHeaderToData() {
  cellSelectionManager.selectHeaderCell(0,
                     1,
                     false,
                     false);
  cellSelectionManager.adjustSelection(SelectionExtension.DOWN, false);
  final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();
  Assertions.assertThat(selectedHeaderCells).isEmpty();
  final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();
  Assertions.assertThat(selectedCells).hasSize(1);
  final GridData.SelectedCell selectedCell = selectedCells.get(0);
  Assertions.assertThat(selectedCell.getColumnIndex()).isEqualTo(1);
  Assertions.assertThat(selectedCell.getRowIndex()).isEqualTo(0);
}
origin: kiegroup/appformer

public void onInsertColumn(final int index) {
  final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();
  final List<Integer> rowsWithASelection = selectedCells.stream()
      .filter(sc -> {
        final int ri = sc.getRowIndex();
        final int ci = sc.getColumnIndex();
        final int _ci = ColumnIndexUtilities.findUiColumnIndex(gridData.getColumns(), ci);
        final GridCell<?> cell = gridData.getCell(ri, _ci);
        return cell != null && cell.getSelectionStrategy() instanceof RowSelectionStrategy;
      })
      .map(GridData.SelectedCell::getRowIndex)
      .collect(Collectors.toList());
  rowsWithASelection.forEach(rowIndex -> onSelectCell(rowIndex, index));
}
org.uberfire.ext.wires.core.grids.client.modelGridData$SelectedCell

Javadoc

A selected cell within the data. Selected state is not stored in the GridCell implementation as we'd need to scan the whole grid to retrieve selected cells. The assumption is that the number of selected cells is invariably far, far fewer than the total number of cells in the grid.

Most used methods

  • getColumnIndex
  • getRowIndex
  • <init>

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)