Advanced customization of table cells

To further customize the table cell rendering, you may also:
  • Use an IlvGraphic to generate an arbitrarily complex graphic representation ( IlvCompositeGraphic). For more information about composite graphics, see the section on graphic objects in Architecture of graphic components.
  • Use a JComponent to generate a graphic representation and customize it using CSS.
  • Create your own renderer (which should implement the Swing TableCellRenderer interface) to generate an arbitrary Swing Component.

How to use an IlvGraphic to generate a table cell representation

IlvGraphic instances can be used to represent table cells through the property 'class' . The given class must follow the JavaBeans™ pattern; its properties can be directly customized in CSS.
The following example illustrates the use of IlvGeneralNode to represent table cells:
object."Service/type" {
  class: 'ilog.views.sdm.graphic.IlvGeneralNode';
  label: @name;
  labelPosition: Right;
  labelColor: black;
  labelSpacing: 4;
  shapeType: RECTANGLE;
  shapeWidth: 12;
  shapeHeight: 12;
}
object."Service/type":selected {
  labelColor: red;
}
For information about how to use JavaBeans in CSS and how to use the class property, refer to Class property.

How to use a JComponent to generate a table cell representation

JComponent instances can be used to represent table cells in the same way as they are used to represent tree nodes (see How to use a JComponent to generate a tree node representation).
In the following example, table cells are represented using a simple JLabel whose properties text , icon and foreground are customized according to the business attribute and the selection state of the table cell.
object."Service/type" {
  class: 'javax.swing.JLabel';
  icon : @=icon;
  text: @type;
  foreground: black;
}
object."Service/type":selected {
  foreground: red;
}
Subobject#icon {
  class: 'javax.swing.ImageIcon';
  image: '@|image("service.png")';
}
As illustrated in this example, JComponent instances can be used to represent table cells through the property 'class' . The given class must follow the JavaBeans pattern; its properties can be customized directly in CSS (icon, text, foreground).
For information about how to use JavaBeans in CSS and how to use the class property, refer to Class property.

Creating your own renderer for table cells

You may want to replace the JViews TGO table cell representation by your own representation. To do so, you need to create your own implementation of the Swing TableCellRenderer interface. For details, refer to Using an arbitrary TreeCellRenderer.
You will then be able to register the new table cell renderer in the table component through CSS or through the API.
For information on how to set a new table cell renderer through CSS, refer to The View rule .
For information on how to set a new table cell renderer through the API, refer to Configuring the tree component.