com.ibm.commons.swt.data.controls
Class DCPropertyTree

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Tree
                      extended by com.ibm.commons.swt.controls.custom.CustomTree
                          extended by com.ibm.commons.swt.data.controls.DCPropertyTree
All Implemented Interfaces:
ICustomControl, IDataControl, PropertyEditorUpdateListener, org.eclipse.swt.graphics.Drawable

public class DCPropertyTree
extends CustomTree
implements IDataControl, PropertyEditorUpdateListener

SWT tree that acts as a property editor. Each leaf/node in the tree acts as a property editor.


Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
DCPropertyTree(org.eclipse.swt.widgets.Composite parent, int style, java.lang.String id)
          Constructs a new instance of the class given the parent Composite, the style flags which are used to set the look/behavior of the control, and an id property that can be used to programatically identify the control.
 
Method Summary
protected  CustomTooltip createTooltip(TreeNode node, int column, org.eclipse.swt.graphics.Point displayPoint)
           
 void displayTooltip()
          Displays a tooltip at the current location of the cursor
protected  java.lang.String getAttributeName(org.w3c.dom.Node changedNode)
           
 org.eclipse.swt.graphics.Font getBoldFont()
          Returns the bold font used internally by the tree control
 org.eclipse.swt.widgets.Control getControl()
          Returns the current control (this)
 DataChangeNotifier getDataChangeNotifier()
          Returns the DataChangeNotifier associated with this control.
 DataNode getDataNode()
          Returns the DataNode associated with this control.
 ICompositeEditorOptions getEditorOptions(TreeNode node)
          Returns the ICompositeEditorOptions associated with the given TreeNode.
 java.util.List<java.lang.String> getExcludeCategoryFilter()
          Returns a list of strings.
 java.util.List<java.lang.String> getIncludeCategoryFilter()
          Returns a list of strings.
 RootNode getRootNode()
          Returns the root node of the tree.
 void initInstance(ILoader loader, java.lang.Object object)
          Initializes a new instanceof of the tree based on the parameters provided.
protected  void initNameColumn(CustomTreeColumn col)
           
protected  void initValueColumn(CustomTreeColumn col)
           
protected  boolean isAttribute(org.w3c.dom.Node node)
           
 boolean isDisplayCategories()
          Returns whether or not this tree is configured to display categories.
 boolean isReadOnly()
          Returns whether or not the values of the properties in this tree are read-only (default is false).
 boolean isSortProperties()
          Returns whether or not this tree is configured to sort the properties displayed in it.
 void postDisposeEditor(boolean cancel)
           
 void postModelUpdate()
          Called after the model is updated by a property editor.
 void preModelUpdate()
          Called before the model is updated by a property editor
 void refresh()
          Refreshes the entire tree.
 void setDataChangeNotifier(DataChangeNotifier dataChangeNotifier)
          Sets the DataChangeNotifier associated with this control.
 void setDataNode(DataNode dataNode)
          Sets the DataNode associated with this control.
 void setDataNodeBinding(DataNodeBinding dataNodeBinding)
           
 void setDisplayCategories(boolean displayCategories)
          Sets whether or not the tree control will display categories.
 void setExcludeCategoryFilter(java.util.List<java.lang.String> filter)
          The caller passes in a list of strings that will be used by the table as a filter.
 void setIncludeCategoryFilter(java.util.List<java.lang.String> filter)
          The caller passes in a list of strings that will be used by the table as a filter.
 void setListensToDataNode(boolean listensToDataNode)
          Sets whether or not the tree will internally automatically listen to updates to the DataNode (model).
 void setReadOnly(boolean readOnly)
          Sets whether or not the attributes in this tree control are read-only.
 void setSortProperties(boolean sortProperties)
          Sets whether or not this tree control will sort the properties in the tree.
 void setWorkBenchPart(org.eclipse.ui.IWorkbenchPart value)
          Sets the IWorkbenchPart that this control is associated with (in most cases this is the Attributes View, but may also be the current editor part).
 void sourceUpdated(java.lang.Object notifier, int eventType, java.lang.Object changedFeature, java.lang.Object oldValue, java.lang.Object newValue, int pos)
          Called when the source (model) is updated.
 void startEditor()
          Starts the property editor for the currently selected node.
 
Methods inherited from class com.ibm.commons.swt.controls.custom.CustomTree
autoResizeColumns, checkSubclass, computeSize, expand, getCols, getColumnAt, getId, getRows, removeAllColumns, select, setCols, setId, setRows
 
Methods inherited from class org.eclipse.swt.widgets.Tree
addSelectionListener, addTreeListener, clear, clearAll, computeTrim, deselect, deselectAll, getBorderWidth, getClientArea, getColumn, getColumnCount, getColumnOrder, getColumns, getGridLineWidth, getHeaderHeight, getHeaderVisible, getItem, getItem, getItemCount, getItemHeight, getItems, getLinesVisible, getParentItem, getSelection, getSelectionCount, getSortColumn, getSortDirection, getTopItem, indexOf, indexOf, removeAll, removeSelectionListener, removeTreeListener, select, selectAll, setColumnOrder, setHeaderVisible, setInsertMark, setItemCount, setLinesVisible, setRedraw, setSelection, setSelection, setSortColumn, setSortDirection, setTopItem, showColumn, showItem, showSelection
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DCPropertyTree

public DCPropertyTree(org.eclipse.swt.widgets.Composite parent,
                      int style,
                      java.lang.String id)
Constructs a new instance of the class given the parent Composite, the style flags which are used to set the look/behavior of the control, and an id property that can be used to programatically identify the control.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. Style bits are also inherited from superclasses.

Parameters:
parent - a Composite control which will be the parent of the new instance (CANNOT be null).
style - the style of control to construct
id - a String which can be used to programatically identify the control
Method Detail

createTooltip

protected CustomTooltip createTooltip(TreeNode node,
                                      int column,
                                      org.eclipse.swt.graphics.Point displayPoint)

displayTooltip

public void displayTooltip()
Displays a tooltip at the current location of the cursor


getBoldFont

public org.eclipse.swt.graphics.Font getBoldFont()
Returns the bold font used internally by the tree control

Returns:

getControl

public org.eclipse.swt.widgets.Control getControl()
Returns the current control (this)

Specified by:
getControl in interface IDataControl
Returns:
Control

getDataChangeNotifier

public DataChangeNotifier getDataChangeNotifier()
Returns the DataChangeNotifier associated with this control.

Returns:
DataChangeNotifier
See Also:
DataChangeNotifier

getDataNode

public DataNode getDataNode()
Returns the DataNode associated with this control. The DataNode is responsible for providing the model through which the control accesses data.

Returns:
com.ibm.commons.iloader.node.DataNode
See Also:
DataNode

getEditorOptions

public ICompositeEditorOptions getEditorOptions(TreeNode node)
Returns the ICompositeEditorOptions associated with the given TreeNode.

Parameters:
node - - TeeNode The node for which the ICompositeEditorOptions are being requested
Returns:
ICompositeEditorOptions
See Also:
com.ibm.commons.swt.data.editors.support.ICompositeEditorOptions}, {@link com.ibm.commons.swt.data.controls.tabletree.TreeNode}

getRootNode

public RootNode getRootNode()
Returns the root node of the tree.

Returns:
See Also:
RootNode

initInstance

public void initInstance(ILoader loader,
                         java.lang.Object object)
Initializes a new instanceof of the tree based on the parameters provided.

Parameters:
loader -
object -
See Also:
com.ibm.commons.iloader.node.ILoader}

initNameColumn

protected void initNameColumn(CustomTreeColumn col)

initValueColumn

protected void initValueColumn(CustomTreeColumn col)

isDisplayCategories

public boolean isDisplayCategories()
Returns whether or not this tree is configured to display categories.

Returns:

isSortProperties

public boolean isSortProperties()
Returns whether or not this tree is configured to sort the properties displayed in it.

Returns:

isReadOnly

public boolean isReadOnly()
Returns whether or not the values of the properties in this tree are read-only (default is false).

Returns:

postDisposeEditor

public void postDisposeEditor(boolean cancel)

postModelUpdate

public void postModelUpdate()
Description copied from interface: PropertyEditorUpdateListener
Called after the model is updated by a property editor.

Specified by:
postModelUpdate in interface PropertyEditorUpdateListener

preModelUpdate

public void preModelUpdate()
Description copied from interface: PropertyEditorUpdateListener
Called before the model is updated by a property editor

Specified by:
preModelUpdate in interface PropertyEditorUpdateListener

refresh

public void refresh()
Refreshes the entire tree.


setDataChangeNotifier

public void setDataChangeNotifier(DataChangeNotifier dataChangeNotifier)
Sets the DataChangeNotifier associated with this control. The notifier is notified each time the associated model is updated.

Parameters:
dataChangeNotifier -
See Also:
DataChangeNotifier

setDataNode

public void setDataNode(DataNode dataNode)
Sets the DataNode associated with this control. The DataNode is responsible for providing the model through which the control accesses data.

See Also:
DataNode

setDataNodeBinding

public void setDataNodeBinding(DataNodeBinding dataNodeBinding)
Parameters:
dataNodeBinding -
See Also:
DataNodeBinding

setDisplayCategories

public void setDisplayCategories(boolean displayCategories)
Sets whether or not the tree control will display categories.

Parameters:
displayCategories - - boolean

setSortProperties

public void setSortProperties(boolean sortProperties)
Sets whether or not this tree control will sort the properties in the tree.

Parameters:
sortProperties - - boolean

setListensToDataNode

public void setListensToDataNode(boolean listensToDataNode)
Sets whether or not the tree will internally automatically listen to updates to the DataNode (model).

Parameters:
listensToDataNode -
See Also:
com.ibm.commons.iloader.node.DataNode}, {@link com.ibm.commons.iloader.node.DataNodeListener}

setReadOnly

public void setReadOnly(boolean readOnly)
Sets whether or not the attributes in this tree control are read-only.

Parameters:
readOnly -

setWorkBenchPart

public void setWorkBenchPart(org.eclipse.ui.IWorkbenchPart value)
Sets the IWorkbenchPart that this control is associated with (in most cases this is the Attributes View, but may also be the current editor part).

Parameters:
value - - IWorkbenchPart

startEditor

public void startEditor()
Starts the property editor for the currently selected node.


getIncludeCategoryFilter

public java.util.List<java.lang.String> getIncludeCategoryFilter()
Returns a list of strings. The list represents the names of the categories that the caller wishes to see in the table. This method may return null or an empty list in which case the filter is not applied!

Returns:
java.util.List<String>

setIncludeCategoryFilter

public void setIncludeCategoryFilter(java.util.List<java.lang.String> filter)
The caller passes in a list of strings that will be used by the table as a filter. Each string in the list should correspond to a category (or potential category) that the user wishes to display in the table. Categories not specified in the list will be ignored. Calling this method negates any previous call to setExcludeCategoryFilter(List) Likewise any future call to setExcludeCategoryFilter(List) will negate any call to setIncludeCategoryFilter(List).

The exclude and include filters cannot be set in the same tree instance.

Parameters:
filter - - java.util.List<String>

getExcludeCategoryFilter

public java.util.List<java.lang.String> getExcludeCategoryFilter()
Returns a list of strings. The list represents the names of the categories that the caller does not wish to see in the table. This method may return null or an empty list in which case the filter is not applied!

Returns:
java.util.List<String>

setExcludeCategoryFilter

public void setExcludeCategoryFilter(java.util.List<java.lang.String> filter)
The caller passes in a list of strings that will be used by the table as a filter. Each string in the list should correspond to a category (or potential category) that the user does not wish to display in the table. Only categories specified in the list will be included in the table. Calling this method negates any previous call to setIncludeCategoryFilter(List). Likewise any future call to setIncludeCategoryFilter(List) will negate any call to setExcludeCategoryFilter(List).

The exclude and include filters cannot be set in the same tree instance.

Parameters:
filter - - java.util.List

sourceUpdated

public void sourceUpdated(java.lang.Object notifier,
                          int eventType,
                          java.lang.Object changedFeature,
                          java.lang.Object oldValue,
                          java.lang.Object newValue,
                          int pos)
Called when the source (model) is updated.


getAttributeName

protected java.lang.String getAttributeName(org.w3c.dom.Node changedNode)

isAttribute

protected boolean isAttribute(org.w3c.dom.Node node)