public abstract class IlvAbstractJTableColumn extends Object implements IlvJTableColumn
IlvAbstractJTableColumn
is the superclass of
all table column implementations that can be used with an
IlvJTable
. By default, the cells in the column are not
editable. To enable editing of cells, you should override the
isEditable
and createEditor
methods.DEFAULT_COLUMN_WIDTH
Constructor and Description |
---|
IlvAbstractJTableColumn()
Constructs a new column with a default header value and a default
width of 75.
|
IlvAbstractJTableColumn(Object headerValue)
Constructs a new column with the specified value displayed in its
header and a default width of 75.
|
IlvAbstractJTableColumn(Object headerValue,
int width)
Constructs a new column with the specified value displayed in its
header and the specified width.
|
IlvAbstractJTableColumn(Object headerValue,
int width,
Object identifier)
Constructs a new column with the specified value displayed in its
header, the specified width, and an identifier.
|
IlvAbstractJTableColumn(Object headerValue,
Object identifier)
Constructs a new column with the specified value displayed in its
header, a default width of 75, and an identifier.
|
Modifier and Type | Method and Description |
---|---|
void |
cellUpdated(IlvHierarchyNode row)
Invoke this method to notify the table that the representation of the
cell at the intersection of this column and the specified row has
changed.
|
void |
columnHeaderUpdated()
Invoke this method to notify the table that the representation of this
column header has changed.
|
void |
columnUpdated()
Invoke this method to notify the table that the representation of this
column has changed.
|
protected TableCellEditor |
createEditor()
Creates the editor that will be used to edit the cells in this column.
|
protected TableCellRenderer |
createRenderer()
Creates the renderer that will be used to render the cells in this
column.
|
TableColumn |
getColumn()
Returns the
TableColumn that controls the visual
appearance of this column. |
int |
getColumnIndex()
Returns the column display index in the view, or -1 if the column has
not been added to a table.
|
int |
getModelIndex()
Returns the column index within the table's data model, or -1 if the
column has not been added to a table.
|
IlvJTable |
getTable()
Returns the table that this column is a member of, or
null if this column has not been added to a table. |
abstract Object |
getValue(IlvHierarchyNode row)
Returns the value that is 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.
|
void |
setGanttConfiguration(IlvGanttConfiguration ganttConfig)
This method is invoked whenever this column is added to or removed
from the Gantt configuration.
|
void |
setTable(IlvJTable table)
This method is invoked whenever this column is added to or removed
from its
IlvJTable . |
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.
|
public IlvAbstractJTableColumn()
public IlvAbstractJTableColumn(Object headerValue)
headerValue
- The value rendered in the column header.public IlvAbstractJTableColumn(Object headerValue, Object identifier)
headerValue
- The value rendered in the column header.identifier
- The column identifier.public IlvAbstractJTableColumn(Object headerValue, 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.width
- The width of the column.public IlvAbstractJTableColumn(Object headerValue, 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.width
- The width of the column.identifier
- The column identifier.protected TableCellRenderer createRenderer()
getValue(ilog.views.gantt.IlvHierarchyNode)
method. The renderer
returned by this method is installed onto the column's internal
TableColumn
object.
This default implementation creates an
IlvDefaultTableCellRenderer
that renders the cell value as a
string by invoking the value's toString
method.
Subclasses should override this method as needed.
IlvDefaultTableCellRenderer
as the default
table cell renderer.protected TableCellEditor createEditor()
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. The editor returned by this
method is installed onto the column's internal
TableColumn
object.
This default implementation returns null
. Subclasses
should override this method as needed.
null
, as the default table cell editor.public final TableColumn getColumn()
TableColumn
that controls the visual
appearance of this column. It is assumed that this method will always
return the same TableColumn
object during this column's
lifetime.getColumn
in interface IlvJTableColumn
TableColumn
controlling this column.public IlvJTable getTable()
null
if this column has not been added to a table.IlvJTable
containing this column.public void setTable(IlvJTable table)
IlvJTable
.
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.
setTable
in interface IlvJTableColumn
table
- The table that this column is being added to, or
null
if this column is being removed from its
table.public void setGanttConfiguration(IlvGanttConfiguration ganttConfig)
This default implementation does nothing. Subclasses should override this method as needed.
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
ganttConfig
- The Gantt configuration that this column is being
added to, or null
if this column is being
removed from its Gantt configuration.public boolean isEditable(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
rowtype is
RESOURCE_ROWS
and
row
will be an IlvResource
.
This default implementation always returns false
.
Subclasses should override this method as needed.
isEditable
in interface IlvJTableColumn
row
- The row.true
if the cell is editable, false
otherwise.public String getValueAsText(IlvHierarchyNode row)
getValue(row).toString()
.
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
row type of the Gantt
configuration is
ACTIVITY_ROWS
, then
row
will be an IlvActivity
.
Otherwise,
rowtype of the Gantt
configuration is
RESOURCE_ROWS
and
row
will be an IlvResource
.
getValueAsText
in interface IlvJTableColumn
row
- The row.String
.getValue(ilog.views.gantt.IlvHierarchyNode)
public abstract Object getValue(IlvHierarchyNode row)
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
rowtype is
RESOURCE_ROWS
and
row
will be an IlvResource
.
getValue
in interface IlvJTableColumn
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
rowtype is
RESOURCE_ROWS
and
row
will be an IlvResource
.
This default implementation does nothing, so subclasses do not have to implement this method if the column is not editable. If a column subclass is editable, it should override this method to properly store the edited cell value back into the Gantt data model.
setValue
in interface IlvJTableColumn
row
- The row.value
- The new value.getValue(ilog.views.gantt.IlvHierarchyNode)
,
createEditor()
public int getModelIndex()
public int getColumnIndex()
public void updateUI()
updateUI
in interface IlvJTableColumn
public void cellUpdated(IlvHierarchyNode row)
row
- The row whose visual representation has changed.public void columnHeaderUpdated()
public void columnUpdated()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.