com.tensegrity.skeleton.container.swt
Class SwtAttributeTreeContainer

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended bycom.tensegrity.skeleton.swt.container.AbstractSwtToolContainer
                      extended bycom.tensegrity.skeleton.container.swt.SwtAttributeTreeContainer
All Implemented Interfaces:
AttributeEditor, AttributeEditorContainer, AttributeTreeContainer, Container, org.eclipse.swt.graphics.Drawable, ToolContainer

public class SwtAttributeTreeContainer
extends AbstractSwtToolContainer
implements AttributeTreeContainer

This is the SWT implementation of the AttributeTreeContainer interface.

This Composite is initialized in the init() method with a GridLayout.

This container internally holds an instance of SwtAttributeTree which can be accessed by means of the getAttributeTree() and getAttributeEditor() methods.

It is important to notice that since no assumption can be made upon which type of Layout is set on the parent of this AbstractSwtToolContainer, it is the caller's responsability to set its layout data.

Refer to the Widget.dispose() method for more information.

Version:
$Id: SwtAttributeTreeContainer.java,v 1.9 2005/09/19 14:22:41 ArndHouben Exp $
Author:
S�bastien Guyon

Field Summary
 
Fields inherited from class com.tensegrity.skeleton.swt.container.AbstractSwtToolContainer
isSelected
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Fields inherited from interface com.tensegrity.gui.component.AttributeEditor
hiddenPrefix, SORT_ASCENDING, SORT_DESCENDING, SORT_NONE
 
Constructor Summary
SwtAttributeTreeContainer(ApplicationFrame applicationFrame, org.eclipse.swt.widgets.Composite parent, int style)
           This constructor simply forwards its call to the constructor of the parent class.
 
Method Summary
 void cancelEditing()
          Cancels editing and discards changes.
 AttributableOnSet getAttributableOnSet()
          Returns the current AttributableOnSet.
 AttributeEditor getAttributeEditor()
          Each AttributeTableContainer should be based on a AttributeEditor implementation.
 AttributeTree getAttributeTree()
          Each AttributeTreeContainer should be based on a AttributeTree implementation.
 AttributeSet getCurrentAttributeSet()
          Returns the currently active AttributeSet.
 AttributeEditorProperties getEditorProperties()
          This method returns an instance of the currently used AttributeTableProperties instance.
 java.lang.String getName()
          A container has a name.
 void hideAttribute(java.lang.String name)
          Hides the attribute identified by the given name.
 void init()
          Subclasses implement this method to start their initialization code.
 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 setName(java.lang.String s)
          Sets the name of this container.
 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.
 
Methods inherited from class com.tensegrity.skeleton.swt.container.AbstractSwtToolContainer
getApplicationFrame, getHeight, getUiManager, getWidth, repaint, setSelected, setUiManager
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, computeSize, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.tensegrity.gui.container.Container
getApplicationFrame, setSelected
 

Constructor Detail

SwtAttributeTreeContainer

public SwtAttributeTreeContainer(ApplicationFrame applicationFrame,
                                 org.eclipse.swt.widgets.Composite parent,
                                 int style)

This constructor simply forwards its call to the constructor of the parent class.

Parameters:
applicationFrame - Enclosing ApplicationFrame
parent - a widget which will be the parent of the new instance (cannot be null)
style - the style of widget to construct
Method Detail

init

public void init()
Description copied from class: AbstractSwtToolContainer
Subclasses implement this method to start their initialization code. This method is called from within the constructor of this class.

Specified by:
init in class AbstractSwtToolContainer

getName

public java.lang.String getName()
Description copied from interface: Container
A container has a name. This name can be used for title elements, menu entries or within any other component which refers to this container.

Specified by:
getName in interface Container
Returns:
the name of the container.

setAttributableOnSet

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

Specified by:
setAttributableOnSet in interface AttributeEditor
Parameters:
attributable - the AttributableOnSet to set.

getAttributableOnSet

public AttributableOnSet getAttributableOnSet()
Description copied from interface: AttributeEditor
Returns the current AttributableOnSet. This might be null.

Specified by:
getAttributableOnSet in interface AttributeEditor
Returns:
The AttributableOnSet or null, if the editor is empty.

getCurrentAttributeSet

public AttributeSet getCurrentAttributeSet()
Description copied from interface: AttributeEditor
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.

Specified by:
getCurrentAttributeSet in interface AttributeEditor
Returns:
AttributeSet The AttributeSet that is currently shown in the editor.

stopEditing

public boolean stopEditing()
Description copied from interface: AttributeEditor
Stops the editing of an Attribute and saves the current value.

Specified by:
stopEditing in interface AttributeEditor
Returns:
true, if editing was active

cancelEditing

public void cancelEditing()
Description copied from interface: AttributeEditor
Cancels editing and discards changes.

Specified by:
cancelEditing in interface AttributeEditor

rehash

public void rehash()
Description copied from interface: AttributeEditor
Reloads the AttributeSet from the AttributableOnSet and refreshes the view.

Specified by:
rehash in interface AttributeEditor

hideAttribute

public void hideAttribute(java.lang.String name)
Description copied from interface: AttributeEditor
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)

Specified by:
hideAttribute in interface AttributeEditor
Parameters:
name - the full name of the attribute.

showAttribute

public void showAttribute(java.lang.String name)
Description copied from interface: AttributeEditor
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)

Specified by:
showAttribute in interface AttributeEditor
Parameters:
name - the full name of the attribute.

getEditorProperties

public AttributeEditorProperties getEditorProperties()
Description copied from interface: AttributeEditor
This method returns an instance of the currently used AttributeTableProperties instance.

Specified by:
getEditorProperties in interface AttributeEditor
Returns:
The properties instance used by this editor

setEditorProperties

public AttributeEditorProperties setEditorProperties(AttributeEditorProperties editorProperties)
Description copied from interface: AttributeEditor
This method sets an instance of the AttributeTableProperties to be used.

Specified by:
setEditorProperties in interface AttributeEditor
Parameters:
editorProperties - The properties instance that should be used by this editor
Returns:
The properties instance that has been used before

getAttributeTree

public AttributeTree getAttributeTree()
Description copied from interface: AttributeTreeContainer
Each AttributeTreeContainer should be based on a AttributeTree implementation. Thus this instance is returned by this method.

Specified by:
getAttributeTree in interface AttributeTreeContainer
Returns:
The attribute tree of this container

getAttributeEditor

public AttributeEditor getAttributeEditor()
Description copied from interface: AttributeEditorContainer
Each AttributeTableContainer should be based on a AttributeEditor implementation. Thus this instance is returned by this method.

Specified by:
getAttributeEditor in interface AttributeEditorContainer
Returns:
The attribute editor of this container

setName

public void setName(java.lang.String s)
Description copied from interface: Container
Sets the name of this container.

Specified by:
setName in interface Container
Specified by:
setName in class AbstractSwtToolContainer
Parameters:
s - the new name for this container.

propertiesChanged

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

Specified by:
propertiesChanged in interface AttributeEditor

isTree

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

Specified by:
isTree in interface AttributeEditor
Returns:
true, if this editor is displaying an AttributeTree


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