verinec.gui.configurator.nodeeditor
Class EditFieldsPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by verinec.gui.configurator.nodeeditor.EditorPanel
                      extended by verinec.gui.configurator.nodeeditor.EditFieldsPanel
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IEditorComponent
Direct Known Subclasses:
EthernetPanel, NodePanel, SerialPanel, WlanPanel

public class EditFieldsPanel
extends EditorPanel

A panel to hold editor fields.

The editors for different network components create their fields and use display... functions for common fields. The concept can be summarized as follows:

  1. Read information from the XML structure
  2. Create the various inputfields (EditorTextField, EditorMultiTextField or EditorComboBox) to add to the NodeEditor

Author:
david.buchmann at unifr.ch, Damian Vogel
See Also:
Serialized Form

Nested Class Summary
 class EditFieldsPanel.NameChangeListener
          A listener to add to all fields that contain names for panels.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  EditorPanel fieldPanel
           
private  EditorPanel labelPanel
           
protected static int length
          Uniform length for TextFields.
private  TitledBorder tborder
           
protected  Element xml
          Every panel has an according XML structure.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EditFieldsPanel(Element xml, NodeEditor nodeEditor)
          Creates the panel and initiates the necessary areas and layouts.
 
Method Summary
 void addField(EditorComboBox f)
          Add a field into the editor.
 void addField(EditorTextField f)
          Add a field into the editor.
protected static void displayPartHWAddress(Element baseElement, EditFieldsPanel parentPanel, NodeEditor nodeEditor)
          Add an editor field for the hw address.
protected static void displayPartName(Element baseElement, EditFieldsPanel parentPanel, NodeEditor nodeEditor)
          Add an editor field for a name.
protected static void displayPartNw(Element baseElement, EditFieldsPanel parentPanel, NodeEditor nodeEditor)
          Add the fields for nw configuration.
 String getNameForPanel()
          Function which tries to find a most meaningful name for a Panel.
private static Element getOrCreateChild(Element baseElement, String childName)
          Get the child of an element or create it if not yet existing.
 Element getXml()
          Get the xml element defining this panel.
 void updateTitledBorder()
          If a name field changes, the border has to be updated accordingly.
 
Methods inherited from class verinec.gui.configurator.nodeeditor.EditorPanel
actionPerformed, createResetButtons, discard, discardRed, save, update
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

protected static final int length
Uniform length for TextFields.

See Also:
Constant Field Values

xml

protected Element xml
Every panel has an according XML structure.


labelPanel

private EditorPanel labelPanel

fieldPanel

private EditorPanel fieldPanel

tborder

private TitledBorder tborder
Constructor Detail

EditFieldsPanel

public EditFieldsPanel(Element xml,
                       NodeEditor nodeEditor)
Creates the panel and initiates the necessary areas and layouts. Extending classes are responsible of creating editor fields for the actual configuration information.

Parameters:
xml - The configuration to hold in member variable.
nodeEditor - Reference to the main editor.
Method Detail

addField

public void addField(EditorTextField f)
Add a field into the editor. Adds the label of the EditorTextField to the labelPanel and the field to fieldPanel.

Parameters:
f - The field to add.

addField

public void addField(EditorComboBox f)
Add a field into the editor. Adds the label of the EditorComboBox to the labelPanel and the field to fieldPanel.

Parameters:
f - The field to add.

updateTitledBorder

public void updateTitledBorder()
If a name field changes, the border has to be updated accordingly. This function is only called from a EditorTextField which has the EditorTextField.containsNameForPanel field set to true.


getNameForPanel

public String getNameForPanel()
Function which tries to find a most meaningful name for a Panel.

Returns:
The name to use for the panel.

getXml

public Element getXml()
Get the xml element defining this panel.

Returns:
The xml defining this panel.

getOrCreateChild

private static Element getOrCreateChild(Element baseElement,
                                        String childName)
Get the child of an element or create it if not yet existing.

Parameters:
baseElement - The xml element to operate on.
childName - The name of the child to get.
Returns:
The child, either existing or newly created.

displayPartNw

protected static void displayPartNw(Element baseElement,
                                    EditFieldsPanel parentPanel,
                                    NodeEditor nodeEditor)
Add the fields for nw configuration. (Used in ethernet, serial and wlan)

Parameters:
baseElement - The element which contains all the XML information.
parentPanel - Panel the fields should be child of.
nodeEditor - Reference to the instance of the first EditorPanel, the NodeEditor.

displayPartHWAddress

protected static void displayPartHWAddress(Element baseElement,
                                           EditFieldsPanel parentPanel,
                                           NodeEditor nodeEditor)
Add an editor field for the hw address. (Used by ethernet and wlan)

Parameters:
baseElement - The element which contains all the XML information.
parentPanel - Panel this panel should be child of.
nodeEditor - Reference to the instance of the first EditorPanel, the NodeEditor.

displayPartName

protected static void displayPartName(Element baseElement,
                                      EditFieldsPanel parentPanel,
                                      NodeEditor nodeEditor)
Add an editor field for a name. (Used by several panels)

Parameters:
baseElement - The element which contains all the XML information.
parentPanel - Panel this field should be child of.
nodeEditor - Reference to the instance of the first EditorPanel, the NodeEditor.

Copyright © 2005 Verinec, DIUF