Notes on the Display of AttributeTables

From OpenJUMP Wiki
Jump to navigation Jump to search

I wanted to jot down some notes on the code involved in displaying the attributes for features in a layer.


ViewAttributesPlugIn

Here is a basic run down of the series of method calls when the user calls up the attribute table for a layer:

  • ViewAttributesPlugIn defines the public static innner class ViewAttributesFrame. A new instance of this class is created when the execute method of the ViewAttributesPlugIn is called.
  • The constructor of the ViewAttributesFrame class creates a new OneLayerAttributeTab. The constructor of an AttributeTab class creates a new AttributePanel class.


  • The AttributePanel class defines a layerAdded method that calls the addTablePanel method that is also defined in the AttributePanel class.
  • The addTablePanel method creates a new AttributeTablePanel using the provided LayerTableModel.
  • The AttributeTablePanel contains an inner class named MyTable that extends JTable.

FeatureInfoPlugIn

Common Components

The AttributeTablePanel class looks like it could be a package itself. It contains three (3) inner classes and one inner interface. These include:

  • MyTable
  • FeatureEditor
  • GeometryCellRenderer
  • SelectionModelRenderer

The AttributeTablePanel class is definitely one of the most complex I've seen in OpenJUMP.

The LayerTableModel class extends the ColumnTableModel class. ColumnTableModel implements the Swing TableModel interface. A LayerTableModel is passed to the AttributeTable so the attribute values of Feature objects in a layer can be displayed.