com.tensegrity.gui.component
Interface AttributeEditor

All Known Subinterfaces:
AttributeEditorContainer, AttributeTable, AttributeTableContainer, AttributeTree, AttributeTreeContainer
All Known Implementing Classes:
CopyOfSwtAttributeTable, SwingAttributeTable, SwingAttributeTableContainer, SwingAttributeTree, SwingAttributeTreeContainer, SwtAttributeTree, SwtAttributeTreeContainer

public interface AttributeEditor

The AttributeEditor interface defines a GUI component which is used to display the AttributeSet of an AttributableOnSet.

There are basically two different subtypes of AttributeEditor, which can be determined at runtime by calling the method isTree(). See AttributeTree and AttributeTable for more details.

Use method setAttributableOnSet() to assign an AttributableOnSet instance to this AttributeEditor. Once the AttributableOnSet is assigned, its attributes are displayed in the AttributeEditor gui component.

To update the values of the AttributeEditor invoke its method rehash().

An AttributeEditor edits any AttributeSet retrieved from an AttributableOnSet. To access the currently assigned instance you can use the following methods:

The AttributeEditor can be configured by using the AttributeEditorProperties that contain sort modes, visibility settings and generic properties that can be defined by the specific implementation.

In addition to the above there are these methods that control the edit and update behavior:

Version:
$Id: AttributeEditor.java,v 1.16 2005/10/21 12:18:56 KevinCVS Exp $
Author:
Stepan Rutz, MichaelKegel, BurkhardWick

Field Summary
static java.lang.String hiddenPrefix
          Prefix for attributes which should not be shown in the table.
static int SORT_ASCENDING
          Deprecated. use AttributeEditorProperties.SORTMODE_ASCENDING !
static int SORT_DESCENDING
          Deprecated. use AttributeEditorProperties.SORTMODE_DESCENDING !
static int SORT_NONE
          Deprecated. use AttributeEditorProperties.SORTMODE_NONE !
 
Method Summary
 void cancelEditing()
          Cancels editing and discards changes.
 AttributableOnSet getAttributableOnSet()
          Returns the current AttributableOnSet.
 AttributeSet getCurrentAttributeSet()
          Returns the currently active AttributeSet.
 AttributeEditorProperties getEditorProperties()
          This method returns an instance of the currently used AttributeTableProperties instance.
 void hideAttribute(java.lang.String name)
          Hides the attribute identified by the given name.
 boolean isTree()
          Returns true, if this editor is displaying an AttributeTree and will call get/setAttributesTree() instead of get/setAttributes().
 void propertiesChanged()
          Called from the AttributeEditorProperties when a setting changed.
 void rehash()
          Reloads the AttributeSet from the AttributableOnSet and refreshes the view.
 void setAttributableOnSet(AttributableOnSet attributable)
          Sets the AttributableOnSet that should be shown in the editor.
 AttributeEditorProperties setEditorProperties(AttributeEditorProperties editorProperties)
          This method sets an instance of the AttributeTableProperties to be used.
 void showAttribute(java.lang.String name)
          Toggles the hidden flag for an attribute identified by the given name.
 boolean stopEditing()
          Stops the editing of an Attribute and saves the current value.
 

Field Detail

SORT_NONE

public static final int SORT_NONE
Deprecated. use AttributeEditorProperties.SORTMODE_NONE !

Sorting constant: No sorting

See Also:
Constant Field Values

SORT_ASCENDING

public static final int SORT_ASCENDING
Deprecated. use AttributeEditorProperties.SORTMODE_ASCENDING !

Sorting constant: Sort ascending

See Also:
Constant Field Values

SORT_DESCENDING

public static final int SORT_DESCENDING
Deprecated. use AttributeEditorProperties.SORTMODE_DESCENDING !

Sorting constant: Sort descending

See Also:
Constant Field Values

hiddenPrefix

public static final java.lang.String hiddenPrefix
Prefix for attributes which should not be shown in the table. If an attribute name starts with the hiddenPrefix, it must be hidden.

See Also:
Constant Field Values
Method Detail

setAttributableOnSet

public void setAttributableOnSet(AttributableOnSet attributable)
Sets the AttributableOnSet that should be shown in the editor. The parameter may be null in which case the editor will be empty.

Parameters:
attributable - the AttributableOnSet to set.

Find more information in the class documentation


getAttributableOnSet

public AttributableOnSet getAttributableOnSet()
Returns the current AttributableOnSet. This might be null.

Returns:
The AttributableOnSet or null, if the editor is empty.

Find more information in the class documentation


getCurrentAttributeSet

public AttributeSet getCurrentAttributeSet()
Returns the currently active AttributeSet. This set is the instance that is currently shown in the editor, while retrieving the AttributableOnSet and calling AttributableOnSet.getAttributes() or AttributableOnSet.getAttributesTree() might return a clone of the AttributeSet. Note: Changes to the AttributeSet will not have an effect on the AttributableOnSet and changes in the structure will not be visible in the editor. Changes will be discarded when an event occurrs that requires reloading the AttributeSet from the AttributableOnSet.

Returns:
AttributeSet The AttributeSet that is currently shown in the editor.

Find more information in the class documentation


hideAttribute

public void hideAttribute(java.lang.String name)
Hides the attribute identified by the given name. Such a name usually describes the full path to that attribute, like: GEOMETRY.X or COMPOSITE.name. This method will just forward the call to AttributeEditorProperties.setVisible(String, boolean)

Parameters:
name - the full name of the attribute.

Find more information in the class documentation


showAttribute

public void showAttribute(java.lang.String name)
Toggles the hidden flag for an attribute identified by the given name. Similar to hideAttribute(String), this name describes the full path to the attribute. This method will just forward the call to AttributeEditorProperties.setVisible(String, boolean)

Parameters:
name - the full name of the attribute.

Find more information in the class documentation


getEditorProperties

public AttributeEditorProperties getEditorProperties()
This method returns an instance of the currently used AttributeTableProperties instance.

Returns:
The properties instance used by this editor

Find more information in the class documentation


setEditorProperties

public AttributeEditorProperties setEditorProperties(AttributeEditorProperties editorProperties)
This method sets an instance of the AttributeTableProperties to be used.

Parameters:
editorProperties - The properties instance that should be used by this editor
Returns:
The properties instance that has been used before

Find more information in the class documentation


propertiesChanged

public void propertiesChanged()
Called from the AttributeEditorProperties when a setting changed. The editor implementation should rehash the attributes whenever this method is called.

Find more information in the class documentation


stopEditing

public boolean stopEditing()
Stops the editing of an Attribute and saves the current value.

Returns:
true, if editing was active

Find more information in the class documentation


cancelEditing

public void cancelEditing()
Cancels editing and discards changes.

Find more information in the class documentation


rehash

public void rehash()
Reloads the AttributeSet from the AttributableOnSet and refreshes the view.

Find more information in the class documentation


isTree

public boolean isTree()
Returns true, if this editor is displaying an AttributeTree and will call get/setAttributesTree() instead of get/setAttributes().

Returns:
true, if this editor is displaying an AttributeTree

Find more information in the class documentation



Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.