chemaxon.alchemist.configbuilder
Class ConfigElement

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

public abstract class ConfigElement
extends java.lang.Object
implements java.awt.datatransfer.Transferable, java.lang.Cloneable

This is the abstract ConfigElement.
Implementations are used in ConfigBuilderPanel, both JLists are filled with ConfigElements.

The list of ConfigElements is representing a sequence of actions in the output xml

ConfigElement acts like a model, where the corresponding ConfigElementEditor is the editor.

Version:
5.4.2
Author:
Istvan Rabel, Attila Szabo

Field Summary
static java.awt.datatransfer.DataFlavor FLAVOR
          object data flavor
static java.lang.String PROPERTY_KEY_DEFAULTICON
          property key for default icon attribute
static java.lang.String PROPERTY_KEY_DISABLEDICON
          property key for disabled icon attribute
static java.lang.String PROPERTY_KEY_EDITABLE
          property key for editable state
static java.lang.String PROPERTY_KEY_HELPTEXT
          property key for helptext attribute
static java.lang.String PROPERTY_KEY_ICON
          property key for icon attribute
static java.lang.String PROPERTY_KEY_ID
          property key for id attribute
static java.lang.String PROPERTY_KEY_NAME
          property key for name attribute
static java.lang.String PROPERTY_KEY_TOOLTIP
          property key for tooltip attribute
static java.lang.String PROPERTY_KEY_VALID
          property key for valid state
 
Constructor Summary
ConfigElement()
          Constructs a config element.
ConfigElement(java.lang.String id)
          Constructs a config element with the specified id
ConfigElement(java.lang.String id, java.lang.String name)
          Constructs a config element with the specified id and name
ConfigElement(java.lang.String id, java.lang.String name, javax.swing.Icon icon)
          Constructs a config element with the specified id, name and icon
ConfigElement(java.lang.String id, java.lang.String name, javax.swing.Icon icon, javax.swing.ImageIcon disabledIcon, java.lang.String tooltip, java.lang.String helpText)
          Constructs a config element with the specified id, name, icon, disabled icon and tooltip
ConfigElement(java.lang.String id, java.lang.String name, javax.swing.Icon icon, java.lang.String tooltip)
          Constructs a config element with the specified id, name, icon and tooltip
ConfigElement(java.lang.String id, java.lang.String name, javax.swing.Icon icon, java.lang.String tooltip, java.lang.String helpText)
          Constructs a config element with the specified id, name, icon and tooltip
 
Method Summary
 void addGroup(java.lang.String groupName)
          Sets this element as a member of given group
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener for a specific property.
 void addTag(java.lang.String tag)
          Adds a tag for this element
 ConfigElement clone()
           
 ConfigElement cloneElement()
          Deprecated. use clone() Returns a clone of the element, or null if clone not supported
 javax.swing.Icon getDefaultIcon()
          Returns the default icon of the element
 javax.swing.ImageIcon getDisabledIcon()
          Returns the disabled icon of the element (or null if not set)
 java.lang.String[] getGroups()
          Returns the group names this element is a member of
 java.lang.String getHelpText()
          Returns the help text of the element
 javax.swing.Icon getIcon()
          Returns the icon of the element, or the warning icon if element is at invalid state
 java.lang.String getId()
          Returns the id of the element
 java.lang.String getLicenseName()
          Returns the name of required license, or null
 java.lang.String getName()
          Returns the name of the element
 javax.swing.event.SwingPropertyChangeSupport getPropertyChangeSupport()
          Returns the propertyChangeSupport
 java.lang.String[] getTags()
          Returns the tags of this element
 java.lang.String getTooltip()
          Returns the tooltip of the element
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
           
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
           
 boolean hasGroup(java.lang.String groupName)
          Returns true if element is in group
 boolean hasGroups()
          Returns true if element has any groups
 boolean hasTag(java.lang.String tag)
          Returns true if element has the tag
 boolean hasTags()
          Returns true if element has any tags
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
           
abstract  boolean isDefault()
          Returns if config element is at default state
 boolean isEditable()
          Returns if config element is editable
 boolean isLicensed()
          Returns true if the action represented by this element with current license settings can be used
 boolean isValid()
          Returns the current validity state
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 void setDefaultIcon(javax.swing.Icon icon)
          Sets the icon of the element
 void setDisabledIcon(javax.swing.ImageIcon disabledIcon)
          Sets the disabled icon
 void setEditable(boolean editable)
          Sets if config element is editable
 void setHelpText(java.lang.String helpText)
          Sets the help text of the element
 void setId(java.lang.String id)
          Sets the id of the element
 void setLicensed(boolean licensed)
          Sets if the action represented by this element with current license settings can be used
 void setLicenseName(java.lang.String licenseName)
          Sets the license name required for this element
 void setName(java.lang.String name)
          Sets the name of the element
 void setPropertyChangeSupport(javax.swing.event.SwingPropertyChangeSupport propertyChangeSupport)
          Sets the propertyChangeSupport
 void setTooltip(java.lang.String tooltip)
          Sets the tooltip of the element
protected  void setValid(boolean valid)
          Sets the validity state Property change event for PROPERTY_KEY_VALID property will be fired if necessary.
 void store(org.dom4j.Element parent)
          This method adds the xml representation of ConfigElement to the parent element
protected  org.dom4j.Element store(org.dom4j.Element parent, java.lang.String xmlTag)
          This method adds the xml representation of ConfigElement to the parent element with the specified name
protected abstract  void validate()
          This method should be called after modifications occured in model.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLAVOR

public static final java.awt.datatransfer.DataFlavor FLAVOR
object data flavor


PROPERTY_KEY_VALID

public static final java.lang.String PROPERTY_KEY_VALID
property key for valid state

See Also:
Constant Field Values

PROPERTY_KEY_EDITABLE

public static final java.lang.String PROPERTY_KEY_EDITABLE
property key for editable state

See Also:
Constant Field Values

PROPERTY_KEY_ID

public static final java.lang.String PROPERTY_KEY_ID
property key for id attribute

See Also:
Constant Field Values

PROPERTY_KEY_NAME

public static final java.lang.String PROPERTY_KEY_NAME
property key for name attribute

See Also:
Constant Field Values

PROPERTY_KEY_ICON

public static final java.lang.String PROPERTY_KEY_ICON
property key for icon attribute

See Also:
Constant Field Values

PROPERTY_KEY_DISABLEDICON

public static final java.lang.String PROPERTY_KEY_DISABLEDICON
property key for disabled icon attribute

See Also:
Constant Field Values

PROPERTY_KEY_DEFAULTICON

public static final java.lang.String PROPERTY_KEY_DEFAULTICON
property key for default icon attribute

See Also:
Constant Field Values

PROPERTY_KEY_TOOLTIP

public static final java.lang.String PROPERTY_KEY_TOOLTIP
property key for tooltip attribute

See Also:
Constant Field Values

PROPERTY_KEY_HELPTEXT

public static final java.lang.String PROPERTY_KEY_HELPTEXT
property key for helptext attribute

See Also:
Constant Field Values
Constructor Detail

ConfigElement

public ConfigElement()
Constructs a config element.


ConfigElement

public ConfigElement(java.lang.String id)
Constructs a config element with the specified id

Parameters:
id - is the element id

ConfigElement

public ConfigElement(java.lang.String id,
                     java.lang.String name)
Constructs a config element with the specified id and name

Parameters:
id - is the element id
name - is the name of the element

ConfigElement

public ConfigElement(java.lang.String id,
                     java.lang.String name,
                     javax.swing.Icon icon)
Constructs a config element with the specified id, name and icon

Parameters:
id - is the element id
name - is the name of the element
icon - is the icon of the element

ConfigElement

public ConfigElement(java.lang.String id,
                     java.lang.String name,
                     javax.swing.Icon icon,
                     java.lang.String tooltip)
Constructs a config element with the specified id, name, icon and tooltip

Parameters:
id - is the element id
name - is the name of the element
icon - is the icon of the element
tooltip - is the tooltip of the element

ConfigElement

public ConfigElement(java.lang.String id,
                     java.lang.String name,
                     javax.swing.Icon icon,
                     java.lang.String tooltip,
                     java.lang.String helpText)
Constructs a config element with the specified id, name, icon and tooltip

Parameters:
id - is the element id
name - is the name of the element
icon - is the icon of the element
tooltip - is the tooltip of the element
helpText - is the detailed help text of the element

ConfigElement

public ConfigElement(java.lang.String id,
                     java.lang.String name,
                     javax.swing.Icon icon,
                     javax.swing.ImageIcon disabledIcon,
                     java.lang.String tooltip,
                     java.lang.String helpText)
Constructs a config element with the specified id, name, icon, disabled icon and tooltip

Parameters:
id - is the element id
name - is the name of the element
icon - is the icon of the element
disabledIcon - is the disabled icon of the element
tooltip - is the tooltip of the element
helpText - is the detailed help text of the element
Method Detail

getName

public java.lang.String getName()
Returns the name of the element

Returns:
the name of the element

setName

public void setName(java.lang.String name)
Sets the name of the element

Parameters:
name - is the new name

getIcon

public javax.swing.Icon getIcon()
Returns the icon of the element, or the warning icon if element is at invalid state

Returns:
the icon of the element, or the warning icon if element is at invalid state

getDisabledIcon

public javax.swing.ImageIcon getDisabledIcon()
Returns the disabled icon of the element (or null if not set)

Returns:
the disabled icon of the element (or null if not set)

setDisabledIcon

public void setDisabledIcon(javax.swing.ImageIcon disabledIcon)
Sets the disabled icon

Parameters:
disabledIcon - is the new disabled icon

setDefaultIcon

public void setDefaultIcon(javax.swing.Icon icon)
Sets the icon of the element

Parameters:
icon - is the new icon

getDefaultIcon

public javax.swing.Icon getDefaultIcon()
Returns the default icon of the element

Returns:
the default icon of the element
See Also:
getIcon()

getTooltip

public java.lang.String getTooltip()
Returns the tooltip of the element

Returns:
the tooltip of the element

setTooltip

public void setTooltip(java.lang.String tooltip)
Sets the tooltip of the element

Parameters:
tooltip - is the new tooltip

getId

public java.lang.String getId()
Returns the id of the element

Returns:
the id

setId

public void setId(java.lang.String id)
Sets the id of the element

Parameters:
id - is the new id

getHelpText

public java.lang.String getHelpText()
Returns the help text of the element

Returns:
the help text of the element

setHelpText

public void setHelpText(java.lang.String helpText)
Sets the help text of the element

Parameters:
helpText - is the new helptext

isEditable

public boolean isEditable()
Returns if config element is editable

Returns:
if config element is editable

setEditable

public void setEditable(boolean editable)
Sets if config element is editable

Parameters:
editable - is the new value

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Parameters:
listener - The PropertyChangeListener to be added

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.

Parameters:
propertyName - The name of the property to listen on
listener - The PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The PropertyChangeListener to be removed

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property.

Parameters:
propertyName - The name of the property that was listened on
listener - The PropertyChangeListener to be removed

isValid

public boolean isValid()
Returns the current validity state

Returns:
the current validity state

setValid

protected void setValid(boolean valid)
Sets the validity state Property change event for PROPERTY_KEY_VALID property will be fired if necessary.

Parameters:
valid - is the new validity state

validate

protected abstract void validate()
This method should be called after modifications occured in model.
Checks the config element, and calls setValid(boolean)


store

public void store(org.dom4j.Element parent)
This method adds the xml representation of ConfigElement to the parent element

Parameters:
parent - is the parent element of this tag

store

protected org.dom4j.Element store(org.dom4j.Element parent,
                                  java.lang.String xmlTag)
This method adds the xml representation of ConfigElement to the parent element with the specified name

Parameters:
parent - is the parent element
xmlTag - is the name which is used to add this element
Returns:
the newly created element

isDefault

public abstract boolean isDefault()
Returns if config element is at default state

Returns:
if config element is at default state

addGroup

public void addGroup(java.lang.String groupName)
Sets this element as a member of given group

Parameters:
groupName - is the name of the group

getGroups

public java.lang.String[] getGroups()
Returns the group names this element is a member of

Returns:
the group names this element is a member of

hasGroup

public boolean hasGroup(java.lang.String groupName)
Returns true if element is in group

Parameters:
groupName - is the name of the group
Returns:
true if element is in group

hasGroups

public boolean hasGroups()
Returns true if element has any groups

Returns:
true if element has any groups

addTag

public void addTag(java.lang.String tag)
Adds a tag for this element

Parameters:
tag - is the tag to set
Since:
5.4

getTags

public java.lang.String[] getTags()
Returns the tags of this element

Returns:
the tags of this element
Since:
5.4

hasTag

public boolean hasTag(java.lang.String tag)
Returns true if element has the tag

Parameters:
tag - is the tag being checked
Returns:
true if element has the tag
Since:
5.4

hasTags

public boolean hasTags()
Returns true if element has any tags

Returns:
true if element has any tags
Since:
5.4

isLicensed

public boolean isLicensed()
Returns true if the action represented by this element with current license settings can be used

Returns:
true if license is available, or not needed at all.

setLicensed

public void setLicensed(boolean licensed)
Sets if the action represented by this element with current license settings can be used

Parameters:
licensed - is the new value

getLicenseName

public java.lang.String getLicenseName()
Returns the name of required license, or null

Returns:
the name of required license, or null

setLicenseName

public void setLicenseName(java.lang.String licenseName)
Sets the license name required for this element

Parameters:
licenseName - the name of the specific license

cloneElement

@Deprecated
public ConfigElement cloneElement()
Deprecated. use clone() Returns a clone of the element, or null if clone not supported

Returns:
a clone of the element, or null if clone not supported

setPropertyChangeSupport

public void setPropertyChangeSupport(javax.swing.event.SwingPropertyChangeSupport propertyChangeSupport)
Sets the propertyChangeSupport

Parameters:
propertyChangeSupport - the propertyChangeSupport to set

getPropertyChangeSupport

public javax.swing.event.SwingPropertyChangeSupport getPropertyChangeSupport()
Returns the propertyChangeSupport

Returns:
the propertyChangeSupport

clone

public ConfigElement clone()
                    throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException