Class sunsoft.jws.visual.rt.type.TypeEditor
All Packages Class Hierarchy This Package Previous Next Index
Class sunsoft.jws.visual.rt.type.TypeEditor
java.lang.Object
|
+----sunsoft.jws.visual.rt.base.AttributeManager
|
+----sunsoft.jws.visual.rt.base.Group
|
+----sunsoft.jws.visual.rt.type.TypeEditor
- public class TypeEditor
- extends Group
Base class for type editors. This should be subclassed for each
new type editor that needs to be added to the designer.
TypeEditors are used by the Designer's attribute editor in order to
edit the values of complex types, like Colors, Fonts, and arrays.
- See Also:
- Converter
-
hasChanges
- Set the hasChanges flag to true as soon as the user edits anything.
-
TypeEditor()
- Creates a new instance of TypeEditor with an attribute called
"enabled" that is a Boolean and is set to true when the type
editor should be graphically enabled (i.e.
-
addChildEditor(TypeEditor)
- Part of TypeEditor implementation, subclassers should NOT
override this method.
-
apply()
- Applies all changes made to the value being edited in this type editor.
-
cancel()
- Hides the type editor and clears any changes that have been made to
the value being edited.
-
childApply(TypeEditor, Object)
- Subclassers should override this method.
-
editorButtonName()
- Subclassers may wish to override this method.
-
enable(boolean)
- Enables or disables the type editor and its children.
-
enableEditor(Boolean)
- Subclassers should override this method.
-
get(String)
- Get the value of a named attribute.
-
getApplyValue()
- Subclassers should override this method.
-
getChildEditorList()
- Part of TypeEditor implementation, subclassers should NOT
override this method.
-
getParentEditor()
- Part of TypeEditor implementation, subclassers should NOT
override this method.
-
getResetValue()
- Returns the value to which this type editor would reset to if the user
chooses to "Reset".
-
getTitle(String, String)
- Returns a title string based on the given component and
attribute names.
-
handleMessage(Message)
- Handles "Apply" messages.
-
hasChanges()
- Returns true when changes have been made to the value in this
type editor (or any of its children) and they have not yet been
applied.
-
hideGroup()
- May be overridden by group subclasses that want
to know when the group becomes non-visible.
-
isEnabled()
- Returns true if this type editor is enabled.
-
ok()
- Applies changes and hides the type editor.
-
recurseEnable(AttributeManager, Boolean)
- Useful utility method for enabling.
-
removeChildEditor(TypeEditor)
- Part of TypeEditor implementation, subclassers should NOT
override this method.
-
reset()
- Causes the type editor to throw away the current value being edited
and reset to the value last applied.
-
resetChildFromValue(TypeEditor, Object)
- Subclassers may wish to override this method.
-
resetFromValue(Object)
- Subclassers should override this method.
-
set(String, Object)
- Set the value of a named attribute.
-
setParentEditor(TypeEditor)
- Part of TypeEditor implementation, subclassers should NOT
override this method.
-
setResetValue(Object)
- Sets a new reset value for this type editor to reset to, but does not
change the current value or cause the editor to reset.
-
setTitle(String, String)
- Sets the title of the window based on the given component name
and attribute name.
-
setValue(Object)
- Sets a new value for this type editor to edit and causes the
editor to reset its interface based on the new value.
-
shouldEnableChild(TypeEditor, Object)
- Subclassers should override this method.
-
showError(String)
- Brings up a modal error dialog window with the given message in it
and an "Ok" button.
-
showGroup()
- May be overridden by group subclasses that want
to know when the group becomes visible.
hasChanges
protected boolean hasChanges
- Set the hasChanges flag to true as soon as the user edits anything.
TypeEditor
public TypeEditor()
- Creates a new instance of TypeEditor with an attribute called
"enabled" that is a Boolean and is set to true when the type
editor should be graphically enabled (i.e. not greyed out.)
get
public Object get(String key)
- Get the value of a named attribute.
- Overrides:
- get in class Group
set
public void set(String key,
Object value)
- Set the value of a named attribute.
- Overrides:
- set in class Group
getApplyValue
protected abstract Object getApplyValue() throws ApplyException
- Subclassers should override this method.
This method should return a new value based on the edits that
the user has made.
The values from the child type editors need not be queried
during this method. Any children who have unapplied changes
will have already been dealt with by calls to the updateFromChild
method.
childApply
protected void childApply(TypeEditor child,
Object value)
- Subclassers should override this method.
This method is called when the child's value has been applied.
Do NOT call apply from this method. All you have to do is
record the new value for the child in your state. Then,
when getApplyValue is called, the new value from the child
should be reflected in the return value from getApplyValue.
resetFromValue
protected abstract void resetFromValue(Object value)
- Subclassers should override this method.
This method should load the user interface from a given value.
The loading of the child editors is dealt with using the
getValueForChild method.
shouldEnableChild
protected boolean shouldEnableChild(TypeEditor child,
Object value)
- Subclassers should override this method.
Return true if the given child should be enabled for the
given value. Otherwise return false. If this method returns
true, then getValueForChild will be called next.
resetChildFromValue
protected void resetChildFromValue(TypeEditor child,
Object value)
- Subclassers may wish to override this method.
This method is called during a reset operation. If this method
is not overridden, then the child values will be set to null.
The return value should be some subset of the value parameter.
The value parameter is the same value that is passed to the
resetFromValue method.
enableEditor
protected abstract void enableEditor(Boolean enable)
- Subclassers should override this method.
When enableEditor is called with a true value, then all the
editor components should be enabled.
When invoked with a false value, all the components should
be disabled except for the Cancel and Help buttons.
getTitle
protected String getTitle(String compName,
String attrName)
- Returns a title string based on the given component and
attribute names.
setTitle
public void setTitle(String compName,
String attrName)
- Sets the title of the window based on the given component name
and attribute name.
editorButtonName
public String editorButtonName()
- Subclassers may wish to override this method.
Returns a string to be placed within a button in the attribute
editor. If non-null is returned, then in place of a text field
or choice menu in the attribute editor, a button will be placed
in the slot that can only be used for calling up a type editor.
The button will contain the text returned.
The default value, null, means that the type's regular converter
should be consulted for how to display the type in the attribute
editor slot.
showGroup
protected void showGroup()
- May be overridden by group subclasses that want
to know when the group becomes visible.
- Overrides:
- showGroup in class Group
hideGroup
protected void hideGroup()
- May be overridden by group subclasses that want
to know when the group becomes non-visible.
- Overrides:
- hideGroup in class Group
setParentEditor
public void setParentEditor(TypeEditor parentEditor)
- Part of TypeEditor implementation, subclassers should NOT
override this method.
getParentEditor
public TypeEditor getParentEditor()
- Part of TypeEditor implementation, subclassers should NOT
override this method.
addChildEditor
protected void addChildEditor(TypeEditor child)
- Part of TypeEditor implementation, subclassers should NOT
override this method.
removeChildEditor
protected void removeChildEditor(TypeEditor child)
- Part of TypeEditor implementation, subclassers should NOT
override this method.
getChildEditorList
protected Enumeration getChildEditorList()
- Part of TypeEditor implementation, subclassers should NOT
override this method.
hasChanges
public boolean hasChanges()
- Returns true when changes have been made to the value in this
type editor (or any of its children) and they have not yet been
applied.
setValue
public void setValue(Object value)
- Sets a new value for this type editor to edit and causes the
editor to reset its interface based on the new value.
setResetValue
public void setResetValue(Object value)
- Sets a new reset value for this type editor to reset to, but does not
change the current value or cause the editor to reset.
getResetValue
public Object getResetValue()
- Returns the value to which this type editor would reset to if the user
chooses to "Reset".
isEnabled
public boolean isEnabled()
- Returns true if this type editor is enabled.
apply
public boolean apply()
- Applies all changes made to the value being edited in this type editor.
If the type editor has children, they are made to apply themselves
first. An "Apply" message is posted to the parent with the message
argument being the new value of the object edited.
reset
public void reset()
- Causes the type editor to throw away the current value being edited
and reset to the value last applied.
ok
public void ok()
- Applies changes and hides the type editor.
cancel
public void cancel()
- Hides the type editor and clears any changes that have been made to
the value being edited.
enable
public void enable(boolean enable)
- Enables or disables the type editor and its children.
handleMessage
public boolean handleMessage(Message msg)
- Handles "Apply" messages. These are typically sent by children
of the type editor.
- Overrides:
- handleMessage in class Group
recurseEnable
protected void recurseEnable(AttributeManager mgr,
Boolean value)
- Useful utility method for enabling. Enables this type editor
and all of its children.
showError
protected void showError(String message)
- Brings up a modal error dialog window with the given message in it
and an "Ok" button.
- See Also:
- VJErrorDialog
All Packages Class Hierarchy This Package Previous Next Index