|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTable
org.jdesktop.swingx.JXTable
org.jdesktop.swingx.JXTreeTable
public class JXTreeTable
JXTreeTable
is a specialized table
consisting of a single column in which to display hierarchical data, and any
number of other columns in which to display regular data. The interface for
the data model used by a JXTreeTable
is
TreeTableModel
. It extends the
TreeModel
interface to allow access to cell data by
column indices within each node of the tree hierarchy.
The most straightforward way create and use a JXTreeTable
, is to
first create a suitable data model for it, and pass that to a
JXTreeTable
constructor, as shown below:
TreeTableModel treeTableModel = new FileSystemModel(); // any TreeTableModel JXTreeTable treeTable = new JXTreeTable(treeTableModel); JScrollPane scrollpane = new JScrollPane(treeTable);See
JTable
for an explanation of why putting the treetable
inside a scroll pane is necessary.
A single treetable model instance may be shared among more than one
JXTreeTable
instances. To access the treetable model, always call
getTreeTableModel
and
setTreeTableModel
.
JXTreeTable
wraps the supplied treetable model inside a private
adapter class to adapt it to a TableModel
. Although
the model adapter is accessible through the getModel
method, you
should avoid accessing and manipulating it in any way. In particular, each
model adapter instance is tightly bound to a single table instance, and any
attempt to share it with another table (for example, by calling
setModel
)
will throw an IllegalArgumentException
!
Nested Class Summary | |
---|---|
protected static class |
JXTreeTable.TreeTableDataAdapter
|
class |
JXTreeTable.TreeTableHacker
Temporary class to have all the hacking at one place. |
class |
JXTreeTable.TreeTableHackerExt
Note: currently this class looks a bit funny (only overriding the hit decision method). |
class |
JXTreeTable.TreeTableHackerExt2
Patch for #471-swingx: no selection on click in hierarchical column outside of node-text. |
protected static class |
JXTreeTable.TreeTableModelAdapter
|
Nested classes/interfaces inherited from class org.jdesktop.swingx.JXTable |
---|
JXTable.BooleanEditor, JXTable.GenericEditor, JXTable.NumberEditor, JXTable.TableAdapter |
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
JTable.AccessibleJTable, JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
DRAG_HACK_FLAG_KEY
Key for clientProperty to decide whether to apply hack around #168-jdnc. |
static String |
DROP_HACK_FLAG_KEY
Key for clientProperty to decide whether to apply hack around #766-swingx. |
Fields inherited from class org.jdesktop.swingx.JXTable |
---|
compoundHighlighter, dataAdapter, editorRemover, filters, FOCUS_NEXT_COMPONENT, FOCUS_PREVIOUS_COMPONENT, HORIZONTALSCROLL_ACTION_COMMAND, isXTableRowHeightSet, MATCH_HIGHLIGHTER, PACKALL_ACTION_COMMAND, PACKSELECTED_ACTION_COMMAND, resetDefaultTableCellRendererHighlighter, searchable, selectionMapper, UIPREFIX, USE_DTCR_COLORMEMORY_HACK |
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 | |
---|---|
JXTreeTable()
Constructs a JXTreeTable using a DefaultTreeTableModel . |
|
JXTreeTable(TreeTableModel treeModel)
Constructs a JXTreeTable using the specified TreeTableModel . |
Method Summary | |
---|---|
void |
addTreeExpansionListener(TreeExpansionListener tel)
Adds a listener for TreeExpansion events. |
void |
addTreeSelectionListener(TreeSelectionListener tsl)
Adds a listener for TreeSelection events. |
void |
addTreeWillExpandListener(TreeWillExpandListener tel)
Adds a listener for TreeWillExpand events. |
protected void |
adjustTableRowHeight(int treeRowHeight)
Forwards treeRowHeight to table. |
protected void |
adjustTreeRowHeight(int tableRowHeight)
Forwards tableRowHeight to tree. |
protected Component |
applyRenderer(Component component,
ComponentAdapter adapter)
Performs configuration of the tree's renderer if the adapter's column is the hierarchical column, does nothing otherwise. |
void |
clearSelection()
Overridden to ensure that private renderer state is kept in sync with the state of the component. |
void |
collapseAll()
Collapses all nodes in the treetable. |
void |
collapsePath(TreePath path)
Collapses the node at the specified path in the treetable. |
void |
collapseRow(int row)
Collapses the row in the treetable. |
protected SelectionMapper |
createSelectionMapper()
Fix for #745-swingx: remove static selectionMaper. |
protected JXTreeTable.TreeTableHacker |
createTreeTableHacker()
|
boolean |
editCellAt(int row,
int column,
EventObject e)
Overriden to invoke repaint for the particular location if the column contains the tree. |
void |
expandAll()
Expands all nodes in the treetable. |
void |
expandPath(TreePath path)
Expands the the node at the specified path in the treetable. |
void |
expandRow(int row)
Expands the specified row in the treetable. |
TableCellEditor |
getCellEditor(int row,
int column)
Returns an appropriate editor for the cell specified by row and column . |
TableCellRenderer |
getCellRenderer(int row,
int column)
Returns an appropriate renderer for the cell specified by this row and column. |
protected ComponentAdapter |
getComponentAdapter()
Returns the adapter that knows how to access the component data model. |
int |
getEditingRow()
Overridden to provide a workaround for BasicTableUI anomaly. |
Enumeration<?> |
getExpandedDescendants(TreePath parent)
Returns an Enumeration of the descendants of the
path parent that
are currently expanded. |
boolean |
getExpandsSelectedPaths()
Returns the value of the expandsSelectedPaths property. |
int |
getHierarchicalColumn()
Returns the index of the hierarchical column. |
TreePath |
getPathForLocation(int x,
int y)
Returns the TreePath for a given x,y location. |
TreePath |
getPathForRow(int row)
Returns the TreePath for a given row. |
int |
getRowForPath(TreePath path)
Returns the row for a given TreePath. |
boolean |
getScrollsOnExpand()
Returns the value of the scrollsOnExpand property. |
SelectionMapper |
getSelectionMapper()
Overridden to return a do-nothing mapper. |
boolean |
getShowsRootHandles()
Returns the value of the showsRootHandles property. |
String |
getStringAt(int row,
int column)
Returns the string representation of the cell value at the given position. |
int |
getToggleClickCount()
Returns the number of mouse clicks needed to expand or close a node. |
String |
getToolTipText(MouseEvent event)
Overrides JComponent 's getToolTipText
method in order to allow the renderer's tips to be used
if it has text set. |
TreeCellRenderer |
getTreeCellRenderer()
|
TreeSelectionModel |
getTreeSelectionModel()
Returns the selection model for the tree portion of the this treetable. |
protected JXTreeTable.TreeTableHacker |
getTreeTableHacker()
|
TreeTableModel |
getTreeTableModel()
Returns the underlying TreeTableModel for this JXTreeTable. |
protected boolean |
hackAroundDragEnabled(MouseEvent me)
decides whether we want to apply the hack for #168-jdnc. |
boolean |
isCollapsed(int row)
Returns true if the node at the specified display row is collapsed. |
boolean |
isCollapsed(TreePath path)
Returns true if the node identified by path is currently collapsed, this will return false if any of the values in path are currently not being displayed. |
boolean |
isExpanded(int row)
Returns true if the node at the specified display row is currently expanded. |
boolean |
isExpanded(TreePath path)
Returns true if the node identified by path is currently expanded. |
boolean |
isHierarchical(int column)
Determines if the specified column is defined as the hierarchical column. |
boolean |
isLargeModel()
Returns true if the tree is configured for a large model. |
boolean |
isOverwriteRendererIcons()
Returns a boolean indicating whether the per-tree icons should be copied to the renderer on setTreeCellRenderer. |
boolean |
isRootVisible()
Returns true if the root node of the tree is displayed. |
boolean |
isVisible(TreePath path)
Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded. |
Component |
prepareRenderer(TableCellRenderer renderer,
int row,
int column)
Returns the decorated Component used as a stamp to render
the specified cell. |
protected void |
processMouseEvent(MouseEvent e)
Overridden to enable hit handle detection a mouseEvent which triggered a expand/collapse. |
void |
removeTreeExpansionListener(TreeExpansionListener tel)
Removes a listener for TreeExpansion events. |
void |
removeTreeSelectionListener(TreeSelectionListener tsl)
Removes a listener for TreeSelection events. |
void |
removeTreeWillExpandListener(TreeWillExpandListener tel)
Removes a listener for TreeWillExpand events. |
void |
scrollPathToVisible(TreePath path)
Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed. |
void |
setClosedIcon(Icon icon)
Sets the specified icon as the icon to use for rendering closed container nodes. |
void |
setCollapsedIcon(Icon icon)
Sets the specified icon as the icon to use for rendering collapsed nodes. |
void |
setEnabled(boolean enabled)
Sets whether or not this component is enabled. |
void |
setExpandedIcon(Icon icon)
Sets the specified icon as the icon to use for rendering expanded nodes. |
void |
setExpandsSelectedPaths(boolean expand)
Sets the value of the expandsSelectedPaths property for the tree
part. |
void |
setFilters(FilterPipeline pipeline)
overridden to do nothing. |
void |
setLargeModel(boolean newValue)
Specifies whether the UI should use a large model. |
void |
setLeafIcon(Icon icon)
Sets the specified icon as the icon to use for rendering leaf nodes. |
void |
setModel(TableModel tableModel)
Overrides superclass version to make sure that the specified TableModel is compatible with JXTreeTable before
invoking the inherited version. |
void |
setOpenIcon(Icon icon)
Sets the specified icon as the icon to use for rendering open container nodes. |
void |
setOverwriteRendererIcons(boolean overwrite)
Property to control whether per-tree icons should be copied to the renderer on setTreeCellRenderer. |
void |
setRootVisible(boolean visible)
Determines whether or not the root node from the TreeModel is visible. |
void |
setRowHeight(int rowHeight)
Sets the row height for this JXTreeTable and forwards the row height to the renderering tree. |
void |
setRowHeight(int row,
int rowHeight)
Throws UnsupportedOperationException because variable height rows are not supported. |
void |
setScrollsOnExpand(boolean scroll)
Sets the value of the scrollsOnExpand property for the tree
part. |
void |
setSelectionBackground(Color selectionBackground)
Sets the background color for selected cells. |
void |
setSelectionForeground(Color selectionForeground)
Sets the foreground color for selected cells. |
void |
setSelectionMode(int mode)
Overridden to ensure that private renderer state is kept in sync with the state of the component. |
void |
setShowsRootHandles(boolean visible)
Sets the value of the showsRootHandles property for the tree
part. |
void |
setSortable(boolean sortable)
overridden to do nothing. |
void |
setToggleClickCount(int clickCount)
Sets the number of mouse clicks before a node will expand or close. |
void |
setTreeCellRenderer(TreeCellRenderer cellRenderer)
Sets the specified TreeCellRenderer as the Tree cell renderer. |
void |
setTreeTableModel(TreeTableModel treeModel)
Sets the data model for this JXTreeTable to the specified TreeTableModel . |
void |
sizeColumnsToFit(int resizingColumn)
Overriden to invoke supers implementation, and then, if the receiver is editing a Tree column, the editors bounds is reset. |
void |
tableChanged(TableModelEvent e)
additionally updates filtered state. |
protected void |
updateHierarchicalRendererEditor()
Updates Ui of renderer/editor for the hierarchical column. |
void |
updateUI()
Notification from the UIManager that the L&F has changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.swing.event.TableColumnModelListener |
---|
columnAdded, columnMoved |
Field Detail |
---|
public static final String DRAG_HACK_FLAG_KEY
public static final String DROP_HACK_FLAG_KEY
Constructor Detail |
---|
public JXTreeTable()
DefaultTreeTableModel
.
public JXTreeTable(TreeTableModel treeModel)
TreeTableModel
.
treeModel
- model for the JXTreeTableMethod Detail |
---|
public void setSortable(boolean sortable)
setSortable
in class JXTable
sortable
- boolean indicating whether or not this table supports
sortable columnsTableColumnExt.isSortable()
public void setFilters(FilterPipeline pipeline)
setFilters
in class JXTable
pipeline
- the FilterPipeline
to use, null removes all
filters.public void setEnabled(boolean enabled)
Note: Disabling a component does not disable it's children.
Note: Disabling a lightweight component does not prevent it from receiving MouseEvents.
Overridden to keep the tree's enabled in synch.
setEnabled
in class JComponent
enabled
- true if this component should be enabled, false otherwiseComponent.isEnabled()
,
Component.isLightweight()
public void setSelectionBackground(Color selectionBackground)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
Overridden because super throws NPE on null param.
Overridden to keep the tree's selectionBackground in synch.
setSelectionBackground
in class JXTable
selectionBackground
- the Color
to use for the background
of selected cellsJTable.getSelectionBackground()
,
JTable.setSelectionForeground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
JComponent.setFont(java.awt.Font)
public void setSelectionForeground(Color selectionForeground)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
Overridden because super throws NPE on null param.
Overridden to keep the tree's selectionForeground in synch.
setSelectionForeground
in class JXTable
selectionForeground
- the Color
to use in the foreground
for selected list itemsJTable.getSelectionForeground()
,
JTable.setSelectionBackground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
JComponent.setFont(java.awt.Font)
public boolean editCellAt(int row, int column, EventObject e)
Additionally, there is tricksery involved to expand/collapse
the nodes.
Programmatically starts editing the cell at row
and
column
, if those indices are in the valid range, and
the cell at those indices is editable.
To prevent the JTable
from
editing a particular table, column or cell value, return false from
the isCellEditable
method in the TableModel
interface.
overridden to install a custom editor remover.
editCellAt
in class JXTable
row
- the row to be editedcolumn
- the column to be editede
- event to pass into shouldSelectCell
;
note that as of Java 2 platform v1.2, the call to
shouldSelectCell
is no longer made
protected void processMouseEvent(MouseEvent e)
processMouseEvent
in class JComponent
e
- the mouse eventComponent.processMouseEvent(java.awt.event.MouseEvent)
protected JXTreeTable.TreeTableHacker getTreeTableHacker()
protected JXTreeTable.TreeTableHacker createTreeTableHacker()
protected boolean hackAroundDragEnabled(MouseEvent me)
me
- the mouseEvent that triggered a editCellAt
public int getEditingRow()
getEditingRow
in class JTable
JTable.editingColumn
public void setTreeTableModel(TreeTableModel treeModel)
TreeTableModel
. The same data model
may be shared by any number of JXTreeTable instances.
treeModel
- data model for this JXTreeTablepublic TreeTableModel getTreeTableModel()
public final void setModel(TableModel tableModel)
Overrides superclass version to make sure that the specified
TableModel
is compatible with JXTreeTable before
invoking the inherited version.
Because JXTreeTable internally adapts an
TreeTableModel
to make it a compatible
TableModel, this method should never be called directly. Use
setTreeTableModel
instead.
While it is possible to obtain a reference to this adapted
version of the TableModel by calling JTable.getModel()
,
any attempt to call setModel() with that adapter will fail because
the adapter might have been bound to a different JXTreeTable instance. If
you want to extract the underlying TreeTableModel, which, by the way,
can be shared, use getTreeTableModel
instead
setModel
in class JXTable
tableModel
- must be a TreeTableModelAdapter
IllegalArgumentException
- if the specified tableModel is not an
instance of TreeTableModelAdapterJTable.getModel()
public void tableChanged(TableModelEvent e)
JXTable
TableModel
generates
a TableModelEvent
.
The TableModelEvent
should be constructed in the
coordinate system of the model; the appropriate mapping to the
view coordinate system is performed by this JTable
when it receives the event.
Application code will not use these methods explicitly, they
are used internally by JTable
.
Note that as of 1.3, this method clears the selection, if any.
tableChanged
in interface TableModelListener
tableChanged
in class JXTable
public SelectionMapper getSelectionMapper()
getSelectionMapper
in class JXTable
SelectionMapper
protected SelectionMapper createSelectionMapper()
public final void setRowHeight(int row, int rowHeight)
setRowHeight
in class JXTable
row
- ignoredrowHeight
- ignored
UnsupportedOperationException
- because variable height rows are
not supportedJXTable.isRowHeightEnabled()
public void setRowHeight(int rowHeight)
setRowHeight
in class JXTable
rowHeight
- height of a row.JXTable.isXTableRowHeightSet
protected void adjustTreeRowHeight(int tableRowHeight)
tableRowHeight
- height of a row.protected void adjustTableRowHeight(int treeRowHeight)
treeRowHeight
- height of a row.public void setSelectionMode(int mode)
Overridden to ensure that private renderer state is kept in sync with the state of the component. Calls the inherited version after performing the necessary synchronization. If you override this method, make sure you call this version from your version of this method.
This version maps the selection mode used by the renderer to match the selection mode specified for the table. Specifically, the modes are mapped as follows:
ListSelectionModel.SINGLE_INTERVAL_SELECTION: TreeSelectionModel.CONTIGUOUS_TREE_SELECTION; ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION; any other (default): TreeSelectionModel.SINGLE_TREE_SELECTION;Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.
JTable
provides all the methods for handling
column and row selection. When setting states,
such as setSelectionMode
, it not only
updates the mode for the row selection model but also sets similar
values in the selection model of the columnModel
.
If you want to have the row and column selection models operating
in different modes, set them both directly.
Both the row and column selection models for JTable
default to using a DefaultListSelectionModel
so that JTable
works the same way as the
JList
. See the setSelectionMode
method
in JList
for details about the modes.
setSelectionMode
in class JTable
mode
- any of the table selection modesJList.setSelectionMode(int)
public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
Component
used as a stamp to render
the specified cell. Overrides superclass version to provide support for
cell decorators.
Adjusts component orientation (guaranteed to happen before applying Highlighters).
Per-column highlighters contained in
TableColumnExt.getHighlighters()
are applied to the renderer
after the table highlighters.
TODO kgs: interaction of search highlighter and column highlighters
Note: DefaultTableCellRenderer and subclasses require a hack to play
nicely with Highlighters because it has an internal "color memory" in
setForeground/setBackground. The hack is applied in
resetDefaultTableCellRendererColors
which is called after
super.prepareRenderer and before applying the Highlighters. The method is
called always and for all renderers.
Overridden to decorate the tree's renderer after calling super. At that point, it is only the tree itself that has been decorated.
prepareRenderer
in class JXTable
renderer
- the TableCellRenderer
to preparerow
- the row of the cell to render, where 0 is the first rowcolumn
- the column of the cell to render, where 0 is the first column
Component
used as a stamp to render the specified cellapplyRenderer(Component, ComponentAdapter)
protected Component applyRenderer(Component component, ComponentAdapter adapter)
Note: this is legacy glue if the treeCellRenderer is of type DefaultTreeCellRenderer. In that case the renderer's background/foreground/Non/Selection colors are set to the tree's background/foreground depending on the adapter's selection state. Does nothing if the treeCellRenderer is backed by a ComponentProvider.
component
- the rendering componentadapter
- component data adapter
NullPointerException
- if the specified component or adapter is
nullpublic void setTreeCellRenderer(TreeCellRenderer cellRenderer)
cellRenderer
- to use for rendering tree cells.public TreeCellRenderer getTreeCellRenderer()
public String getToolTipText(MouseEvent event)
javax.swing.JTable
JComponent
's getToolTipText
method in order to allow the renderer's tips to be used
if it has text set.
JTable
to properly display
tooltips of its renderers
JTable
must be a registered component with the
ToolTipManager
.
This is done automatically in initializeLocalVars
,
but if at a later point JTable
is told
setToolTipText(null)
it will unregister the table
component, and no tips from renderers will display anymore.
getToolTipText
in class JTable
JComponent.getToolTipText()
public void setCollapsedIcon(Icon icon)
icon
- to use for rendering collapsed nodesJXTree.setCollapsedIcon(Icon)
public void setExpandedIcon(Icon icon)
icon
- to use for rendering expanded nodesJXTree.setExpandedIcon(Icon)
public void setOpenIcon(Icon icon)
icon
- to use for rendering open nodesJXTree.setOpenIcon(Icon)
public void setClosedIcon(Icon icon)
icon
- to use for rendering closed nodesJXTree.setClosedIcon(Icon)
public void setLeafIcon(Icon icon)
icon
- to use for rendering leaf nodesJXTree.setLeafIcon(Icon)
public void setOverwriteRendererIcons(boolean overwrite)
The default value is false.
overwrite
- a boolean to indicate if the per-tree Icons should
be copied to the new renderer on setTreeCellRenderer.isOverwriteRendererIcons()
,
setLeafIcon(Icon)
,
setOpenIcon(Icon)
,
setClosedIcon(Icon)
,
JXTree.setOverwriteRendererIcons(boolean)
public boolean isOverwriteRendererIcons()
setOverwriteRendererIcons(boolean)
,
setLeafIcon(Icon)
,
setOpenIcon(Icon)
,
setClosedIcon(Icon)
,
JXTree.isOverwriteRendererIcons()
public void clearSelection()
clearSelection
in class JTable
public void collapseAll()
public void expandAll()
public void collapsePath(TreePath path)
path
- path of the node to collapsepublic void expandPath(TreePath path)
path
- path of the node to expandpublic void scrollPathToVisible(TreePath path)
JTree
is contained in a JScrollPane
.
(doc copied from JTree)
PENDING: JW - where exactly do we want to scroll? Here: the scroll
is in vertical direction only. Might need to show the tree column?
path
- the TreePath
identifying the node to
bring into viewpublic void collapseRow(int row)
public void expandRow(int row)
public boolean isVisible(TreePath path)
public boolean isExpanded(TreePath path)
path
- path
public boolean isExpanded(int row)
row
- row
public boolean isCollapsed(TreePath path)
path
- path
public boolean isCollapsed(int row)
row
- row
public Enumeration<?> getExpandedDescendants(TreePath parent)
Enumeration
of the descendants of the
path parent
that
are currently expanded. If parent
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 which is to be examined
Enumeration
of the descendents of
parent
, or null
if
parent
is not currently expandedpublic TreePath getPathForLocation(int x, int y)
x
- x valuey
- y value
TreePath
for the givern location.public TreePath getPathForRow(int row)
row
-
TreePath
for the given row.public int getRowForPath(TreePath path)
path
-
TreePath
.public void setRootVisible(boolean visible)
visible
- true, if the root node is visible; false, otherwisepublic boolean isRootVisible()
public void setScrollsOnExpand(boolean scroll)
scrollsOnExpand
property for the tree
part. This property specifies whether the expanded paths should be scrolled
into view. In a look and feel in which a tree might not need to scroll
when expanded, this property may be ignored.
scroll
- true, if expanded paths should be scrolled into view;
false, otherwisepublic boolean getScrollsOnExpand()
scrollsOnExpand
property.
scrollsOnExpand
propertypublic void setShowsRootHandles(boolean visible)
showsRootHandles
property for the tree
part. This property specifies whether the node handles should be displayed.
If handles are not supported by a particular look and feel, this property
may be ignored.
visible
- true, if root handles should be shown; false, otherwisepublic boolean getShowsRootHandles()
showsRootHandles
property.
showsRootHandles
propertypublic void setExpandsSelectedPaths(boolean expand)
expandsSelectedPaths
property for the tree
part. This property specifies whether the selected paths should be expanded.
expand
- true, if selected paths should be expanded; false, otherwisepublic boolean getExpandsSelectedPaths()
expandsSelectedPaths
property.
expandsSelectedPaths
propertypublic int getToggleClickCount()
public void setToggleClickCount(int clickCount)
clickCount
- the number of clicks required to expand/collapse a node.public boolean isLargeModel()
setLargeModel(boolean)
public void setLargeModel(boolean newValue)
NOTE: this method is exposed for completeness - currently it's not recommended to use a large model because there are some issues (not yet fully understood), namely issue #25-swingx, and probably #270-swingx.
newValue
- true to suggest a large model to the UIpublic void addTreeExpansionListener(TreeExpansionListener tel)
TreeExpansion
events.
TODO (JW): redirect event source to this.
tel
- a TreeExpansionListener that will be notified
when a tree node is expanded or collapsedpublic void removeTreeExpansionListener(TreeExpansionListener tel)
TreeExpansion
events.
tel
- the TreeExpansionListener
to removepublic void addTreeSelectionListener(TreeSelectionListener tsl)
TreeSelection
events.
TODO (JW): redirect event source to this.
tsl
- a TreeSelectionListener that will be notified
when a tree node is selected or deselectedpublic void removeTreeSelectionListener(TreeSelectionListener tsl)
TreeSelection
events.
tsl
- the TreeSelectionListener
to removepublic void addTreeWillExpandListener(TreeWillExpandListener tel)
TreeWillExpand
events.
TODO (JW): redirect event source to this.
tel
- a TreeWillExpandListener that will be notified
when a tree node will be expanded or collapsedpublic void removeTreeWillExpandListener(TreeWillExpandListener tel)
TreeWillExpand
events.
tel
- the TreeWillExpandListener
to removepublic TreeSelectionModel getTreeSelectionModel()
public void sizeColumnsToFit(int resizingColumn)
getEditingRow
returns
-1, and therefore doesn't automaticly resize the editor for us.
sizeColumnsToFit
in class JTable
resizingColumn
- the column whose resizing made this adjustment
necessary or -1 if there is no such columnJTable.doLayout()
public boolean isHierarchical(int column)
column
- zero-based index of the column in view coordinates
IllegalArgumentException
- if the column is less than 0 or greater than or equal to the
column countpublic int getHierarchicalColumn()
public TableCellRenderer getCellRenderer(int row, int column)
TableColumn
for this column has a non-null
renderer, returns that. If not, finds the class of the data in
this column (using getColumnClass
)
and returns the default renderer for this type of data.
Note: Throughout the table package, the internal implementations always use this method to provide renderers so that this default behavior can be safely overridden by a subclass.
Overridden to fix core bug #4614616 (NPE if TableModel
's
Class
for the column is an interface). This method
guarantees to always return a not null
value. Returns the
default renderer for Object
if super returns
null
.
getCellRenderer
in class JXTable
row
- the row of the cell to render, where 0 is the first rowcolumn
- the column of the cell to render,
where 0 is the first column
null
returns the default renderer
for this type of objectDefaultTableCellRenderer
,
TableColumn.setCellRenderer(javax.swing.table.TableCellRenderer)
,
JTable.setDefaultRenderer(java.lang.Class>, javax.swing.table.TableCellRenderer)
public TableCellEditor getCellEditor(int row, int column)
row
and column
. If the
TableColumn
for this column has a non-null editor,
returns that. If not, finds the class of the data in this
column (using getColumnClass
)
and returns the default editor for this type of data.
Note: Throughout the table package, the internal implementations always use this method to provide editors so that this default behavior can be safely overridden by a subclass.
getCellEditor
in class JTable
row
- the row of the cell to edit, where 0 is the first rowcolumn
- the column of the cell to edit,
where 0 is the first column
null
return the default editor for
this type of cellDefaultCellEditor
public void updateUI()
JXTable
UIManager
that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager
.
Additionally updates auto-adjusted row height and highlighters.
Another of the override motivation is to fix core issue (?? ID): super fails to update all renderers/editors.
updateUI
in class JXTable
JComponent.updateUI()
protected void updateHierarchicalRendererEditor()
public String getStringAt(int row, int column)
Overridden to message the tree directly if the column is the view index of the hierarchical column.
PENDING JW: revisit once we switch to really using a table renderer. As is, it's a quick fix for #821-swingx: string rep for hierarchical column incorrect.
getStringAt
in class JXTable
row
- the row index of the cell in view coordinatescolumn
- the column index of the cell in view coordinates.
protected ComponentAdapter getComponentAdapter()
getComponentAdapter
in class JXTable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |