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

Variable Index

 o hasChanges
Set the hasChanges flag to true as soon as the user edits anything.

Constructor Index

 o 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.

Method Index

 o addChildEditor(TypeEditor)
Part of TypeEditor implementation, subclassers should NOT override this method.
 o apply()
Applies all changes made to the value being edited in this type editor.
 o cancel()
Hides the type editor and clears any changes that have been made to the value being edited.
 o childApply(TypeEditor, Object)
Subclassers should override this method.
 o editorButtonName()
Subclassers may wish to override this method.
 o enable(boolean)
Enables or disables the type editor and its children.
 o enableEditor(Boolean)
Subclassers should override this method.
 o get(String)
Get the value of a named attribute.
 o getApplyValue()
Subclassers should override this method.
 o getChildEditorList()
Part of TypeEditor implementation, subclassers should NOT override this method.
 o getParentEditor()
Part of TypeEditor implementation, subclassers should NOT override this method.
 o getResetValue()
Returns the value to which this type editor would reset to if the user chooses to "Reset".
 o getTitle(String, String)
Returns a title string based on the given component and attribute names.
 o handleMessage(Message)
Handles "Apply" messages.
 o 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.
 o hideGroup()
May be overridden by group subclasses that want to know when the group becomes non-visible.
 o isEnabled()
Returns true if this type editor is enabled.
 o ok()
Applies changes and hides the type editor.
 o recurseEnable(AttributeManager, Boolean)
Useful utility method for enabling.
 o removeChildEditor(TypeEditor)
Part of TypeEditor implementation, subclassers should NOT override this method.
 o reset()
Causes the type editor to throw away the current value being edited and reset to the value last applied.
 o resetChildFromValue(TypeEditor, Object)
Subclassers may wish to override this method.
 o resetFromValue(Object)
Subclassers should override this method.
 o set(String, Object)
Set the value of a named attribute.
 o setParentEditor(TypeEditor)
Part of TypeEditor implementation, subclassers should NOT override this method.
 o 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.
 o setTitle(String, String)
Sets the title of the window based on the given component name and attribute name.
 o 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.
 o shouldEnableChild(TypeEditor, Object)
Subclassers should override this method.
 o showError(String)
Brings up a modal error dialog window with the given message in it and an "Ok" button.
 o showGroup()
May be overridden by group subclasses that want to know when the group becomes visible.

Variables

 o hasChanges
  protected boolean hasChanges
Set the hasChanges flag to true as soon as the user edits anything.

Constructors

 o 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.)

Methods

 o get
  public Object get(String key)
Get the value of a named attribute.
Overrides:
get in class Group
 o set
  public void set(String key,
                  Object value)
Set the value of a named attribute.
Overrides:
set in class Group
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o getTitle
  protected String getTitle(String compName,
                            String attrName)
Returns a title string based on the given component and attribute names.
 o setTitle
  public void setTitle(String compName,
                       String attrName)
Sets the title of the window based on the given component name and attribute name.
 o 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.
 o showGroup
  protected void showGroup()
May be overridden by group subclasses that want to know when the group becomes visible.
Overrides:
showGroup in class Group
 o 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
 o setParentEditor
  public void setParentEditor(TypeEditor parentEditor)
Part of TypeEditor implementation, subclassers should NOT override this method.
 o getParentEditor
  public TypeEditor getParentEditor()
Part of TypeEditor implementation, subclassers should NOT override this method.
 o addChildEditor
  protected void addChildEditor(TypeEditor child)
Part of TypeEditor implementation, subclassers should NOT override this method.
 o removeChildEditor
  protected void removeChildEditor(TypeEditor child)
Part of TypeEditor implementation, subclassers should NOT override this method.
 o getChildEditorList
  protected Enumeration getChildEditorList()
Part of TypeEditor implementation, subclassers should NOT override this method.
 o 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.
 o 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.
 o 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.
 o getResetValue
  public Object getResetValue()
Returns the value to which this type editor would reset to if the user chooses to "Reset".
 o isEnabled
  public boolean isEnabled()
Returns true if this type editor is enabled.
 o 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.
 o reset
  public void reset()
Causes the type editor to throw away the current value being edited and reset to the value last applied.
 o ok
  public void ok()
Applies changes and hides the type editor.
 o cancel
  public void cancel()
Hides the type editor and clears any changes that have been made to the value being edited.
 o enable
  public void enable(boolean enable)
Enables or disables the type editor and its children.
 o handleMessage
  public boolean handleMessage(Message msg)
Handles "Apply" messages. These are typically sent by children of the type editor.
Overrides:
handleMessage in class Group
 o recurseEnable
  protected void recurseEnable(AttributeManager mgr,
                               Boolean value)
Useful utility method for enabling. Enables this type editor and all of its children.
 o 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