public class IlvSDMTableMediator extends Object implements ManagerSelectionListener, ListSelectionListener
IlvSDMTableModel
adapter. The mediator also handles the synchronization
of the selections between the Perforce JViews grapher and
the JTable.
To connect a JTable to an SDM engine, create a table mediator as follows:
IlvSDMEngine engine = ...; JTable table = new JTable(); IlvSDMTableMediator mediator = new IlvSDMTableMediator(engine, table, null);
You can filter the objects and the properties that are displayed
in the table. For this, you must write style rules in the style sheet using
the pseudo-class "table"
, and set the properties "visible"
and "properties"
.
For example, the following rule specifies that the objects of tag
"join"
are not displayed in the table:
node.join:table { visible : false; }
The following rule specifies that only the properties "name"
and "implementation"
of activity objects are displayed
in the table:
node.activity:table { properties : "name,implementation"; }
Optionally, you can also customize the colors of the table cells.
This customization is not enabled by default, for performance reasons.
To enable it, you must first call setUsingStyleSheetRenderer(true)
on the table mediator.
Then you can write style rules using the pseudo-class "table"
,
and set the properties "foreground"
and "background"
,
as in the following example:
node.join:table { foreground : "yellow"; background : "red"; }
Modifier and Type | Field and Description |
---|---|
static String |
tableClass
The pseudo-class used to customize the colors of table cells.
|
Constructor and Description |
---|
IlvSDMTableMediator(IlvSDMEngine engine,
JTable table,
String tag)
Creates a new SDM table mediator, which connects
an SDM engine with a Swing JTable.
|
Modifier and Type | Method and Description |
---|---|
IlvSDMEngine |
getSDMEngine()
Returns the SDM engine connected to the JTable.
|
JTable |
getTable()
Returns the JTable connected to the SDM engine.
|
IlvSDMTableModel |
getTableModel()
Returns the JTable model.
|
boolean |
isUsingStyleSheetRenderer()
Returns
true if the table cell renderer
that reads the colors of the cells from the
style sheet is installed, or false otherwise. |
void |
selectionChanged(ManagerSelectionChangedEvent event)
Implementation of the
ManagerSelectionListener
interface. |
void |
setSDMEngine(IlvSDMEngine engine)
Sets the SDM engine to connect to the JTable.
|
void |
setTable(JTable table)
Sets the JTable to connect to the SDM engine.
|
void |
setTableModel(IlvSDMTableModel tableModel)
Sets the JTable model.
|
void |
setUsingStyleSheetRenderer(boolean yes)
Installs or uninstalls a table cell renderer
that reads the colors of the cells from the
style sheet.
|
void |
valueChanged(ListSelectionEvent event)
Implementation of the
javax.swing.event.ListSelectionListener
interface. |
public static final String tableClass
public IlvSDMTableMediator(IlvSDMEngine engine, JTable table, String tag)
engine
- The SDM engine.table
- The Swing JTable.tag
- The tag of the objects to display,
or null
to display all the objects.public void setSDMEngine(IlvSDMEngine engine)
engine
- The new SDM engine.public IlvSDMEngine getSDMEngine()
public void setTable(JTable table)
table
- The new Swing JTable.public JTable getTable()
public void setTableModel(IlvSDMTableModel tableModel)
tableModel
- The new model.public IlvSDMTableModel getTableModel()
public void selectionChanged(ManagerSelectionChangedEvent event)
ManagerSelectionListener
interface. This method selects the JTable rows corresponding
to the graphic objects that are selected in the grapher.selectionChanged
in interface ManagerSelectionListener
event
- The event.IlvManager.addManagerSelectionListener(ilog.views.event.ManagerSelectionListener)
,
IlvManager.removeManagerSelectionListener(ilog.views.event.ManagerSelectionListener)
,
IlvManager.addManagerTreeSelectionListener(ilog.views.event.ManagerSelectionListener)
,
IlvManager.removeManagerTreeSelectionListener(ilog.views.event.ManagerSelectionListener)
,
IlvManager.selectionChanged(ilog.views.IlvGraphic)
public void valueChanged(ListSelectionEvent event)
javax.swing.event.ListSelectionListener
interface. This method selects the graphic objects corresponding
to the selected rows in the JTable.valueChanged
in interface ListSelectionListener
event
- The event.public void setUsingStyleSheetRenderer(boolean yes)
yes
- If true
,
the style sheet cell renderer is installed; otherwise
it is uninstalled and the default table cell renderer
is used.public boolean isUsingStyleSheetRenderer()
true
if the table cell renderer
that reads the colors of the cells from the
style sheet is installed, or false
otherwise.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.