|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
verinec.gui.configurator.nodeeditor.EditorTextField
public class EditorTextField
The EditorTextField is a "Leaf" class in the Composite design pattern, it accepts user input, verifies it and assures coherence when treating the XML.
For an explication of the structural organisation of EditorTextFields
see the documentation of the IEditorComponent.
The color code for the field works in the following way: An unmodified field is black. If the value is changed and happens to be the same value as before the modification, it stays black. If a value is entered which fails the verification, the field turns red. If the value is correct but differs from the previous value, it turns green, and the value is written to the underlying XML.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JTextField |
|---|
JTextField.AccessibleJTextField |
| Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
|---|
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding |
| 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 | |
|---|---|
protected boolean |
attributeIsNecessary
Stores whether an XML attribute can be removed or not, it will have an asterik next to its name to visualize its property of being necessary. |
protected String |
attributeName
The Name of the XML attribute in which the value is stored. |
protected String |
childName
Only used for EditorMultiTextField; is the name of the XML Elements which contain the multiple values. |
protected String |
concatenator
Only used for EditorMultiTextField; Is an InputValidator class field that states the optimal separator and therefore is used to concatenate strings |
protected boolean |
containsNameForPanel
Is true if the XML element type is "Hostname" or "Name" |
protected Color |
green
The default GREEN color was not really readable, so this is the color for valid inputs. |
protected String |
inputValidatorMessage
Is an InputValidator class field (Regular expression) that serves as InputValidator pattern; Depending on the pattern a ToolTip string is attributed. |
protected JLabel |
label
The label; is stored as an instance field and will be displayed next to the field. |
protected Logger |
logger
Debugging. |
protected NodeEditor |
nodeEditor
Links to the NodeEditor instance in order to call the NodeEditor.setFocusTextField()
and register itself. |
protected Element |
parentNode
A link to the XML Element which contains the XML attribute. |
protected String |
previousInputValue
If the value of a field is changed, its original value is stored in this variable. |
protected String |
separator
Only used for EditorMultiTextField; Contains the InputValidator class field (Regular expression) that states the possible separators. |
| Fields inherited from class javax.swing.JTextField |
|---|
notifyAction |
| Fields inherited from class javax.swing.text.JTextComponent |
|---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| 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 javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
EditorTextField(String attributeName,
Element parentNode,
NodeEditor nodeEditor,
String inputValidatorMessage,
int fieldSize,
boolean attributeIsNecessary,
String labelString)
A field can have different properties according to the Parameter values given on creation. |
|
| Method Summary | |
|---|---|
void |
actionPerformed(ActionEvent e)
Checks the input. |
protected boolean |
attributeRemove(Element element,
String attribute)
Wrapper for the jdom function org.jdom.Element.removeAttribute. |
void |
checkInput()
This is where the value of a field is verified. |
void |
discard()
Resets all the changed values (i.e. all the colored fields). |
void |
discardRed()
Resets all the wrong values (i.e. all the red fields). |
protected String |
elementRead(Element element,
String attribute)
Wrapper for the jdom function org.jdom.Element.elementRead. |
protected Element |
elementWrite(Element element,
String attribute,
String value)
Wrapper for the jdom function org.jdom.Element.setAttribute. |
void |
focusGained(FocusEvent e)
Once the field gets focus, it registers itself in the NodeEditor class as "the field having focus" by calling the setFocusTextField() function. |
void |
focusLost(FocusEvent e)
The FocusLostEvent occurs if the Tab key is hit or the focus is transfered using the mouse. |
JLabel |
getLabel()
Return the label to prompt for this field. |
void |
save()
Saves the current value of the field. |
boolean |
update()
Checks if there have been changes in the fields. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String attributeName
protected String previousInputValue
protected NodeEditor nodeEditor
NodeEditor.setFocusTextField()
and register itself. (See also the focusGained() function)
protected String inputValidatorMessage
protected Element parentNode
protected boolean attributeIsNecessary
protected JLabel label
protected String separator
protected String concatenator
protected String childName
protected Color green
protected boolean containsNameForPanel
protected Logger logger
| Constructor Detail |
|---|
public EditorTextField(String attributeName,
Element parentNode,
NodeEditor nodeEditor,
String inputValidatorMessage,
int fieldSize,
boolean attributeIsNecessary,
String labelString)
attributeName - parentNode - nodeEditor - inputValidatorMessage - fieldSize - Number of columns for the field. (Currently uniform, constant in EditFieldsPanel).attributeIsNecessary - labelString - | Method Detail |
|---|
public void actionPerformed(ActionEvent e)
actionPerformed in interface ActionListenere - The action event.public void focusGained(FocusEvent e)
focusLost() function)
focusGained in interface FocusListenere - The event.public void focusLost(FocusEvent e)
focusGained() function)
focusLost in interface FocusListenere - The event.public void checkInput()
InputValidator.go() function.
According to the result of the verification, the color of the field
changes to black, green or red.
public boolean update()
update in interface IEditorComponentpublic void save()
save in interface IEditorComponentpublic void discard()
previousInputValue.
discard in interface IEditorComponentpublic void discardRed()
discardRed in interface IEditorComponentpublic JLabel getLabel()
protected Element elementWrite(Element element,
String attribute,
String value)
EditorMultiTextField where all the
functionality of this class can be kept and only jdom access functions have to be
rewritten.
If we set a node name, we also repaint the graphical view of the network.
element - The element to set its attribute.attribute - The attribute to set.value - The value to set the attribute to.
protected boolean attributeRemove(Element element,
String attribute)
EditorMultiTextField where all the
functionality of this class can be kept and only jdom access functions have to be
rewritten.
element - The element to modify.attribute - The attribute name to remove.
protected String elementRead(Element element,
String attribute)
EditorMultiTextField where all the
functionality of this class can be kept and only jdom access functions have to be
rewritten.
element - The element to read from.attribute - The attribute name to read.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||