org.merlotxml.merlot.editors
Class SimpleTypeEditor

java.lang.Object
  extended byorg.merlotxml.merlot.editors.SimpleTypeEditor
Direct Known Subclasses:
EnumerationEditor, KeyRefEditor, TextEditor

public class SimpleTypeEditor
extends java.lang.Object

Contains the functionality for editing a simple type. The idea is that all complexity related to each type of editor be kept in one place, including event handling related to this component. Methods for event handling still need to be added. For example, a BoundedNumberEditor sub-class might be created that would only accept key strokes that would keep the value valid betweens its defined bounds. Or, a DateTimeEditor that would allow the date to be selected visually from a calendar.

Author:
Evert Hoff

Field Summary
protected  ComplexTypeEditPanel _complexTypeEditPanel
           
protected  javax.swing.JComponent _component
           
protected  GrammarSimpleType _grammarSimpleType
           
 
Constructor Summary
SimpleTypeEditor(ComplexTypeEditPanel complexTypeEditPanel, GrammarSimpleType grammarSimpleType)
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds the ActionListener to the JComponent if that component can accept an action listener.
 javax.swing.JComponent getComponent()
          Gets the component for editing this simple type.
 boolean getEditable()
          Gets whether the component is currently disabled or not.
 java.lang.String getValue()
          Retrieves the value from this component.
 void removeActionListener(java.awt.event.ActionListener l)
           
 void setEditable(boolean editable)
          Sets the component to editable or read-only.
 void setValue(java.lang.String value)
          Sets the value of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_complexTypeEditPanel

protected ComplexTypeEditPanel _complexTypeEditPanel

_component

protected javax.swing.JComponent _component

_grammarSimpleType

protected GrammarSimpleType _grammarSimpleType
Constructor Detail

SimpleTypeEditor

public SimpleTypeEditor(ComplexTypeEditPanel complexTypeEditPanel,
                        GrammarSimpleType grammarSimpleType)
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds the ActionListener to the JComponent if that component can accept an action listener.


removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)

getComponent

public javax.swing.JComponent getComponent()
Gets the component for editing this simple type.

Returns:
The component value

getEditable

public boolean getEditable()
Gets whether the component is currently disabled or not.

Returns:
The editable value

getValue

public java.lang.String getValue()
Retrieves the value from this component.

Returns:
The value

setEditable

public void setEditable(boolean editable)
Sets the component to editable or read-only.

Parameters:
editable - The new editable value

setValue

public void setValue(java.lang.String value)
Sets the value of the component.

Parameters:
value - The new value value