|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wings.SComponent
org.wings.STree
public class STree
Swing-like tree widget.
| Nested Class Summary | |
|---|---|
protected class |
STree.TreeModelHandler
Listens to the model and updates the expandedState accordingly when nodes are removed, or changed. |
| Field Summary | |
|---|---|
static int |
CONTIGUOUS_TREE_SELECTION
Tree selection model. |
static int |
DISCONTIGUOUS_TREE_SELECTION
Tree selection model. |
protected boolean |
epochCheckEnabled
|
protected TreeModel |
model
|
protected STreeCellRenderer |
renderer
|
protected ArrayList |
requestedExpansionPaths
store here expansion paths that will be processed after procession the request. |
protected STreeSelectionModel |
selectionModel
|
static int |
SINGLE_TREE_SELECTION
Tree selection model. |
protected TreeModelListener |
treeModelListener
|
protected AbstractLayoutCache |
treeState
|
protected Rectangle |
viewport
Implementation of the Scrollable interface. |
| Fields inherited from class org.wings.SComponent |
|---|
DONE_RENDERING, dynamicStyles, enabled, propertyChangeSupport, SELECTOR_ALL, START_RENDERING, visible, WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_FRAME |
| Constructor Summary | |
|---|---|
STree()
|
|
STree(TreeModel model)
|
|
| Method Summary | |
|---|---|
protected void |
addDelayedExpansionEvent(TreeExpansionEvent e,
boolean expansion)
|
void |
addMouseListener(SMouseListener l)
Adds the specified mouse listener to receive mouse events from this component. |
void |
addSelectionPath(TreePath path)
Adds the node identified by the specified TreePath to the current selection. |
void |
addSelectionPaths(TreePath[] paths)
Adds each path in the array of paths to the current selection. |
void |
addSelectionRow(int row)
Adds the path at the specified row to the current selection. |
void |
addSelectionRows(int[] rows)
Adds the paths at each of the specified rows to the current selection. |
void |
addTreeExpansionListener(TreeExpansionListener tel)
|
void |
addTreeSelectionListener(TreeSelectionListener tsl)
|
void |
addTreeWillExpandListener(TreeWillExpandListener tel)
Adds a listener for TreeWillExpand events. |
void |
addViewportChangeListener(SViewportChangeListener l)
Adds the given SViewportChangeListener to the scrollable. |
void |
collapsePath(TreePath p)
|
void |
collapseRow(int row)
|
void |
collapseRow(TreePath p)
Deprecated. This method is deprecated and should not be used because collapsePath(TreePath) is the proper method with the same functionality. |
protected TreeModelListener |
createTreeModelListener()
Creates an instance of TreeModelHandler. |
void |
expandPath(TreePath p)
Expand this tree row. |
void |
expandRow(int row)
|
void |
expandRow(TreePath p)
Deprecated. This method is deprecated and should not be used because expandPath(TreePath) is the proper method with the same functionality. |
protected int |
fillPathForAbsoluteRow(int row,
Object node,
ArrayList path)
|
protected void |
fireDelayedExpansionEvents()
|
void |
fireFinalEvents()
Internal event trigger used by CGs. |
void |
fireIntermediateEvents()
fire events which describes a "in progress" state change, like TreeWillExpand, or ListSelectionEvent with getIsAdjusting() true, ... |
protected void |
fireMouseClickedEvent(SMouseEvent event)
Reports a mouse click event. |
void |
fireTreeCollapsed(TreePath path)
Notify all listeners that have registered interest for notification on this event type. |
void |
fireTreeExpanded(TreePath path)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeExpansionEvent(TreeExpansionEvent e,
boolean expansion)
|
protected void |
fireTreeSelectionEvent(TreeSelectionEvent e)
|
void |
fireTreeWillExpand(TreePath path,
boolean expand)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireViewportChanged(boolean horizontal)
Notifies all listeners that have registered interest for notification on changes to this scrollable's viewport in the specified direction. |
STreeCellRenderer |
getCellRenderer()
|
SCellRendererPane |
getCellRendererPane()
|
protected static TreeModel |
getDefaultTreeModel()
Creates and returns a sample TreeModel. |
String |
getExpansionParameter(int row,
boolean absolute)
This is for plafs only! With this parameter the tree expands the given node |
Object |
getLastSelectedPathComponent()
Returns the last path component in the first node of the current selection. |
TreePath |
getLeadSelectionPath()
Returns the path of the last node added to the selection. |
int |
getLeadSelectionRow()
Returns the row index of the last node added to the selection. |
int |
getMaximumExpandedDepth()
|
int |
getMaxSelectionRow()
Gets the last selected row. |
int |
getMinSelectionRow()
Gets the first selected row. |
TreeModel |
getModel()
|
int |
getNodeIndentDepth()
|
protected TreePath[] |
getPathBetweenRows(int index0,
int index1)
Returns JTreePath instances representing the path between index0 and index1 (including index1). |
TreePath |
getPathForAbsoluteRow(int row)
|
TreePath |
getPathForRow(int row)
|
int |
getRowCount()
|
int |
getRowForLocation(SPoint point)
Returns the tree row for the passed SPoint. |
int |
getRowForPath(TreePath path)
|
Rectangle |
getScrollableViewportSize()
The size of the component in respect to scrollable units. |
int |
getSelectionCount()
Returns the number of nodes selected. |
STreeSelectionModel |
getSelectionModel()
Returns the model for selections. |
String |
getSelectionParameter(int row,
boolean absolute)
This is for plafs only! With this parameter the tree selects the given node |
TreePath |
getSelectionPath()
Returns the path to the first selected node. |
TreePath[] |
getSelectionPaths()
Returns the paths of all selected values. |
int[] |
getSelectionRows()
Returns all of the currently selected rows. |
Rectangle |
getViewportSize()
Returns the actual visible part of a scrollable. |
boolean |
isEpochCheckEnabled()
Asks the low-level event listener if epoch checking should be perfomed on it. |
boolean |
isExpanded(TreePath path)
|
boolean |
isPathSelected(TreePath path)
Returns true if the item identified by the path is currently selected. |
boolean |
isRootVisible()
|
boolean |
isRowSelected(int row)
Returns true if the node identitifed by row is selected. |
boolean |
isVisible(TreePath path)
|
void |
processLowLevelEvent(String action,
String[] values)
Deliver low level/http events (parameters). |
protected void |
processRequestedExpansionPaths()
|
void |
removeMouseListener(SMouseListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this component. |
void |
removeSelectionInterval(int index0,
int index1)
Removes the nodes between index0 and index1, inclusive, from the selection. |
void |
removeSelectionPath(TreePath path)
Removes the node identified by the specified path from the current selection. |
void |
removeSelectionPaths(TreePath[] paths)
Removes the nodes identified by the specified paths from the current selection. |
void |
removeSelectionRow(int row)
Removes the path at the index row from the current
selection. |
void |
removeSelectionRows(int[] rows)
|
void |
removeTreeExpansionListener(TreeExpansionListener tel)
|
void |
removeTreeSelectionListener(TreeSelectionListener tsl)
|
void |
removeTreeWillExpandListener(TreeWillExpandListener tel)
Removes a listener for TreeWillExpand events. |
void |
removeViewportChangeListener(SViewportChangeListener l)
Removes the given SViewportChangeListener from the scrollable. |
int |
rowAtPoint(SPoint point)
Returns the table row for the passed SPoint
instance received via addMouseListener(org.wings.event.SMouseListener). |
void |
setCellRenderer(STreeCellRenderer x)
|
void |
setCG(TreeCG cg)
|
void |
setEpochCheckEnabled(boolean epochCheckEnabled)
|
void |
setModel(TreeModel m)
|
void |
setNodeIndentDepth(int depth)
Set the indent depth in pixel between two nodes of a different level. |
void |
setParent(SContainer p)
Sets the parent container. |
protected void |
setParentFrame(SFrame f)
Sets the parent frame. |
void |
setRootVisible(boolean rootVisible)
|
void |
setSelectionModel(STreeSelectionModel selectionModel)
Sets the tree's selection model. |
void |
setSelectionPath(TreePath path)
Selects the node identified by the specified path. |
void |
setSelectionPaths(TreePath[] paths)
Selects the nodes identified by the specified array of paths. |
void |
setSelectionRow(int row)
Selects the node at the specified row in the display. |
void |
setSelectionRows(int[] rows)
Selects the nodes corresponding to each of the specified rows in the display. |
void |
setViewportSize(Rectangle newViewport)
Sets the actual visible part of a scrollable. |
protected void |
togglePathExpansion(TreePath path)
|
protected void |
togglePathSelection(TreePath path)
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.wings.LowLevelEventListener |
|---|
getLowLevelEventId, getName, isEnabled |
| Field Detail |
|---|
public static final int SINGLE_TREE_SELECTION
TreeSelectionModel.setSelectionMode(int),
TreeSelectionModel.SINGLE_TREE_SELECTION,
Constant Field Valuespublic static final int CONTIGUOUS_TREE_SELECTION
TreeSelectionModel.setSelectionMode(int),
TreeSelectionModel.CONTIGUOUS_TREE_SELECTION,
Constant Field Valuespublic static final int DISCONTIGUOUS_TREE_SELECTION
TreeSelectionModel.setSelectionMode(int),
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION,
Constant Field Valuesprotected TreeModel model
protected transient TreeModelListener treeModelListener
protected STreeCellRenderer renderer
protected STreeSelectionModel selectionModel
protected final ArrayList requestedExpansionPaths
protected transient AbstractLayoutCache treeState
protected Rectangle viewport
Scrollable interface.
protected boolean epochCheckEnabled
LowLevelEventListener.isEpochCheckEnabled()| Constructor Detail |
|---|
public STree(TreeModel model)
public STree()
| Method Detail |
|---|
protected static TreeModel getDefaultTreeModel()
public void addTreeSelectionListener(TreeSelectionListener tsl)
public void removeTreeSelectionListener(TreeSelectionListener tsl)
protected void fireTreeSelectionEvent(TreeSelectionEvent e)
public void addTreeWillExpandListener(TreeWillExpandListener tel)
TreeWillExpand events.
tel - a TreeWillExpandListener that will be notified
when a tree node will be expanded or collapsed (a "negative
expansion")public void removeTreeWillExpandListener(TreeWillExpandListener tel)
TreeWillExpand events.
tel - the TreeWillExpandListener to remove
public void fireTreeWillExpand(TreePath path,
boolean expand)
throws ExpandVetoException
path parameter.
path - the TreePath indicating the node that was
expanded
ExpandVetoExceptionEventListenerListpublic void addTreeExpansionListener(TreeExpansionListener tel)
public void removeTreeExpansionListener(TreeExpansionListener tel)
protected void addDelayedExpansionEvent(TreeExpansionEvent e,
boolean expansion)
protected void fireDelayedExpansionEvents()
public void fireTreeExpanded(TreePath path)
path - the TreePath indicating the node that was expandedEventListenerList
protected void fireTreeExpansionEvent(TreeExpansionEvent e,
boolean expansion)
public void fireTreeCollapsed(TreePath path)
path - the TreePath indicating the node that was collapsedEventListenerListpublic final void addMouseListener(SMouseListener l)
l - the component listener.SMouseEvent,
SMouseListener,
STable.removeMouseListener(org.wings.event.SMouseListener)public final void removeMouseListener(SMouseListener l)
l - the component listener.SMouseEvent,
SMouseListener,
STable.addMouseListener(org.wings.event.SMouseListener)protected void fireMouseClickedEvent(SMouseEvent event)
event - report this event to all listenersSMouseListenerprotected void processRequestedExpansionPaths()
public void fireIntermediateEvents()
LowLevelEventListener
fireIntermediateEvents in interface LowLevelEventListenerpublic int rowAtPoint(SPoint point)
SPoint
instance received via addMouseListener(org.wings.event.SMouseListener).
point - The pointed retuned by the mouse event.
public int getRowForLocation(SPoint point)
SPoint.
instance received via addMouseListener(org.wings.event.SMouseListener).
point - The pointed returned by the mouse event.
public void fireFinalEvents()
SComponent
fireFinalEvents in interface LowLevelEventListenerfireFinalEvents in class SComponentpublic boolean isEpochCheckEnabled()
LowLevelEventListenertrue the Dispatcher will ignore request originating from old views
(typically iniated by triggering browser back and clicking somewhere.)
isEpochCheckEnabled in interface LowLevelEventListenertrue if epoch checking should be perfomed, false
if all request for this component should be processed.LowLevelEventListener.isEpochCheckEnabled()public void setEpochCheckEnabled(boolean epochCheckEnabled)
LowLevelEventListener.isEpochCheckEnabled()public void setRootVisible(boolean rootVisible)
public boolean isRootVisible()
public void setModel(TreeModel m)
public TreeModel getModel()
public int getRowCount()
public TreePath getPathForRow(int row)
public int getRowForPath(TreePath path)
protected int fillPathForAbsoluteRow(int row,
Object node,
ArrayList path)
public TreePath getPathForAbsoluteRow(int row)
public void setSelectionModel(STreeSelectionModel selectionModel)
selectionModel - the TreeSelectionModel to use, or null to
disable selectionsTreeSelectionModelpublic STreeSelectionModel getSelectionModel()
setSelectionModel(org.wings.tree.STreeSelectionModel)
protected TreePath[] getPathBetweenRows(int index0,
int index1)
index0 - an int specifying a display row, where 0 is the
first row in the displayindex1 - an int specifying a second display row
public void setSelectionPath(TreePath path)
path - the TreePath specifying the node to selectpublic void setSelectionPaths(TreePath[] paths)
paths - an array of TreePath objects that specifies the nodes
to selectpublic void setSelectionRow(int row)
row - the row to select, where 0 is the first row in
the displaypublic void setSelectionRows(int[] rows)
rows - an array of ints specifying the rows to select,
where 0 indicates the first row in the displaypublic void addSelectionPath(TreePath path)
path - the TreePath to addpublic void addSelectionPaths(TreePath[] paths)
paths - an array of TreePath objects that specifies the nodes
to addpublic void addSelectionRow(int row)
row - an int specifying the row of the node to add,
where 0 is the first row in the displaypublic void addSelectionRows(int[] rows)
rows - an array of ints specifying the rows to add,
where 0 indicates the first row in the displaypublic Object getLastSelectedPathComponent()
TreePath.getLastPathComponent()public TreePath getSelectionPath()
public TreePath[] getSelectionPaths()
public int[] getSelectionRows()
public int getSelectionCount()
public int getMinSelectionRow()
public int getMaxSelectionRow()
public int getLeadSelectionRow()
public TreePath getLeadSelectionPath()
public boolean isPathSelected(TreePath path)
path - a TreePath identifying a node
public boolean isRowSelected(int row)
row - an int specifying a display row, where 0 is the first
row in the display
public void removeSelectionInterval(int index0,
int index1)
index0 - an int specifying a display row, where 0 is the
first row in the displayindex1 - an int specifying a second display rowpublic void removeSelectionPath(TreePath path)
path - the TreePath identifying a nodepublic void removeSelectionPaths(TreePath[] paths)
paths - an array of TreePath objects that specifies the nodes
to removepublic void removeSelectionRow(int row)
row from the current
selection.
row - the row identifying the node to removepublic void removeSelectionRows(int[] rows)
public int getMaximumExpandedDepth()
@Deprecated public void expandRow(TreePath p)
SScrollPane try to
adjust pane, so that as much as possible new
nodes are visible.
p - the TreePath to expandpublic void expandPath(TreePath p)
SScrollPane try to
adjust pane, so that as much as possible new
nodes are visible.
p - the TreePath to expandpublic void expandRow(int row)
@Deprecated public void collapseRow(TreePath p)
SScrollPane try to
adjust pane, so that as much as possible new
nodes are visible.
p - the TreePath to expandpublic void collapsePath(TreePath p)
public void collapseRow(int row)
public boolean isVisible(TreePath path)
public boolean isExpanded(TreePath path)
protected void togglePathSelection(TreePath path)
protected void togglePathExpansion(TreePath path)
throws ExpandVetoException
ExpandVetoException
public String getExpansionParameter(int row,
boolean absolute)
public String getSelectionParameter(int row,
boolean absolute)
public void processLowLevelEvent(String action,
String[] values)
LowLevelEventListener
processLowLevelEvent in interface LowLevelEventListenerprocessLowLevelEvent in class SComponentaction - the name-value-pair's namevalues - the name-value-pair's valuespublic void setNodeIndentDepth(int depth)
depth - the depth to setpublic int getNodeIndentDepth()
public void setCellRenderer(STreeCellRenderer x)
public STreeCellRenderer getCellRenderer()
protected TreeModelListener createTreeModelListener()
public void setParent(SContainer p)
SComponent
setParent in class SComponentp - the containerprotected void setParentFrame(SFrame f)
SComponent
setParentFrame in class SComponentf - the framepublic SCellRendererPane getCellRendererPane()
public void setCG(TreeCG cg)
public Rectangle getScrollableViewportSize()
getScrollableViewportSize in interface Scrollablepublic Rectangle getViewportSize()
getViewportSize in interface Scrollablepublic void setViewportSize(Rectangle newViewport)
setViewportSize in interface Scrollablepublic void addViewportChangeListener(SViewportChangeListener l)
SViewportChangeListener to the scrollable.
addViewportChangeListener in interface Scrollablel - the listener to be addedpublic void removeViewportChangeListener(SViewportChangeListener l)
SViewportChangeListener from the scrollable.
removeViewportChangeListener in interface Scrollablel - the listener to be removedprotected void fireViewportChanged(boolean horizontal)
EventListenerList
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||