com.tssap.util.ui.reuse.tree
Class TreeSelector

java.lang.Object
  |
  +--com.tssap.util.ui.AbstractEditable
        |
        +--com.tssap.util.ui.reuse.GenericComponent
              |
              +--com.tssap.util.ui.reuse.tree.TreeSelector
All Implemented Interfaces:
IEditable, IGenericComponent, IGridLayoutPaneContainer, IReuseable, ITreeSelector

public class TreeSelector
extends GenericComponent
implements ITreeSelector


Constructor Summary
TreeSelector()
          Default constructor.
TreeSelector(boolean hasAddRemoveButtons)
          Constructor to hide "Add"/"Remove" buttons
TreeSelector(java.lang.String title)
           
TreeSelector(java.lang.String title, boolean hasAddRemoveButtons)
          Constructor to hide "Add"/"Remove" buttons and set title
 
Method Summary
 IReuseableManager getReusableManager()
          Retruns the currently used @see IReuseableManager.
 ISelectionConverter getSelectionConverter()
          Returns the selectionConverter.
 int getSplitterWeight()
          Returns the splitterWeight last set to this TreeSelector.
 org.eclipse.jface.viewers.ITreeContentProvider getTreeContentProvider()
           
 java.lang.Object getTreeInput()
          Returns the last set tree input.
 org.eclipse.jface.viewers.ILabelProvider getTreeLabelProvider()
           
 org.eclipse.jface.viewers.TreeViewer getTreeViewer()
          Returns the TreeViewer displayed on the left hand side of the component.
 int getUserGridNumOfColumns()
          Returns number of columns for userArea given to method initContainer(IGridLayoutPane userArea)
 org.eclipse.jface.viewers.ViewerSorter getViewerSorter()
          Returns currently used sorter.
 void initContainer(IGridLayoutPane userArea)
          Initialize component's UI.
 boolean isUserGridEqualColSize()
          Returns true if userArea given to method initContainer(IGridLayoutPane userArea) has to have equal column widths
 void refreshTree()
          Delegation method.
 void refreshTree(boolean refreshLabels)
          Delegation method.
 void setEnabled(boolean enabled)
          Set whether or not the component and all its subcomponents are enabled.
 void setMessageText(java.lang.String text)
          Set the status line text
 void setReusableManager(IReuseableManager manager)
          The IReusableManager defining the mapping between the Object selected in the tree and the corresponding UI component to be displayed on the right hand side.
 void setSelection(java.lang.Object objToSelect)
          Set's the selection in the tree to the given Element.
 void setSelectionConverter(ISelectionConverter selectionConverter)
           
 void setSplitterWeight(int splitterWeight)
          Sets the splitterWeight of the right side pane.
 void setTreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider myContentProvider)
          The ContentProvider used for the left side tree
 void setTreeInput(java.lang.Object treeInput)
          Delegation method.
 void setTreeLabelProvider(org.eclipse.jface.viewers.ILabelProvider myLabelProvider)
          The LabelProvider used for the left side tree
 void setTreeSelectorCallback(ITreeSelectorCallback callback)
          The @see ITreeSelectorCallback allows to get control on same events in the component and to provide the necessary actions.
 void setViewerSorter(org.eclipse.jface.viewers.ViewerSorter viewerSorter)
          Delegation methods.
 void updateButtonState()
          The ITreeSelectorCallback @see #setTreeSelectorCallback(ITreeSelectorCallback) handles the "Add"/"Remove"button state.
 
Methods inherited from class com.tssap.util.ui.reuse.GenericComponent
addModifyListener, addSelectionListener, createPartControl, createPartControl, createPartControl, getTitle, getUserAreaGridLayoutPane, isComposable, isEnabled, refresh, removeModifyListener, removeSelectionListener, setTitle
 
Methods inherited from class com.tssap.util.ui.AbstractEditable
isEditable, setEditable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tssap.util.ui.reuse.IGenericComponent
addModifyListener, addSelectionListener, createPartControl, createPartControl, getTitle, refresh, removeModifyListener, removeSelectionListener, setTitle
 
Methods inherited from interface com.tssap.util.ui.IEditable
isEditable, setEditable
 
Methods inherited from interface com.tssap.util.ui.reuse.IReuseable
createPartControl, isEnabled
 

Constructor Detail

TreeSelector

public TreeSelector()
Default constructor. (No title, with "Add"/"Remove" buttons)

TreeSelector

public TreeSelector(java.lang.String title)
Parameters:
title - this GenericComponent tilte
See Also:
GenericComponent

TreeSelector

public TreeSelector(boolean hasAddRemoveButtons)
Constructor to hide "Add"/"Remove" buttons
Parameters:
hasAddRemoveButtons - show or hide "Add"/"Remove" buttons

TreeSelector

public TreeSelector(java.lang.String title,
                    boolean hasAddRemoveButtons)
Constructor to hide "Add"/"Remove" buttons and set title
Parameters:
title - this GenericComponent tilte
hasAddRemoveButtons - show or hide "Add"/"Remove" buttons
Method Detail

setSelection

public void setSelection(java.lang.Object objToSelect)
Set's the selection in the tree to the given Element. DO NEVER USE getTreeViewer().setSelection(...)
Parameters:
objToSelect - the Object to select in the tree

initContainer

public void initContainer(IGridLayoutPane userArea)
Description copied from interface: IGridLayoutPaneContainer
Initialize component's UI. Implementor has to fill the given grid layout pane. The number of columns comes from call to method getUserGridNumOfColumns(). If grid columns have equal widths is decided through call to isUserGridEqualColSize().
Specified by:
initContainer in interface IGridLayoutPaneContainer
See Also:
IGridLayoutPaneContainer.initContainer(IGridLayoutPane)

getReusableManager

public IReuseableManager getReusableManager()
Retruns the currently used @see IReuseableManager.
Specified by:
getReusableManager in interface ITreeSelector
Returns:
the currently used IReuseableManager. Never null.

setReusableManager

public void setReusableManager(IReuseableManager manager)
The IReusableManager defining the mapping between the Object selected in the tree and the corresponding UI component to be displayed on the right hand side. When a selection is made in the Tree the SelectionConverter @see #setSelectionConverter(ISelectionConverter selectionConverter) is called with the selected Object. The result is given to the @see IReuseableManager which returns the UI cmponent to be displayed on the right side.
Specified by:
setReusableManager in interface ITreeSelector
Parameters:
manager - the IReuseableManager to be used

getTreeViewer

public org.eclipse.jface.viewers.TreeViewer getTreeViewer()
Returns the TreeViewer displayed on the left hand side of the component. This method is provided for special needs only. DO NOT USE THE VIEWER TO CALL METHODS ALSO AVAILIBLE IN THIS CLASS LIKE @see #setSelection(Object), @see #setTreeInput(Object), @see #setTreeLabelProvider(ILabelProvider)...
Specified by:
getTreeViewer in interface ITreeSelector
Returns:
the TreeViewer displayed on the left hand side of the component

getSelectionConverter

public ISelectionConverter getSelectionConverter()
Returns the selectionConverter.
Returns:
ISelectionConverter the selectionConverter currently used. Never null.

setSelectionConverter

public void setSelectionConverter(ISelectionConverter selectionConverter)
Parameters:
selectionConverter - the selectionConverter to use
See Also:
setReusableManager(IReuseableManager)

getSplitterWeight

public int getSplitterWeight()
Returns the splitterWeight last set to this TreeSelector.
Returns:
int
See Also:
setSplitterWeight(int)

setSplitterWeight

public void setSplitterWeight(int splitterWeight)
Sets the splitterWeight of the right side pane. The tree on the left will get the weight 1.
Parameters:
splitterWeight - splitterWeight for the right side relative to the tree on the left which will get weight 1

getViewerSorter

public org.eclipse.jface.viewers.ViewerSorter getViewerSorter()
Returns currently used sorter.
Returns:
ViewerSorter may be null when default sorter is used
See Also:
setViewerSorter(ViewerSorter)

setViewerSorter

public void setViewerSorter(org.eclipse.jface.viewers.ViewerSorter viewerSorter)
Delegation methods. Sets the sorter to be used in the tree.
Parameters:
myViewerSorter - sorter to use in the tree
See Also:
StructuredViewer#setSorter(org.eclipse.jface.viewers.ViewerSorter)

getTreeInput

public java.lang.Object getTreeInput()
Returns the last set tree input.
Returns:
Object the last set tree input
See Also:
setTreeInput(Object)

setTreeInput

public void setTreeInput(java.lang.Object treeInput)
Delegation method. Set the input to the treeViewer.
Parameters:
treeInput - The treeInput to set
See Also:
StructuredViewer#setInput(java.lang.Object)

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: IReuseable
Set whether or not the component and all its subcomponents are enabled.
Specified by:
setEnabled in interface IReuseable
Overrides:
setEnabled in class GenericComponent
See Also:
IReuseable.setEnabled(boolean)

refreshTree

public void refreshTree()
Delegation method. Refreshes the tree on the left.
See Also:
StructuredViewer#refresh()

refreshTree

public void refreshTree(boolean refreshLabels)
Delegation method. Refreshes the tree on the left.
Parameters:
refreshLabels -  
See Also:
StructuredViewer#refresh()

updateButtonState

public void updateButtonState()
The ITreeSelectorCallback @see #setTreeSelectorCallback(ITreeSelectorCallback) handles the "Add"/"Remove"button state. This method force an update of the state

getUserGridNumOfColumns

public int getUserGridNumOfColumns()
Description copied from interface: IGridLayoutPaneContainer
Returns number of columns for userArea given to method initContainer(IGridLayoutPane userArea)
Specified by:
getUserGridNumOfColumns in interface IGridLayoutPaneContainer
See Also:
IGridLayoutPaneContainer.getUserGridNumOfColumns()

isUserGridEqualColSize

public boolean isUserGridEqualColSize()
Description copied from interface: IGridLayoutPaneContainer
Returns true if userArea given to method initContainer(IGridLayoutPane userArea) has to have equal column widths
Specified by:
isUserGridEqualColSize in interface IGridLayoutPaneContainer
See Also:
IGridLayoutPaneContainer.isUserGridEqualColSize()

getTreeContentProvider

public org.eclipse.jface.viewers.ITreeContentProvider getTreeContentProvider()
Returns:
the used TreeContentProvider

getTreeLabelProvider

public org.eclipse.jface.viewers.ILabelProvider getTreeLabelProvider()
Returns:
the used TreeLabelProvider

setTreeContentProvider

public void setTreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider myContentProvider)
The ContentProvider used for the left side tree
Parameters:
myContentProvider - the ContentProvider for the Tree

setTreeLabelProvider

public void setTreeLabelProvider(org.eclipse.jface.viewers.ILabelProvider myLabelProvider)
The LabelProvider used for the left side tree
Parameters:
myLabelProvider -  

setTreeSelectorCallback

public void setTreeSelectorCallback(ITreeSelectorCallback callback)
The @see ITreeSelectorCallback allows to get control on same events in the component and to provide the necessary actions.
Parameters:
myCallback - the selection callback to use

setMessageText

public void setMessageText(java.lang.String text)
Set the status line text
Parameters:
text -  


Copyright © 2005 SAP AG. All Rights Reserved.