Difference between revisions of "Notes on the Display of AttributeTables"

From OpenJUMP Wiki
Jump to navigation Jump to search
Line 9: Line 9:
 
* The constructor of the ViewAttributesFrame class creates a new OneLayerAttributeTab. The constructor of an AttributeTab class creates a new AttributePanel class.
 
* The constructor of the ViewAttributesFrame class creates a new OneLayerAttributeTab. The constructor of an AttributeTab class creates a new AttributePanel class.
  
 +
[[image:OneLayerAttributeTab.png]]
 +
[[image:AttributeTabePanel.png]]
 
<gallery caption="Main Components of a ViewAttributesFrame" widths="320px" heights="200px" perrow="2">
 
<gallery caption="Main Components of a ViewAttributesFrame" widths="320px" heights="200px" perrow="2">
[[Image:OneLayerAttributeTab.png|A OneLayerAttributeTab in a ViewAttributesFrame]]
+
Image:OneLayerAttributeTab.png|A OneLayerAttributeTab in a ViewAttributesFrame
[[Image:AttributeTabePanel.png|A AttributeTablePanel in a ViewAttributesFrame]]
+
Image:AttributeTabePanel.png|A AttributeTablePanel in a ViewAttributesFrame
 
</gallery>
 
</gallery>
  

Revision as of 21:24, 11 December 2011

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.

OneLayerAttributeTab.png AttributeTabePanel.png

  • 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.