use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowRowPositionsEvent in project nebula.widgets.nattable by eclipse.
the class RowHideShowLayer method showAllRows.
@Override
public void showAllRows() {
Collection<Integer> hiddenRows = new ArrayList<Integer>(this.hiddenRowIndexes);
this.hiddenRowIndexes.clear();
invalidateCache();
fireLayerEvent(new ShowRowPositionsEvent(this, hiddenRows));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowRowPositionsEvent in project nebula.widgets.nattable by eclipse.
the class HierarchicalTreeLayer method expandOrCollapse.
/**
* Expands or collapses the node at the given index coordinates according to
* its current state. Expands to the given level, e.g. if toLevel 0 is
* given, only the first level of a row is expanded, given toLevel is 1 and
* a node in the first level should be expanded, that node will be expanded
* as well as all collapsed nodes in the second level for this object.
*
* @param columnIndex
* The column index of the node to handle.
* @param rowIndex
* The row index of the node to handle.
* @param toLevel
* 0 based hierarchy level to expand to. Will be ignored on
* collapse or if value is -1.
* <p>
* <b>Note:</b> This is the level to expand to, not the number of
* levels to expand from the expanded level.
* </p>
*/
public void expandOrCollapse(int columnIndex, int rowIndex, int toLevel) {
List<Integer> toProcess = getChildIndexes(columnIndex, rowIndex);
HierarchicalTreeNode coord = new HierarchicalTreeNode(columnIndex, rowIndex, null);
if (this.collapsedNodes.contains(coord)) {
this.collapsedNodes.remove(coord);
// ensure that deeper level collapsed rows are not shown again
Range children = new Range(rowIndex, toProcess.get(toProcess.size() - 1));
int toLevelColumnIndex = (toLevel >= 0) ? this.nodeColumnMapping.get(toLevel) : -1;
for (Iterator<HierarchicalTreeNode> it = this.collapsedNodes.iterator(); it.hasNext(); ) {
HierarchicalTreeNode p = it.next();
// and coord column is bigger than the toLevel
if (children.contains(p.rowIndex)) {
if (p.columnIndex > toLevelColumnIndex) {
toProcess.removeAll(getChildIndexes(p.columnIndex, p.rowIndex));
} else {
// we also remove the coord in case it will be expanded
it.remove();
}
}
}
this.getHiddenRowIndexes().removeAll(toProcess);
invalidateCache();
fireLayerEvent(new ShowRowPositionsEvent(this, toProcess));
} else {
coord.rowObject = this.underlyingList.get(coord.rowIndex);
this.collapsedNodes.add(coord);
this.getHiddenRowIndexes().addAll(toProcess);
invalidateCache();
fireLayerEvent(new HideRowPositionsEvent(this, toProcess));
}
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowRowPositionsEvent in project nebula.widgets.nattable by eclipse.
the class TreeLayer method expandTreeRow.
/**
* Expands the tree node for the given row index.
*
* @param parentIndex
* The index of the row that shows the node that should be
* expanded
*/
public void expandTreeRow(int parentIndex) {
List<Integer> rowIndexes = this.treeRowModel.expand(parentIndex);
// removeAll()
for (final Integer expandedChildRowIndex : rowIndexes) {
this.hiddenRowIndexes.remove(expandedChildRowIndex);
}
invalidateCache();
fireLayerEvent(new ShowRowPositionsEvent(this, rowIndexes));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowRowPositionsEvent in project nebula.widgets.nattable by eclipse.
the class TreeLayer method expandAll.
/**
* Expands all tree nodes in the tree.
*/
public void expandAll() {
List<Integer> rowIndexes = this.treeRowModel.expandAll();
this.hiddenRowIndexes.clear();
invalidateCache();
fireLayerEvent(new ShowRowPositionsEvent(this, rowIndexes));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.event.ShowRowPositionsEvent in project nebula.widgets.nattable by eclipse.
the class TreeLayer method expandAllToLevel.
/**
* Expands all tree nodes in the tree to a certain level.
*
* @param level
* The level to which the tree node should be expanded.
*/
public void expandAllToLevel(int level) {
List<Integer> rowIndexes = this.treeRowModel.expandToLevel(level);
// removeAll()
for (final Integer expandedChildRowIndex : rowIndexes) {
this.hiddenRowIndexes.remove(expandedChildRowIndex);
}
invalidateCache();
fireLayerEvent(new ShowRowPositionsEvent(this, rowIndexes));
}
Aggregations