public void find( final String expression, final boolean selectedOnly, final boolean firstInRow, final boolean forward) { if (this.tableLayers != null) { final PositionCoordinate anchor = this.tableLayers.selectionLayer.getSelectionAnchor(); final FindTask task = new FindTask( expression, anchor.getRowPosition(), anchor.getColumnPosition(), firstInRow, forward, (selectedOnly) ? new SelectionFindFilter() : null); this.dataProvider.find(task); } }
protected void updateSelection() { final boolean checkLabel; synchronized (this.selectionLock) { final long diff = (this.selectionUpdateScheduleStamp - System.nanoTime()) / 1000000L; if (diff > 5) { this.display.timerExec((int) diff, this.selectionUpdateRunnable); return; } checkLabel = this.selectionCheckLabel; this.selectionCheckLabel = false; this.selectionUpdateScheduled = false; } final RDataTableSelection selection; if (this.tableLayers == null) { selection = new RDataTableSelection(null, null, null, null); } else { final SelectionLayer selectionLayer = this.tableLayers.selectionLayer; final PositionCoordinate anchor = selectionLayer.getSelectionAnchor(); PositionCoordinate lastSelected = selectionLayer.getLastSelectedCellPosition(); if (lastSelected.equals(anchor)) { lastSelected = null; } final boolean anchorChanged; if ((anchorChanged = !anchor.equals(this.currentAnchor))) { this.currentAnchor = new PositionCoordinate(anchor); } final boolean lastSelectedChanged; if ((lastSelectedChanged = !((lastSelected != null) ? lastSelected.equals(this.currentLastSelectedCell) : null == this.currentLastSelectedCell))) { this.currentLastSelectedCell = (lastSelected != null) ? new PositionCoordinate(lastSelected) : null; } if (!checkLabel && !anchorChanged && !lastSelectedChanged) { return; } String anchorRowLabel = null; String anchorColumnLabel = null; if (this.currentAnchor.columnPosition >= 0 && this.currentAnchor.rowPosition >= 0) { if (anchorChanged || checkLabel) { anchorRowLabel = getRowLabel(this.currentAnchor.rowPosition); if (anchorRowLabel != null) { anchorColumnLabel = getColumnLabel(this.currentAnchor.columnPosition); if (anchorColumnLabel == null) { anchorRowLabel = null; } } } else if (this.selection != null) { anchorRowLabel = this.selection.getAnchorRowLabel(); anchorColumnLabel = this.selection.getAnchorColumnLabel(); } } if (anchorRowLabel == null) { return; } String lastSelectedRowLabel = null; String lastSelectedColumnLabel = null; if (this.currentLastSelectedCell != null && this.currentLastSelectedCell.columnPosition >= 0 && this.currentLastSelectedCell.rowPosition >= 0) { if (lastSelectedChanged || checkLabel) { lastSelectedRowLabel = getRowLabel(this.currentLastSelectedCell.rowPosition); if (lastSelectedRowLabel != null) { lastSelectedColumnLabel = getColumnLabel(this.currentLastSelectedCell.columnPosition); if (lastSelectedColumnLabel == null) { lastSelectedRowLabel = null; } } } else if (this.selection != null) { lastSelectedRowLabel = this.selection.getLastSelectedCellRowLabel(); lastSelectedColumnLabel = this.selection.getLastSelectedCellColumnLabel(); } } selection = new RDataTableSelection( anchorRowLabel, anchorColumnLabel, lastSelectedRowLabel, lastSelectedColumnLabel); } if (selection.equals(this.selection)) { return; } this.selection = selection; final SelectionChangedEvent event = new SelectionChangedEvent(this, this.selection); for (final ISelectionChangedListener listener : this.selectionListeners.toArray()) { listener.selectionChanged(event); } }