org.graffiti.plugin.editcomponent
Class AbstractValueEditComponent

java.lang.Object
  extended by org.graffiti.plugin.editcomponent.ValueEditComponentAdapter
      extended by org.graffiti.plugin.editcomponent.AbstractValueEditComponent
All Implemented Interfaces:
EventListener, AttributeListener, EdgeListener, GraphListener, NodeListener, TransactionListener, ValueEditComponent
Direct Known Subclasses:
AbstractDialogableEditComponent, ComboBoxEditComponent, GraphComponentEditComponent, NumberEditComponent, SpinnerEditComponent, StandardValueEditComponent

public abstract class AbstractValueEditComponent
extends ValueEditComponentAdapter

The class AbstractValueEditComponent provides some generic implementation for ValueEditComponents.

See Also:
ValueEditComponent

Field Summary
protected  JComponent editField
          The field to edit the value of the displayable.
protected  boolean showEmpty
          Set to true if this component should display nothing instead of the value of the attribute it represents.
 
Fields inherited from class org.graffiti.plugin.editcomponent.ValueEditComponentAdapter
displayable, displayables
 
Fields inherited from interface org.graffiti.plugin.editcomponent.ValueEditComponent
EMPTY_STRING
 
Constructor Summary
protected AbstractValueEditComponent()
           
protected AbstractValueEditComponent(Displayable<?> disp)
          Constructs a new AbstractValueEditComponent.
protected AbstractValueEditComponent(Displayable<?>[] disps)
          Constructs a new AbstractValueEditComponent.
 
Method Summary
 void addVECChangeListener(ValueEditComponentListener listener)
          Register a new value edit component listener.
protected  void fireVECChanged()
          Create and fire a new VECChangeEvent.
 void fireVECChanged(VECChangeEvent event)
          Fire a VECChange event.
 Displayable<?> getDisplayable()
          Returns the Attribute instance the current ValueEditComponent contains.
 Displayable<?>[] getDisplayables()
          Returns the Attribute instances the current ValueEditComponent contains.
 boolean getShowEmpty()
          Returns true when this component actually does not represent the value of an attribute.
 boolean isEnabled()
          Returns whether this component allows editing.
 void postAttributeChanged(AttributeEvent e)
          Called after a change of an displayable took place.
 void preAttributeChanged(AttributeEvent e)
          Called before a change of an displayable takes place.
 void removeVECChangeListener(ValueEditComponentListener listener)
          Remove a value edit component listener.
protected abstract  void setDispEditFieldValue()
           
 void setDisplayable(Displayable<?> disp)
          Sets the displayable.
 void setDisplayables(Displayable<?>[] disps)
          Sets the objects that will be displayed.
protected abstract  void setDispValue()
           
 void setEditFieldValue()
          Sets the current value of the Displayable in the corresponding JComponent.
 void setEnabled(boolean enabled)
          Specifies whether this component should allow editing.
 void setShowEmpty(boolean showEmpty)
          Called with a value of true when this component should display nothing instead of the value of its associated displayable.
 void setValue()
          Sets the value of the Displayable specified in the JComponent.
 
Methods inherited from class org.graffiti.plugin.editcomponent.ValueEditComponentAdapter
getErrorMessageOfInvalidParameter, isValid, postAttributeAdded, postAttributeRemoved, postDirectedChanged, postEdgeAdded, postEdgeRemoved, postEdgeReversed, postGraphCleared, postInEdgeAdded, postInEdgeRemoved, postNodeAdded, postNodeRemoved, postOutEdgeAdded, postOutEdgeRemoved, postSourceNodeChanged, postTargetNodeChanged, postUndirectedEdgeAdded, postUndirectedEdgeRemoved, preAttributeAdded, preAttributeRemoved, preDirectedChanged, preEdgeAdded, preEdgeRemoved, preEdgeReversed, preGraphCleared, preInEdgeAdded, preInEdgeRemoved, preNodeAdded, preNodeRemoved, preOutEdgeAdded, preOutEdgeRemoved, preSourceNodeChanged, preTargetNodeChanged, preUndirectedEdgeAdded, preUndirectedEdgeRemoved, transactionFinished, transactionStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.graffiti.plugin.editcomponent.ValueEditComponent
getComponent
 

Field Detail

editField

protected JComponent editField
The field to edit the value of the displayable.


showEmpty

protected boolean showEmpty
Set to true if this component should display nothing instead of the value of the attribute it represents.

Constructor Detail

AbstractValueEditComponent

protected AbstractValueEditComponent()

AbstractValueEditComponent

protected AbstractValueEditComponent(Displayable<?> disp)
Constructs a new AbstractValueEditComponent.

Parameters:
disp - DOCUMENT ME!

AbstractValueEditComponent

protected AbstractValueEditComponent(Displayable<?>[] disps)
Constructs a new AbstractValueEditComponent.

Parameters:
disps - DOCUMENT ME!
Method Detail

setDisplayable

public void setDisplayable(Displayable<?> disp)
Sets the displayable.

Parameters:
disp -

setDisplayables

public void setDisplayables(Displayable<?>[] disps)
Description copied from interface: ValueEditComponent
Sets the objects that will be displayed.

Parameters:
disps - the objects to connect to this component.

getDisplayable

public Displayable<?> getDisplayable()
Returns the Attribute instance the current ValueEditComponent contains.

Returns:
the Attribute instance the current ValueEditComponent contains.

getDisplayables

public Displayable<?>[] getDisplayables()
Returns the Attribute instances the current ValueEditComponent contains.

Returns:
the Attribute instances the current ValueEditComponent contains.

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: ValueEditComponent
Specifies whether this component should allow editing.


isEnabled

public boolean isEnabled()
Description copied from interface: ValueEditComponent
Returns whether this component allows editing.

Returns:
DOCUMENT ME!

setShowEmpty

public void setShowEmpty(boolean showEmpty)
Description copied from interface: ValueEditComponent
Called with a value of true when this component should display nothing instead of the value of its associated displayable. This is used when several displayables use this component but have different values. When set to false, the value of the displayable associated with this component is used.


getShowEmpty

public boolean getShowEmpty()
Description copied from interface: ValueEditComponent
Returns true when this component actually does not represent the value of an attribute.

Returns:
DOCUMENT ME!
See Also:
ValueEditComponent.getShowEmpty()

setEditFieldValue

public void setEditFieldValue()
Description copied from interface: ValueEditComponent
Sets the current value of the Displayable in the corresponding JComponent. If showEmpty is set to true, this component should instead show only empty fields.


setValue

public void setValue()
Description copied from interface: ValueEditComponent
Sets the value of the Displayable specified in the JComponent. Should only change the value if the value is really different otherwise too many events will be sent.


setDispEditFieldValue

protected abstract void setDispEditFieldValue()

setDispValue

protected abstract void setDispValue()

postAttributeChanged

public void postAttributeChanged(AttributeEvent e)
Called after a change of an displayable took place.

Specified by:
postAttributeChanged in interface AttributeListener
Overrides:
postAttributeChanged in class ValueEditComponentAdapter
Parameters:
e - the AttributeEvent detailing the changes.

preAttributeChanged

public void preAttributeChanged(AttributeEvent e)
Called before a change of an displayable takes place.

Specified by:
preAttributeChanged in interface AttributeListener
Overrides:
preAttributeChanged in class ValueEditComponentAdapter
Parameters:
e - the AttributeEvent detailing the changes.

addVECChangeListener

public void addVECChangeListener(ValueEditComponentListener listener)
Description copied from interface: ValueEditComponent
Register a new value edit component listener.

Parameters:
listener - the listener to add.

removeVECChangeListener

public void removeVECChangeListener(ValueEditComponentListener listener)
Description copied from interface: ValueEditComponent
Remove a value edit component listener.

Parameters:
listener - the listener to remove.

fireVECChanged

protected void fireVECChanged()
Create and fire a new VECChangeEvent.


fireVECChanged

public void fireVECChanged(VECChangeEvent event)
Description copied from interface: ValueEditComponent
Fire a VECChange event.

Parameters:
event - the event to fire.


Generated at 2012-05-30 11:00:36 PM CEST