|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--fri.gui.swing.polytreetable.AbstractPolyTreeTableUserObject
A default PolyTreeTableUserObject that takes arrays as column names and classes and implements most of the static part of the interface: returning column names, column classes and column count. Implement listChildren() and listParents() to fill tree nodes with elements and pass an instance of this class to PolyTreeTable constructor. Implement getColumnObject(int column) to show a node label.
This class provides two lists for buffering children and parents, that get allocated when getChildCount() or getParentCount() is called. The abstract methods listChildren() and listParents() must fill these protected lists. (Mind: they get called just once!)
This userObject is not editable, as isColumnEditable() default returns false. Override it to set the object editable.
Default this object returns true for getAllowsChildren() if getChildCount() is bigger than zero (same for parents).
You need to implement equals() and hashCode(), as these nodes are managed in a Hashtable. Else there will be multiple appearances of one node.
| Field Summary | |
protected java.util.Vector |
children
The children list that gets pre-allocated in getChildCount(). |
protected java.lang.Class[] |
columnClasses
Classes of columns for PolyTreeTable. |
protected java.lang.String[] |
columnNames
Names of columns for PolyTreeTable. |
protected java.util.Vector |
parents
The parents list that gets pre-allocated in getParentCount(). |
| Constructor Summary | |
AbstractPolyTreeTableUserObject()
Construct a userObject for PolyTreeTable that has no column header. |
|
AbstractPolyTreeTableUserObject(java.lang.String[] columnNames,
java.lang.Class[] columnClasses)
Construct a userObject for PolyTreeTable by passing column names and classes, which must be of the same length. |
|
| Method Summary | |
boolean |
getAllowsChildren()
Returns true if the receiver allows children, i.e. it is a child "folder". |
boolean |
getAllowsParents()
Returns true if the receiver allows parents, i.e. it is a parent "folder". |
java.lang.Object |
getChildAt(int index)
Returns the child object at given index of this userObject. |
int |
getChildCount()
Allocates a children Vector, calls listChildren() and then returns the number of children list. |
java.lang.Class |
getColumnClass(int column)
Returns the class for given column. |
int |
getColumnCount()
Returns the number of columns for this userObject. |
java.lang.String |
getColumnName(int column)
Returns the name for given column. |
java.lang.Object |
getParentAt(int index)
Returns the parent object at given index of this userObject. |
int |
getParentCount()
Allocates a parents Vector, calls listParents() and then returns the number of parents list. |
boolean |
isColumnEditable(int column)
Returns false: not editable. |
protected abstract void |
listChildren()
MUST be overridden to fill a pre-allocated children Vector. |
protected abstract void |
listParents()
MUST be overridden to fill a pre-allocated parents Vector. |
java.lang.Object |
setColumnObject(int column,
java.lang.Object aValue)
Returns "this" Object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface fri.gui.swing.polytreetable.PolyTreeTableUserObject |
getColumnObject |
| Field Detail |
protected java.lang.String[] columnNames
protected java.lang.Class[] columnClasses
protected java.util.Vector children
protected java.util.Vector parents
| Constructor Detail |
public AbstractPolyTreeTableUserObject()
public AbstractPolyTreeTableUserObject(java.lang.String[] columnNames,
java.lang.Class[] columnClasses)
| Method Detail |
protected abstract void listChildren()
protected abstract void listParents()
public boolean isColumnEditable(int column)
isColumnEditable in interface PolyTreeTableUserObject
public java.lang.Object setColumnObject(int column,
java.lang.Object aValue)
setColumnObject in interface PolyTreeTableUserObjectpublic int getColumnCount()
getColumnCount in interface PolyTreeTableUserObjectpublic java.lang.Class getColumnClass(int column)
getColumnClass in interface PolyTreeTableUserObjectpublic java.lang.String getColumnName(int column)
getColumnName in interface PolyTreeTableUserObjectpublic int getChildCount()
getChildCount in interface PolyTreeTableUserObjectpublic java.lang.Object getChildAt(int index)
getChildAt in interface PolyTreeTableUserObjectpublic boolean getAllowsChildren()
getAllowsChildren in interface PolyTreeTableUserObjectpublic int getParentCount()
getParentCount in interface PolyTreeTableUserObjectpublic java.lang.Object getParentAt(int index)
getParentAt in interface PolyTreeTableUserObjectpublic boolean getAllowsParents()
getAllowsParents in interface PolyTreeTableUserObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||