net.sourceforge.java.util.gui.jface.viewers
Class TreeCellModifier

java.lang.Object
  extended bynet.sourceforge.java.util.gui.jface.viewers.TreeCellModifier
All Implemented Interfaces:
ICellModifier

public class TreeCellModifier
extends Object
implements ICellModifier

Handles inplace modificatons, i.e. user edits within cell elements in a editable JFace TreeViewer instance displaying INameable domain objects.

Author:
Sebastian Machhausen

Field Summary
private  boolean modificationEnabled
           true if modification is enabled; false if disabled
 
Constructor Summary
TreeCellModifier()
           
 
Method Summary
 boolean canModify(Object element, String property)
           Checks whether the given property of the given element can be modified.
 Object getValue(Object element, String property)
           Returns the value for the given property of the given element.
 void modify(Object element, String property, Object value)
           Modifies the value for the given property of the given element.
 void setModificationEnabled(boolean enabled)
           Sets the modification mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modificationEnabled

private boolean modificationEnabled

true if modification is enabled; false if disabled

Constructor Detail

TreeCellModifier

public TreeCellModifier()
Method Detail

canModify

public boolean canModify(Object element,
                         String property)

Checks whether the given property of the given element can be modified.

Specified by:
canModify in interface ICellModifier
Parameters:
element - the element
property - the property
Returns:
true if the property can be modified, and false if it is not modifiable

setModificationEnabled

public void setModificationEnabled(boolean enabled)

Sets the modification mode.

Parameters:
enabled - true to enable; false to disable modification mode

getValue

public Object getValue(Object element,
                       String property)

Returns the value for the given property of the given element. Returns null if the element does not have the given property.

Specified by:
getValue in interface ICellModifier
Parameters:
element - the element to get the value for
property - the property
Returns:
the property value

modify

public void modify(Object element,
                   String property,
                   Object value)

Modifies the value for the given property of the given element. Has no effect if the element does not have the given property, or if the property cannot be modified.

Specified by:
modify in interface ICellModifier
Parameters:
element - the model element or SWT Item (see above)
property - the property
value - the new property value
See Also:
Item