Belongs to the following category: Extension,
Purpose
Implements a TableTree version where the first columns are docked to the left border, whereas the remaining columns are horizontally scrollable. Is useful when you have a tabletree with many columns that requires horizontal scrolling. The first couple of columns may hold a description for the rows which must stay at the left border, independently of scrolling.
Resources
- Download the complete source code and jar files
here.
- Download the jar file to be used server side
here.
- Download the jar file to be used client side
here.
How to use
- Create first the model of your ULCFixedColumnsTableTree. You can do this implementing the ITableTreeModel interface.
- Create the ULCFixedColumnTableTree, passing the model, the first scrollable column index, the list of column withs and the expandAll flag.
ITableTreeModel model = createModel();
…
ULCFixedColumn result = new ULCFixedColumn(model,2,new int[]{100,130,100,100,100,100,100}, true);
- Note: the default behaviour is "setColumnSelectionAllowed". If you need to change it, do it using the ULCFixedColumnTableTree API.
How it is implemented
- The solution chosen uses directly the ULCScrollPane "rowHeaderView" and "viewPortView" properties.
- Internally two separated ULCTableTree are managed. Both ULCTableTree objects can be retrieved through the API.
- The TreeSelectionEvents of both elements are forwarded to ULCFixedColumnTableTree, so that you can add a ITreeSelectionListener to ULCFixedColumnTableTree.
Added server side API
On server-side we add API to manage the common selection type. Use this API to change it. setRowSelectionAllowed(true) is the default.
public void addTreeSelectionListener(ITreeSelectionListener selectionListener);public void removeTreeSelectionListener(ITreeSelectionListener selectionListener);public void setRowSelectionAllowed(boolean rowSelectionAllowed);public void setColumnSelectionAllowed(boolean columnSelectionAllowed);public void setCellSelectionEnabled(boolean cellSelectionEnabled);public ULCTableTree getRowHeaderTableTree();public ULCTableTree getViewPortTableTree();
Authors
sibylle and
sandro