public void clearSelection() { if (!_selection.isEmpty()) { final int[][] paths = getSelectionPaths(); if (paths != null) { _selection.clear(); for (int j = 0; j < paths.length; ++j) fireSelectionChanged(paths[j]); } } }
public void setMultiple(boolean multiple) { if (_multiple != multiple) { _multiple = multiple; fireEvent(TreeDataEvent.MULTIPLE_CHANGED, null, -1, -1); if (!multiple && _selection.size() > 1) { final List<Path> sels = new LinkedList<Path>(); sels.addAll(_selection); final Path sel = sels.remove(0); _selection.clear(); _selection.add(sel); for (final Path path : sels) fireSelectionChanged(path.path); } } }
public boolean removeSelectionPaths(int[][] paths) { boolean found = false; final int len = paths != null ? paths.length : 0; for (int j = 0; j < len && !_selection.isEmpty(); ++j) { final Path path = new Path(paths[j]); if (_selection.remove(path)) { found = true; fireSelectionChanged(path.path); } if (!isMultiple()) break; } return found; }
public boolean addSelectionPaths(int[][] paths) { boolean added = false; final int len = paths != null ? paths.length : 0; final boolean multiple = isMultiple(); for (int j = 0; j < len; ++j) if (paths[j] != null) { final Path path = new Path(paths[j]); if (multiple) { if (_selection.add(path)) { added = true; fireSelectionChanged(path.path); } } else { if (!_selection.contains(path)) { added = true; clearSelection(); _selection.add(path); fireSelectionChanged(path.path); } break; //done } } return added; }