public class IlvTreeColumn extends IlvAbstractJTableColumn
IlvTreeColumn
is a column definition that can render an
IlvJTree
as a column of an IlvJTable
. Attributes of the
column, such as its width or resizability, can be changed in the usual
manner by changing properties of the TableColumn
returned
by the IlvAbstractJTableColumn.getColumn()
method. For example, to set that the user
cannot resize the column use: anIlvTreeColumn.getColumn().setResizable(false);
You can obtain the IlvJTree
being used to render this column by
calling the getTree()
method. The default row separators of the
tree are disabled because they are superfluous inside a table.
The IlvJTree
that is used to render this column is completely
passive. All user input events are handled by the table and selection
highlighting of rows in the tree is simulated by color changes. The tree
itself does not have any selections and does not track the table's row
selections.
DEFAULT_COLUMN_WIDTH
Constructor and Description |
---|
IlvTreeColumn(Object headerValue)
Constructs a new tree column with the specified value displayed in its
header.
|
IlvTreeColumn(Object headerValue,
IlvJTreeRenderPolicy renderPolicy)
Constructs a new tree column with the specified value displayed in its
header and the tree rendered using the specified policy.
|
IlvTreeColumn(Object headerValue,
IlvJTreeRenderPolicy renderPolicy,
int width)
Constructs a new tree column with the specified value displayed in its
header and the tree rendered using the specified policy.
|
IlvTreeColumn(Object headerValue,
IlvJTreeRenderPolicy renderPolicy,
int width,
Object identifier)
Constructs a new tree column with the specified value displayed in its
header, the tree rendered using the specified policy, a width, and a
column identifier.
|
IlvTreeColumn(Object headerValue,
IlvJTreeRenderPolicy renderPolicy,
Object identifier)
Constructs a new tree column with the specified value displayed in its
header, the tree rendered using the specified policy, and a column
identifier.
|
IlvTreeColumn(Object headerValue,
Object identifier)
Constructs a new tree column with the specified value displayed in its
header, and a column identifier.
|
Modifier and Type | Method and Description |
---|---|
protected TableCellEditor |
createEditor()
Creates the editor that will be used to edit the cells in this column.
|
protected TableCellRenderer |
createRenderer()
Creates the tree renderer that will be used to render the cells in
this column.
|
TreeCellEditor |
getEditor()
Returns the editor that is being used to edit each row in this tree
column or
null if the column should not be editable. |
protected IlvGanttConfiguration |
getGanttConfiguration()
Returns the Gantt configuration that this column is coordinating with.
|
protected IlvGanttModel |
getGanttModel()
Returns the data model currently being displayed by the column.
|
TreeCellRenderer |
getRenderer()
Returns the renderer that is being used to display each row in this
tree column.
|
IlvJTreeRenderPolicy |
getRenderPolicy()
Returns the policy for rendering and editing rows displayed in this
tree column.
|
int |
getRowHeight()
Returns the height of each row in the tree.
|
IlvJTree |
getTree()
Returns the tree that is rendering this column.
|
Object |
getValue(IlvHierarchyNode row)
Returns
row as the value displayed at the cell
intersection of this column and the specified row. |
String |
getValueAsText(IlvHierarchyNode row)
Returns the text value that is displayed at the cell intersection of
this column and the specified row.
|
boolean |
isEditable(IlvHierarchyNode row)
Returns whether the cell at the intersection of this column and the
specified row is editable.
|
boolean |
isRootExpandIconVisible()
Returns whether the root row's expand/collapse icon is visible.
|
void |
setGanttConfiguration(IlvGanttConfiguration ganttConfig)
Invoked whenever this column is added to or removed from the Gantt
configuration.
|
void |
setRenderPolicy(IlvJTreeRenderPolicy policy)
Sets the rendering and editing policy for rows displayed in this tree
column.
|
void |
setRootExpandIconVisible(boolean visible)
Sets whether the root row's expand/collapse icon is visible.
|
void |
setRowHeight(int rowHeight)
Sets the height of each row in the tree.
|
void |
setValue(IlvHierarchyNode row,
Object value)
Sets the value of the data model at the cell intersection of this
column and the specified row.
|
void |
updateUI()
This method is a notification that the L&F has changed.
|
cellUpdated, columnHeaderUpdated, columnUpdated, getColumn, getColumnIndex, getModelIndex, getTable, setTable
public IlvTreeColumn(Object headerValue)
headerValue
- The value rendered in the column header.public IlvTreeColumn(Object headerValue, Object identifier)
headerValue
- The value rendered in the column header.identifier
- The column identifier.public IlvTreeColumn(Object headerValue, IlvJTreeRenderPolicy renderPolicy)
headerValue
- The value rendered in the column header.renderPolicy
- The rendering policy for the tree.public IlvTreeColumn(Object headerValue, IlvJTreeRenderPolicy renderPolicy, Object identifier)
headerValue
- The value rendered in the column header.renderPolicy
- The rendering policy for the tree.identifier
- The column identifier.public IlvTreeColumn(Object headerValue, IlvJTreeRenderPolicy renderPolicy, int width)
width
parameter is used to set both the preferred and
initial width of the column. Note that in this case, the column
identifier, if not set, will be the header value.headerValue
- The value rendered in the column header.renderPolicy
- The rendering policy for the tree.width
- The width of the column.public IlvTreeColumn(Object headerValue, IlvJTreeRenderPolicy renderPolicy, int width, Object identifier)
width
parameter is used to set
both the preferred and initial width of the column.headerValue
- The value rendered in the column header.renderPolicy
- The rendering policy for the tree.width
- The width of the column.identifier
- The column identifier.protected final TableCellRenderer createRenderer()
IlvJTree
that is configured with this column's
rendering policy
. This IlvJTree
subclass to behaves as a TableCellRenderer
.createRenderer
in class IlvAbstractJTableColumn
IlvDefaultTableCellRenderer
as the default
table cell renderer.protected final TableCellEditor createEditor()
rendering policy editor
. The
lightweight proxy makes the TreeCellEditor
of the
rendering policy behave as a TableCellEditor
.
When editing of a cell begins, the editor's
getTableCellEditorComponent
method will be passed the
value returned by the column's getValue(ilog.views.gantt.IlvHierarchyNode)
method.
When editing is completed, the value returned by the
editor's getCellEditorValue
method will be passed to
the column's setValue(ilog.views.gantt.IlvHierarchyNode, java.lang.Object)
method.
createEditor
in class IlvAbstractJTableColumn
null
, as the default table cell editor.public IlvJTree getTree()
protected final IlvGanttConfiguration getGanttConfiguration()
public void setGanttConfiguration(IlvGanttConfiguration ganttConfig)
Warning: This method is considered to be part of an
IlvJTableColumn
's internal implementation and is not a
public API. Only the IlvJTable
should invoke this
method.
setGanttConfiguration
in interface IlvJTableColumn
setGanttConfiguration
in class IlvAbstractJTableColumn
ganttConfig
- The Gantt configuration that this column is being
added to, or null
if this column is being
removed from its Gantt configuration.protected final IlvGanttModel getGanttModel()
public IlvJTreeRenderPolicy getRenderPolicy()
public void setRenderPolicy(IlvJTreeRenderPolicy policy)
null
, the tree's default rendering
and editing policy will be used.public TreeCellRenderer getRenderer()
DefaultTreeCellRenderer
class. Attributes of the
returned renderer can be modified to affect the display of this
column. For example, to change the icon for leaf rows you can use:
IlvTreeColumn treeColumn = anIlvJTable.getTreeColumn(...); TreeCellRenderer treeRenderer = treeColumn.getRenderer(); if (renderer instanceof DefaultTreeCellRenderer) ((DefaultTreeCellRenderer)renderer).setLeafIcon(...);In order to replace the tree renderer entirely, you must create a new
IlvJTreeRenderPolicy
and call the
setRenderPolicy
method.public TreeCellEditor getEditor()
null
if the column should not be editable.
Typically, the editor will be an instance of
IlvTextFieldTreeEditor
. In order to replace the tree editor,
you must create a new IlvJTreeRenderPolicy
and call the
setRenderPolicy
method.public String getValueAsText(IlvHierarchyNode row)
row
will match the row organization of the Gantt
configuration of which the table is a member. In other words, if the
Gantt configuration's
row type is
ACTIVITY_ROWS
, then
row
will be an IlvActivity
. Otherwise, the
Gantt configuration's
row type is
RESOURCE_ROWS
and
row
will be an IlvResource
.getValueAsText
in interface IlvJTableColumn
getValueAsText
in class IlvAbstractJTableColumn
row
- The row.String
.getValue(ilog.views.gantt.IlvHierarchyNode)
public Object getValue(IlvHierarchyNode row)
row
as the value displayed at the cell
intersection of this column and the specified row. The returned row
will be passed to the
TableCellRenderer.getTableCellRendererComponent
method
to render the cell and will be passed to the
TableCellEditor.getTableCellEditorComponent
method when
editing of the cell begins.
The type of the specified row
will match the row
organization of the Gantt configuration of which the table is a
member. In other words, if the Gantt configuration's
row type is
ACTIVITY_ROWS
, then
row
will be an IlvActivity
. Otherwise, the
Gantt configuration's
row type is
RESOURCE_ROWS
and
row
will be an IlvResource
.
getValue
in interface IlvJTableColumn
getValue
in class IlvAbstractJTableColumn
row
- The row.setValue(ilog.views.gantt.IlvHierarchyNode, java.lang.Object)
,
createRenderer()
,
createEditor()
public void setValue(IlvHierarchyNode row, Object value)
value
will be the
result returned by the TableCellEditor.getCellEditorValue
method.
The type of the specified row
will match the row
organization of the Gantt configuration of which the table is a
member. In other words, if the Gantt configuration's
row type is
ACTIVITY_ROWS
, then
row
will be an IlvActivity
. Otherwise, the
Gantt configuration's
row type is
RESOURCE_ROWS
and
row
will be an IlvResource
.
setValue
in interface IlvJTableColumn
setValue
in class IlvAbstractJTableColumn
row
- The row.value
- The new value.getValue(ilog.views.gantt.IlvHierarchyNode)
,
createEditor()
public boolean isEditable(IlvHierarchyNode row)
rendering policy
.isEditable
in interface IlvJTableColumn
isEditable
in class IlvAbstractJTableColumn
row
- The row.true
if the cell is editable, false
otherwise.setRenderPolicy(ilog.views.gantt.swing.IlvJTreeRenderPolicy)
public int getRowHeight()
public void setRowHeight(int rowHeight)
public boolean isRootExpandIconVisible()
setRootExpandIconVisible(boolean)
public void setRootExpandIconVisible(boolean visible)
This setting has only an effect while the root row is visible.
public void updateUI()
updateUI
in interface IlvJTableColumn
updateUI
in class IlvAbstractJTableColumn
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.