|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JTable | +--com.klg.jclass.util.swing.JCSortableTable | +--com.klg.jclass.swing.JCTreeTable
A component that gives a visual representation of the hierarchical nature of its structure.
See
The Java 2 API
to compare this component to JTree
and JTable
.
Nested Class Summary | |
protected class |
JCTreeTable.Editor
|
protected static class |
JCTreeTable.EmptyTreeSelectionModel
EmptySelectionModel is a TreeSelectionModel that
does not allow anything to be selected. |
protected class |
JCTreeTable.Renderer
|
protected static class |
JCTreeTable.SwitchIcon
The icon that renderers itself differently whether the view is TREE or TABLE . |
protected class |
JCTreeTable.SwitchRenderer
Renderer used to draw the tree<-->table switch icon in the tree column header. |
protected class |
JCTreeTable.SwitchTableColumn
Overridden version of TableColumn that returns
SwitchRenderer instead of the normal default for the tree
column. |
protected class |
JCTreeTable.TableHeaderMouseAdapter
MouseAdapter for the table header. |
protected class |
JCTreeTable.TreeRendererEditor
Inner class to render the node hierarchy and wrap the defined PLAF renderer behavior. |
protected class |
JCTreeTable.TreeTableUI
|
Nested classes inherited from class com.klg.jclass.util.swing.JCSortableTable |
JCSortableTable.SortableTableColumn, JCSortableTable.SortIcon |
Nested classes inherited from class javax.swing.JTable |
JTable.AccessibleJTable |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected boolean |
expandInTreeColumnOnly
|
protected static int |
ICON_SIZE
|
static int |
NODE_LINES_HIDE
Valid value for ShowNodeLines . |
static int |
NODE_LINES_SHOW
Valid value for ShowNodeLines . |
static int |
NODE_LINES_USE_PLAF
Valid (default) value for ShowNodeLines . |
protected boolean |
sortable
|
protected com.klg.jclass.util.treetable.TreeTableSupport |
support
|
static int |
SWITCH_BUTTON_DONT_SHOW
Valid value for SwitchPolicy . |
static int |
SWITCH_VIEW_NEVER
Valid value for SwitchPolicy . |
static int |
SWITCH_VIEW_ON_ICON_ONLY
Valid (default) value for SwitchPolicy . |
static int |
SWITCH_VIEW_TO_TABLE_ON_SORT
Valid value for SwitchPolicy . |
protected int |
switchPolicy
|
static int |
TABLE
Valid value for view. |
static int |
TREE
Valid value for view. |
protected com.klg.jclass.swing.JCTreeTableSelectionModel |
treeSelectionModel
|
Fields inherited from class com.klg.jclass.util.swing.JCSortableTable |
downIcon, sortModel, tableHeaderMouseListener, upIcon |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JCTreeTable()
Null constructor. |
|
JCTreeTable(com.klg.jclass.util.treetable.JCTreeTableModel model)
Constructor which uses the passed in model. |
|
JCTreeTable(com.klg.jclass.util.treetable.JCTreeTableModel model,
Dimension intercellSpacing)
Constructor which uses the passed in model and a preset intercellspacing. |
Method Summary | |
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 |
addTreeExpansionListener(TreeExpansionListener l)
Adds a listener for TreeExpansion events. |
void |
addTreeWillExpandListener(TreeWillExpandListener l)
Adds a listener for TreeWillExpand events. |
void |
collapsePath(TreePath path)
Ensures that the node identified by the specified path is collapsed and viewable. |
void |
collapseRow(int row)
Ensures that the node in the specified row is collapsed. |
TableColumn |
createSortableTableColumn(int column)
Creates the TableColumn needed. |
protected MouseAdapter |
createTableHeaderMouseListener()
Adds a MouseListener to the table header. |
void |
expandPath(TreePath path)
Ensures that the node identified by the specified path is expanded and viewable. |
void |
expandRow(int row)
Ensures that the node in the specified row is expanded and viewable. |
String |
getAbout()
Returns vendor information. |
TableCellEditor |
getCellEditor(int row,
int column)
Overridden to return the appropriate data editor for the first column if treetable is in tree display mode. |
TableCellRenderer |
getCellRenderer(int row,
int column)
Overridden to return the appropriate data renderer for the first column if treetable is in tree display mode. |
TreePath |
getClosestPathForLocation(int x,
int y)
Returns the path to the node that is closest to X,Y. |
int |
getClosestRowForLocation(int x,
int y)
Returns the row to the node that is closest to X,Y. |
TreePath |
getEditingPath()
Returns the path to the element that is currently being edited. |
Enumeration |
getExpandedDescendants(TreePath parent)
Returns an Enumeration of the descendants of path that
are currently expanded. |
Rectangle |
getPathBounds(TreePath path)
This method not functional in this release |
TreePath |
getPathForLocation(int x,
int y)
Returns the path for the node at the specified location. |
TreePath |
getPathForRow(int row)
Returns the path that is displayed at the table row specified. |
Dimension |
getPreferredSize()
Override this method to allow a different default preferred size for design time. |
Rectangle |
getRowBounds(int row)
This method is not functional in this release |
int |
getRowForLocation(int x,
int y)
Returns the row for the specified location. |
int |
getRowForPath(TreePath path)
Returns the row that displays the node identified by the specified path. |
int[] |
getRowsForPaths(TreePath[] paths)
Returns the rows for the visible specified paths. |
boolean |
getScrollsOnExpand()
Returns true if the tree scrolls to show previously hidden
children. |
TreePath |
getSelectionPath()
Returns the path to the first selected node. |
TreePath[] |
getSelectionPaths()
Returns the paths of all selected values. |
int |
getShowNodeLines()
Returns the state of ShowNodeLines . |
boolean |
getShowsRootHandles()
Returns true if handles for the root nodes are displayed. |
int |
getSwitchPolicy()
Returns the current value of the switchPolicy variable. |
int |
getTreeColumn()
Returns the actual tree column index. |
com.klg.jclass.util.treetable.JCTreeIconRenderer |
getTreeIconRenderer()
Returns the icon renderer being used. |
com.klg.jclass.swing.JCTreeTableSelectionModel |
getTreeSelectionModel()
Returns the model for selections. |
com.klg.jclass.util.treetable.JCTreeTableModel |
getTreeTableModel()
Returns the JCTreeTableModel that is providing the data. |
int |
getView()
Returns the current view. |
boolean |
isExpandInTreeColumnOnly()
Gets the value of the expandInTreeColumnOnly property. |
boolean |
isPathSelected(TreePath path)
Returns true if the item identified by the path is currently
selected. |
protected boolean |
isPointOverSwitch(Point p)
Asks: "Is the point over the icon that controls whether the view is TREE or TABLE ?". |
boolean |
isRootVisible()
Returns true if the root node of the tree is displayed. |
boolean |
isSortable()
Gets whether the treetable is sortable or not. |
void |
makeVisible(TreePath path)
Ensures that the node identified by path is currently viewable. |
protected void |
reLayoutColumnRenderers()
Iterate through the columns to get the renderer so that we can reset the horizontal alignment on JCCellRenderers. |
void |
removeTreeExpansionListener(TreeExpansionListener l)
Removes a listener for TreeExpansion events. |
void |
removeTreeWillExpandListener(TreeWillExpandListener l)
Removes a listener for TreeWillExpand events. |
void |
setAbout(String s)
Provided for Beans property editors - has no effect. |
void |
setExpandInTreeColumnOnly(boolean expandInTreeColumnOnly)
Sets the value of the expandInTreeColumnOnly property. |
void |
setRootVisible(boolean rootVisible)
Determines whether or not the root node from the TreeModel is
visible. |
void |
setScrollsOnExpand(boolean newValue)
Determines whether or not as many of the descendants are scrolled to be inside the viewport as possible when a node is expanded. |
void |
setSelectionPath(TreePath path)
Selects the node identified by the specified path. |
void |
setSelectionPaths(TreePath[] paths)
Select the specified paths. |
void |
setShowNodeLines(int lines)
Allows you override the PLAF specified behavior of drawing lines. |
void |
setShowsRootHandles(boolean newValue)
Determines whether the handles for the root nodes are to be displayed. |
void |
setSortable(boolean sortable)
Sets whether the treetable is sortable or not. |
void |
setSwitchPolicy(int policy)
Sets the switchPolicy variable which determines whether or
not to allow view switching. |
void |
setTreeIconRenderer(com.klg.jclass.util.treetable.JCTreeIconRenderer renderer)
Sets the icon renderer. |
void |
setTreeTableModel(com.klg.jclass.util.treetable.JCTreeTableModel model)
Sets the TreeModel that will provide the data. |
void |
setTreeTableSelectionModel(com.klg.jclass.swing.JCTreeTableSelectionModel treeSelectionModel)
Sets the tree's selection model. |
void |
setUI(TableUI ui)
|
void |
setView(int view)
Sets whether we are viewing this as a tree or a table. |
protected void |
toggleView()
Switches views between TREE and TABLE . |
void |
updateUI()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int TREE
public static final int TABLE
public static final int SWITCH_VIEW_NEVER
SwitchPolicy
. View is not interactively
switchable.
public static final int SWITCH_VIEW_TO_TABLE_ON_SORT
SwitchPolicy
. Switch view to table any time a
sort is invoked and whenever the switch icon is clicked.
public static final int SWITCH_VIEW_ON_ICON_ONLY
SwitchPolicy
. Switch only when the
switch icon is clicked on.
public static final int SWITCH_BUTTON_DONT_SHOW
SwitchPolicy
. Do not even show the switch icon.
Thus the view is also not interactively switchable.
public static final int NODE_LINES_SHOW
ShowNodeLines
.
public static final int NODE_LINES_HIDE
ShowNodeLines
.
public static final int NODE_LINES_USE_PLAF
ShowNodeLines
.
protected static final int ICON_SIZE
protected int switchPolicy
protected com.klg.jclass.util.treetable.TreeTableSupport support
protected com.klg.jclass.swing.JCTreeTableSelectionModel treeSelectionModel
protected boolean sortable
protected boolean expandInTreeColumnOnly
Constructor Detail |
public JCTreeTable()
EmptyTreeTableModel
will be used.
public JCTreeTable(com.klg.jclass.util.treetable.JCTreeTableModel model)
model
- the JCTreeTableModel
to be usedpublic JCTreeTable(com.klg.jclass.util.treetable.JCTreeTableModel model, Dimension intercellSpacing)
model
- the JCTreeTableModel
to be usedintercellSpacing
- the horizontal and vertical space between cellsMethod Detail |
public void setUI(TableUI ui)
setUI
in class JTable
public void updateUI()
updateUI
in class JTable
public Dimension getPreferredSize()
JCSortableTable
getPreferredSize
in class JCSortableTable
public void setAbout(String s)
setAbout
in class JCSortableTable
s
- ignoredpublic String getAbout()
getAbout
in class JCSortableTable
public boolean isSortable()
public void setSortable(boolean sortable)
sortable
- the boolean valuepublic void setSwitchPolicy(int policy)
switchPolicy
variable which determines whether or
not to allow view switching.
policy
- the new switch policy; valid values are
SWITCH_VIEW_NEVER
,
SWITCH_VIEW_TO_TABLE_ON_SORT
,
SWITCH_VIEW_ON_ICON_ONLY
, or
SWITCH_BUTTON_DONT_SHOW
public int getSwitchPolicy()
switchPolicy
variable.
SWITCH_VIEW_NEVER
,
SWITCH_VIEW_TO_TABLE_ON_SORT
,
SWITCH_VIEW_ON_ICON_ONLY
, or
SWITCH_BUTTON_DONT_SHOW
public void setView(int view)
view
- Valid values are TREE
and TABLE
public int getView()
TREE
or
TABLE
setView(int)
public void setShowNodeLines(int lines)
lines
- the new line drawing style; must be one of
NODE_LINES_USE_PLAF
(the default),
NODE_LINES_SHOW
,
or NODE_LINES_HIDE
public int getShowNodeLines()
ShowNodeLines
.
NODE_LINES_USE_PLAF
(the default),
NODE_LINES_SHOW
,
or NODE_LINES_HIDE
setShowNodeLines(int)
public boolean isExpandInTreeColumnOnly()
expandInTreeColumnOnly
property. If
true
, the only way to expand or collapse the tree is to click
or double click in the tree column. If false
(the default
value), clicking anywhere in the row (where an editor is not present) will
expand/collapse the tree.
expandInTreeColumnOnly
propertypublic void setExpandInTreeColumnOnly(boolean expandInTreeColumnOnly)
expandInTreeColumnOnly
property. If
true
, the only way to expand or collapse the tree is to click
or double click in the tree column. If false
(the default
value), clicking anywhere in the row (where an editor is not present) will
expand/collapse the tree.
expandInTreeColumnOnly
- the new value of the
expandInTreeColumnOnly
propertypublic int getTreeColumn()
TREE
public TableCellRenderer getCellRenderer(int row, int column)
getCellRenderer
in class JCSortableTable
row
- the row of the cell to render, where 0 is the firstcolumn
- the column of the cell to render, where 0 is the first
public TableCellEditor getCellEditor(int row, int column)
getCellEditor
in class JCSortableTable
row
- the row of the cell to edit, where 0 is the firstcolumn
- the column of the cell to edit, where 0 is the first
public void addTreeExpansionListener(TreeExpansionListener l)
TreeExpansion
events.
l
- a TreeExpansionListener
that will be notified when
a tree node is expanded or collapsed (a "negative
expansion")public void removeTreeExpansionListener(TreeExpansionListener l)
TreeExpansion
events.
l
- the TreeExpansionListener
to removepublic void addTreeWillExpandListener(TreeWillExpandListener l)
TreeWillExpand
events.
l
- a TreeWillExpandListener
that will be notified when
a tree node will be expanded or collapsed (a "negative
expansion")public void removeTreeWillExpandListener(TreeWillExpandListener l)
TreeWillExpand
events.
l
- the TreeWillExpandListener
to removepublic void setTreeIconRenderer(com.klg.jclass.util.treetable.JCTreeIconRenderer renderer)
renderer
- the new icon rendererpublic com.klg.jclass.util.treetable.JCTreeIconRenderer getTreeIconRenderer()
public void collapseRow(int row)
If row
is < 0 or >= getRowCount, this
will have no effect.
row
- an int specifying a display row, where 0 is the
first row in the displaypublic void collapsePath(TreePath path)
path
- the TreePath
identifying a nodepublic void expandRow(int row)
If row
is < 0 or >= getRowCount, this
will have no effect.
row
- an int specifying a display row, where 0 is the
first row in the displaypublic void expandPath(TreePath path)
path
- the TreePath
identifying a nodepublic void makeVisible(TreePath path)
path
- the TreePath
to make visiblepublic TreePath getClosestPathForLocation(int x, int y)
x
- an int giving the number of pixels horizontally from
the left edge of the display area, minus any left marginy
- an int giving the number of pixels vertically from
the top of the display area, minus any top margin
TreePath
for the node closest to that location;
null if nothing is viewable or there is no modelgetPathForLocation(int, int)
,
getPathBounds(javax.swing.tree.TreePath)
public int getClosestRowForLocation(int x, int y)
x
- an int giving the number of pixels horizontally from
the left edge of the display area, minus any left marginy
- an int giving the number of pixels vertically from
the top of the display area, minus any top margin
getRowForLocation(int, int)
,
getRowBounds(int)
public TreePath getEditingPath()
TreePath
for the node being editedpublic Enumeration getExpandedDescendants(TreePath parent)
path
that
are currently expanded. If path
is not currently
expanded, this will return null. If you expand/collapse nodes while
iterating over the returned Enumeration, this may not return all
the expanded paths, or may return paths that are no longer expanded.
parent
- the path to the parent whose expanded descendants are desired
public com.klg.jclass.util.treetable.JCTreeTableModel getTreeTableModel()
JCTreeTableModel
that is providing the data.
TreeModel
that is providing the datapublic void setTreeTableModel(com.klg.jclass.util.treetable.JCTreeTableModel model)
TreeModel
that will provide the data.
model
- the TreeModel
that is to provide the datapublic Rectangle getPathBounds(TreePath path)
Returns the Rectangle
that the specified node will be drawn
into. Returns null if any component in the path is hidden
(under a collapsed parent).
Note: This method returns a valid rectangle, even if the specified node is not currently displayed.
path
- the TreePath
identifying the node
Rectangle
the node is drawn in, or nullpublic TreePath getPathForLocation(int x, int y)
x
- an int giving the number of pixels horizontally from
the left edge of the display area, minus any left marginy
- an int giving the number of pixels vertically from
the top of the display area, minus any top margin
TreePath
for the node at that locationpublic int getRowForLocation(int x, int y)
x
- an int giving the number of pixels horizontally from
the left edge of the display area, minus any left marginy
- an int giving the number of pixels vertically from
the top of the display area, minus any top margin
getClosestRowForLocation(int, int)
public Rectangle getRowBounds(int row)
Returns the Rectangle
that the node at the specified row is
drawn in.
row
- the row to be drawn, where 0 is the first row in the
display
Rectangle
the node is drawn inpublic int getRowForPath(TreePath path)
path
- the TreePath
identifying a node
public TreePath getPathForRow(int row)
row
- the row whose path is returned
TreePath
displayed at the specified rowpublic boolean getScrollsOnExpand()
true
if the tree scrolls to show previously hidden
children.
true
when a node is expanded, and as many of the
descendants as possible are scrolled to be visiblepublic void setScrollsOnExpand(boolean newValue)
true
.
newValue
- if set to true
, when a node is expanded as many
of the descendants as possible are scrolled to be visiblepublic boolean isRootVisible()
true
if the root node of the tree is displayed.
true
if the root node of the tree is displayedsetRootVisible(boolean)
public void setRootVisible(boolean rootVisible)
TreeModel
is
visible.
rootVisible
- true
if the root node of the tree is to be
displayedisRootVisible()
public boolean getShowsRootHandles()
true
if handles for the root nodes are displayed.
true
if root handles are displayedsetShowsRootHandles(boolean)
public void setShowsRootHandles(boolean newValue)
newValue
- true
if root handles are to be displayedgetShowsRootHandles()
public int[] getRowsForPaths(TreePath[] paths)
paths
- an array of paths for which the corresponding rows are required
public void addSelectionPath(TreePath path)
TreePath
to the
current selection. If any component of the path isn't viewable, it is made
viewable.
path
- the TreePath
specifying the node to add to the
selectionpublic void addSelectionPaths(TreePath[] paths)
paths
- An array of TreePath
objects that specifies the
nodes to add to selectionpublic 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 boolean isPathSelected(TreePath path)
true
if the item identified by the path is currently
selected.
path
- the path to the item whose selection status is required
public TreePath getSelectionPath()
TreePath
for the first selected node, or null if
nothing is currently selectedpublic TreePath[] getSelectionPaths()
TreePath
objects indicating the selected
nodes, or null if nothing is currently selected.public void setTreeTableSelectionModel(com.klg.jclass.swing.JCTreeTableSelectionModel treeSelectionModel)
selectionModel
is used, which does not allow
selections.
treeSelectionModel
- the TreeSelectionModel
to use, or null
to disable selectionsTreeSelectionModel
public com.klg.jclass.swing.JCTreeTableSelectionModel getTreeSelectionModel()
TreeSelectionModel
in useJTable.setSelectionModel(javax.swing.ListSelectionModel)
protected boolean isPointOverSwitch(Point p)
TREE
or TABLE
?".
p
- the point to be tested
protected void toggleView()
TREE
and TABLE
.
protected MouseAdapter createTableHeaderMouseListener()
MouseListener
to the table header.
createTableHeaderMouseListener
in class JCSortableTable
protected void reLayoutColumnRenderers()
reLayoutColumnRenderers
in class JCSortableTable
public TableColumn createSortableTableColumn(int column)
TableColumn
needed. This method was created to
allow subclasses to override, to easily change the default Column created.
createSortableTableColumn
in class JCSortableTable
column
- the column index for which the new table column is to be
created
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |