public class IlvSDMTableModel extends AbstractTableModel implements SDMModelListener, SDMPropertyChangeListener, IlvSDMTableModelFilter
IlvSDMModel SDMModel = ...; IlvSDMTableModel tableModel = new IlvSDMTableModel(SDMModel); JTable table = new JTable(tableModel);
listenerList
_fromProperty, _idProperty, _toProperty
Constructor and Description |
---|
IlvSDMTableModel(IlvSDMModel SDMModel,
String tag)
Creates a new SDM table model that describes the
objects of an SDM model.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptObject(Object obj)
Implementation of
IlvSDMTableModelFilter . |
boolean |
acceptProperty(Object obj,
String property)
Implementation of
IlvSDMTableModelFilter . |
void |
addProperty(String prop)
Adds a new property (column).
|
void |
adjustmentFinished(SDMModelEvent event)
Invoked at the end of an adjustment sequence,
when
setAdjusting(false)
is called on the model. |
void |
dataChanged(SDMModelEvent event)
Invoked after the SDM model has changed in such
a way that the SDM view must completely recreate
its graphic objects.
|
Class |
getColumnClass(int columnIndex)
Returns the class of the column at the specified index.
|
int |
getColumnCount()
Returns the total number of properties of all
the objects of the SDM model.
|
String |
getColumnName(int column)
Returns the name of the
column -th
property. |
String |
getColumnName(String property)
Implementation of
IlvSDMTableModelFilter . |
int |
getColumnOfProperty(String property)
Returns the column index of the specified data object
property in the table model.
|
IlvSDMTableModelFilter |
getFilter()
Returns the filter used to determine what objects
and properties are displayed in the table.
|
String |
getFilteringTag()
Returns the tag used to filter the objects of
the SDM model.
|
Object |
getObject(int row)
Returns the data object whose properties are
displayed by the
row -th row of this
table model. |
int |
getRowCount()
Returns the number of objects in the SDM model,
including the objects contained in subobjects.
|
int |
getRowOfObject(Object object)
Returns the row index of the specified data object
in the table model.
|
IlvSDMModel |
getSDMModel()
Returns the SDM model for which this table model
is an adapter.
|
Object |
getValueAt(int row,
int column)
Returns the value of the
column -th
property of the row -th object returned
by the SDM model. |
boolean |
isCellEditable(int row,
int column)
Returns
true if
the underlying SDM model is editable. |
boolean |
isEditable(Object obj,
String property)
Implementation of
IlvSDMTableModelFilter . |
boolean |
isEditionAllowed()
Returns
true if editing is allowed through
this table model, and false otherwise. |
void |
linkDestinationChanged(SDMModelEvent event)
Invoked after the destination node of a link has been changed.
|
void |
linkSourceChanged(SDMModelEvent event)
Invoked after the source node of a link has been changed.
|
void |
objectAdded(SDMModelEvent event)
Invoked after nodes or links
have been added to the SDM model.
|
void |
objectRemoved(SDMModelEvent event)
Invoked after nodes or links
have been removed from the SDM model.
|
void |
propertyChanged(SDMPropertyChangeEvent event)
Invoked after one or several properties
of a data object have changed.
|
void |
setEditionAllowed(boolean allowed)
Allows or forbids editing through this table model.
|
void |
setFilter(IlvSDMTableModelFilter filter)
Sets the filter used to determine what objects
and properties are displayed in the table.
|
void |
setFilteringTag(String tag)
Sets the tag used to filter the objects of
the SDM model.
|
void |
setSDMModel(IlvSDMModel SDMModel)
Sets the SDM model for which this table model
is an adapter.
|
void |
setValueAt(Object value,
int row,
int column)
Sets the value of the
column -th
property of the row -th object returned
by the SDM model. |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
public IlvSDMTableModel(IlvSDMModel SDMModel, String tag)
SDMModel
- The SDM model whose objects
are to be displayed in a Swing JTable.tag
- The initial filtering tag, or null
to display all the objects.public void setFilter(IlvSDMTableModelFilter filter)
filter
- The new filter. If the filter is null
,
it is reset to the default filter, which is this
table model instance, and which accepts all objects
and properties by default.public IlvSDMTableModelFilter getFilter()
public void setFilteringTag(String tag)
tag
is not null
,
only the objects with the specified tag will be displayed.
If it is null
, all the objects
of the SDM model are displayed.tag
- The new tag.public String getFilteringTag()
public void setEditionAllowed(boolean allowed)
isEditionAllowed()
returns true
.
isEditable(java.lang.Object, java.lang.String)
method returns
true
for the object's property.
allowed
- If true
, allows the objects
of this model to be edited.public boolean isEditionAllowed()
true
if editing is allowed through
this table model, and false
otherwise.setEditionAllowed(boolean)
public int getColumnCount()
getColumnCount
in interface TableModel
public int getRowCount()
getRowCount
in interface TableModel
public Object getValueAt(int row, int column)
column
-th
property of the row
-th object returned
by the SDM model.getValueAt
in interface TableModel
row
- The table row index.column
- The table column index.public String getColumnName(int column)
column
-th
property.getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
column
- The table column index.public Class getColumnClass(int columnIndex)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
columnIndex
- The table column index.public boolean isCellEditable(int row, int column)
true
if
the underlying SDM model is editable.
If a filter is defined, this method returns
the result of the filter's isEditable
method.isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
row
- The table row index.column
- The table column index.public void setValueAt(Object value, int row, int column)
column
-th
property of the row
-th object returned
by the SDM model.
This method assumes that the underlying SDM model is editable.
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
value
- The new property value.row
- The table row index.column
- The table column index.public void setSDMModel(IlvSDMModel SDMModel)
SDMModel
- The new SDM model.public IlvSDMModel getSDMModel()
public void addProperty(String prop)
prop
- The new property.public void objectAdded(SDMModelEvent event)
objectAdded
in interface SDMModelListener
event
- The event.public void objectRemoved(SDMModelEvent event)
objectRemoved
in interface SDMModelListener
event
- The event.public void dataChanged(SDMModelEvent event)
dataChanged
in interface SDMModelListener
event
- The event.public void adjustmentFinished(SDMModelEvent event)
setAdjusting(false)
is called on the model.
This implementation does nothing.
adjustmentFinished
in interface SDMModelListener
event
- The event.public void linkSourceChanged(SDMModelEvent event)
linkSourceChanged
in interface SDMModelListener
event
- The event.public void linkDestinationChanged(SDMModelEvent event)
linkDestinationChanged
in interface SDMModelListener
event
- The event.public void propertyChanged(SDMPropertyChangeEvent event)
null
.propertyChanged
in interface SDMPropertyChangeListener
event
- The event.public Object getObject(int row)
row
-th row of this
table model.row
- The row index.public int getRowOfObject(Object object)
object
- The object from the SDM data model.-1
if the
object is not found or not displayed by this table model.public int getColumnOfProperty(String property)
property
- The property name.-1
if the
property is not found.public boolean acceptObject(Object obj)
IlvSDMTableModelFilter
.
Returns true
if the
object tag matches the tag set by setFilteringTag(java.lang.String)
,
or if no filtering tag has been set for this table model.acceptObject
in interface IlvSDMTableModelFilter
obj
- The object tag.public boolean acceptProperty(Object obj, String property)
IlvSDMTableModelFilter
.
This method returns true
.acceptProperty
in interface IlvSDMTableModelFilter
obj
- The object from the SDM data model.property
- The property name.public String getColumnName(String property)
IlvSDMTableModelFilter
.
This method returns property
.getColumnName
in interface IlvSDMTableModelFilter
property
- The property name.public boolean isEditable(Object obj, String property)
IlvSDMTableModelFilter
.
Returns true
if and only if
the SDM model is editable.isEditable
in interface IlvSDMTableModelFilter
obj
- The object from the SDM data model.property
- The property name.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.