NodeView

The NodeViewdisplays the data of the NodeModelin a specific way. This can be done either by using Java components such as javax.swing.JTableor javax.swing.JTreeor by drawing the data using the java.awt.Graphicsobject. In the latter case a javax.swing.JPanelcan be used and the paintComponent(Graphics)method must be overridden. There are four sites in the NodeView to place your code:

NodeView constructor:

Example #1:

	protected ValueCounterNodeView(final NodeModel nodeModel) {
    super(nodeModel);
    m_panel = new YourSpecializedPanel();
    setComponent(m_panel);
}

The constructor is called whenever the view is opened. This is the best place to initialize the fields, data structures, and components you need. When everything is initialized and the preferences are set, call the setComponent(Component). Only one component can be set with this method, thus, if you have several components you have the make a composite by your own and set this composite. It is good practice to call this method only once and then in the constructor. Note: you can leave the view open, when resetting the node or even change the input of the node, i.e. all operations related to the data of the model cannot be placed in the contructor. Hence, the method informs the view about changes in the underlying NodeModel. It is possible to open several views for a single NodeModel, though. Local functionality, such as selection, has to be administered in the NodeView. Corresponding data structures can be initialized in the NodeView's constructor.