verinec.gui.configurator.nodeeditor
Interface IEditorComponent

All Known Implementing Classes:
EditFieldsPanel, EditorComboBox, EditorMultiTextField, EditorPanel, EditorTextField, EthernetPanel, NodeEditor, NodePanel, OptionalElementComboBox, SerialPanel, WlanPanel

public interface IEditorComponent

This Interface specifies that every panel, text field or combo box used in the EditorGUI will implement the functions update(), save(), discard(), discardRed() and add(Component). By unifying the functionality of the different components we can care less about whether we work with a panel or a single text field.

This is an implementation of the structural design pattern "Composite". As a short reminder what the Composite Pattern is about: "Compose ob jects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual ob jects and compositions of objects uniformly."

The classes shown in the Figure above correspond with the following prototypes:

IEditorComponent Component
EditorPanel Composite
NodeEditor Composite
EditorTextField Leaf
EditorComboBox Leaf
Configurator Client

Author:
Damian Vogel

Method Summary
 void discard()
          Discards any changed input field to what is was before; thus any red or green field is reset to black.
 void discardRed()
          Discards any invalid input field (i.e. any red field) to the last valid value.
 void save()
          This is the function which follows if update() has encountered unsaved inputs and has returned true or the "save"-button has been hit.
 boolean update()
          Determines whether there are unsaved inputs and discards the data of incorrect inputs.
 

Method Detail

discard

void discard()
Discards any changed input field to what is was before; thus any red or green field is reset to black.


discardRed

void discardRed()
Discards any invalid input field (i.e. any red field) to the last valid value. Because the last valid value corresponds to the current value of the underlying XML, only the contents of the TextField will be restored.


save

void save()
This is the function which follows if update() has encountered unsaved inputs and has returned true or the "save"-button has been hit.


update

boolean update()
Determines whether there are unsaved inputs and discards the data of incorrect inputs. It's called in the NodeEditor.stateChanged(javax.swing.event.ChangeEvent) function which is triggered when the selection in the drawPanel changes.

This function could also be useful to display a dialog when encountering unsaved fields (i.e. fields where validation failed).

Returns:
false if nothing changed, and true if there were changes.

Copyright © 2005 Verinec, DIUF