chemaxon.alchemist.configbuilder
Class AbstractSketchConfigElement

java.lang.Object
  extended by chemaxon.alchemist.configbuilder.ConfigElement
      extended by chemaxon.alchemist.configbuilder.AbstractSketchConfigElement
All Implemented Interfaces:
ExternalEditorSupport, java.awt.datatransfer.Transferable, java.lang.Cloneable

public abstract class AbstractSketchConfigElement
extends ConfigElement
implements ExternalEditorSupport

This is an abstract ConfigElement using MSketchPane as an external editor by implementing ExternalEditorSupport interface.

Author:
Istvan Cseh

Field Summary
static java.lang.String PROPERTY_KEY_MOLECULE
          the molecule property key
 
Fields inherited from class chemaxon.alchemist.configbuilder.ConfigElement
flavor, PROPERTY_KEY_DEFAULTICON, PROPERTY_KEY_EDITABLE, PROPERTY_KEY_HELPTEXT, PROPERTY_KEY_ICON, PROPERTY_KEY_ID, PROPERTY_KEY_NAME, PROPERTY_KEY_TOOLTIP, PROPERTY_KEY_VALID, propertyChangeSupport
 
Fields inherited from interface chemaxon.alchemist.configbuilder.ExternalEditorSupport
PROPERTY_KEY_EDITORMODE, PROPERTY_VALUE_DEFAULT, PROPERTY_VALUE_EXTERNAL
 
Constructor Summary
AbstractSketchConfigElement()
           
 
Method Summary
protected  void accepted(Molecule molecule)
          This method is called after 'accept' button pressed on external sketch editor.
protected  void canceled()
          This method is called after 'cancel' button pressed on external sketch editor.
protected  void copyAttributes(ConfigElement source)
          Copies the default attributes from source
protected  int getDefaultDispOpts()
          Returns the default disp opts for this element.
 java.lang.String getEditorMode()
          Returns the current editor mode
 ConfigElementEditor getExternalEditor()
          Returns the external editor instance, or null if no editor set
 java.lang.String getExternalEditorClassName()
          Returns the class name of external editor
 Molecule getMolecule()
           
 void setEditorMode(java.lang.String editorMode)
          Switches to the given editor mode.
 void setExternalEditor(ConfigElementEditor externalEditor)
          Sets the external editor
 void setMolecule(Molecule molecule)
           
 
Methods inherited from class chemaxon.alchemist.configbuilder.ConfigElement
addGroup, addPropertyChangeListener, addPropertyChangeListener, clone, cloneElement, getDefaultIcon, getGroups, getHelpText, getIcon, getId, getLicenseName, getName, getTooltip, getTransferData, getTransferDataFlavors, hasGroup, hasGroups, isDataFlavorSupported, isDefault, isEditable, isLicensed, isValid, removePropertyChangeListener, removePropertyChangeListener, setDefaultIcon, setEditable, setHelpText, setId, setLicensed, setLicenseName, setName, setTooltip, setValid, store, store, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_KEY_MOLECULE

public static java.lang.String PROPERTY_KEY_MOLECULE
the molecule property key

Constructor Detail

AbstractSketchConfigElement

public AbstractSketchConfigElement()
Method Detail

getEditorMode

public java.lang.String getEditorMode()
Description copied from interface: ExternalEditorSupport
Returns the current editor mode

Specified by:
getEditorMode in interface ExternalEditorSupport
Returns:
the current editor mode

getExternalEditor

public ConfigElementEditor getExternalEditor()
Description copied from interface: ExternalEditorSupport
Returns the external editor instance, or null if no editor set

Specified by:
getExternalEditor in interface ExternalEditorSupport
Returns:
the external editor instance, or null if no editor set

setEditorMode

public void setEditorMode(java.lang.String editorMode)
Description copied from interface: ExternalEditorSupport
Switches to the given editor mode. Fires a property change event with PROPERTY_KEY_EDITORMODE key to listeners, and calls for validate()
NOTE: InvalidArgumentException may be thrown when called with invalid parameters

Specified by:
setEditorMode in interface ExternalEditorSupport
Parameters:
editorMode - is the new editor mode. Valid values are PROPERTY_VALUE_DEFAULT and PROPERTY_VALUE_EXTERNAL

setExternalEditor

public void setExternalEditor(ConfigElementEditor externalEditor)
Description copied from interface: ExternalEditorSupport
Sets the external editor

Specified by:
setExternalEditor in interface ExternalEditorSupport
Parameters:
externalEditor - is the editor instance

setMolecule

public void setMolecule(Molecule molecule)

getMolecule

public Molecule getMolecule()

copyAttributes

protected void copyAttributes(ConfigElement source)
Description copied from class: ConfigElement
Copies the default attributes from source

Overrides:
copyAttributes in class ConfigElement
Parameters:
source - is the ConfigElement copy attributes from

getExternalEditorClassName

public java.lang.String getExternalEditorClassName()
Description copied from interface: ExternalEditorSupport
Returns the class name of external editor

Specified by:
getExternalEditorClassName in interface ExternalEditorSupport
Returns:
the class name of external editor

accepted

protected void accepted(Molecule molecule)
This method is called after 'accept' button pressed on external sketch editor.
Default implementation sets mDocument and editorMode


canceled

protected void canceled()
This method is called after 'cancel' button pressed on external sketch editor.
Default implementation leaves mDocument as is, and sets editorMode


getDefaultDispOpts

protected int getDefaultDispOpts()
Returns the default disp opts for this element. Default implementation returns -1

Returns: