Runtime

org.eclipse.gmf.runtime.common.ui.dialogs
Class ShowRelatedElementsComposite

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 byorg.eclipse.gmf.runtime.common.ui.dialogs.ShowRelatedElementsComposite
All Implemented Interfaces:
Drawable

public class ShowRelatedElementsComposite
extends Composite

A composite intended to be used in the Show Related Elements dialog. It contains the details of determining which elements to show.


Field Summary
protected  Composite contributedExpansionGroupComposite
          Contributed the expansion group.
protected  IShowRelatedElementsWithDetails detailsChangedListener
          Listener for details being changed
protected  boolean showAllConnected
          For now, not all SRE implementors are supporting all connected.
protected  int viewerWidth
          Viewer width that's passed in from the constructor We don't have to calculate it.
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
ShowRelatedElementsComposite(Composite parent, SelectableElement aRootElement, boolean createExpansion, int preferredViewerWidth)
          Constructor for ShowRelatedElementsComposite.
ShowRelatedElementsComposite(Composite parent, SelectableElement aRootElement, int preferredViewerWidth)
          Constructor for ShowRelatedElementsComposite.
 
Method Summary
 void checkAndAskExpandIndefinitely()
          Asks the user if they really want to expand indefinitely.
protected  void contributeToExpansionGroupComposite(Composite parent)
          Contribute to the expansion group composite
protected  void createContents()
          Creates content for this composite.
protected  void createExpansionControls()
          Create group on left side of composite, to select expansion criteria.
protected  void createViewer()
          Create the tree viewer in this composite.
 void detailsChanged()
          Notify the listener that the details of this composite were changed.
 void enableDirectionControls(boolean enable)
          Enables or disables the controls that let the user choose the expansion direction.
 void enableExpandLevels(boolean enable)
          Enables or disables the controls that let the user choose the number of levels to expand.
 void ExpandIndefinitely(boolean enable)
          Method ExpandIndefinitely
 boolean getAllConnected()
          Gets cached value for all connected.
 boolean getConsumerToSelection()
          Gets cached value for consumerToSelection.
 ShowRelatedElementsPreset getCurrentSettings()
          Return the unnamed current settings that make these details correspond to a preset.
 boolean getExpandIndefinitely()
          Gets cached value for expandIndefinitely.
 int getExpandLevel()
          Gets cached value for expandLevels.
 ExpansionType getExpansionType()
          Return the user's expansion type choice
protected  java.lang.Object getImmediateCustomData()
          Return the custom data.
protected  int getImmediateExpansionLevels()
          Return the immediate expansion levels.
protected  int getImmediateExpansionType()
          Return the immediate expansion type.
 java.util.List getImmediateIds()
          Return the immediate selected IDs for presisting the relationships that the user selected.
 Text getLevels()
          Method getLevels.
 SelectableElement getRootElement()
          Return the root element for the viewer
 java.util.List getSelectedRelationshipTypes()
          Returns a list of the selected relationship types.
 boolean getSelectionToSupplier()
          Gets cached value for selectiontoSupplier.
 TreeViewer getTreeViewer()
          Returns the tree viewer
 int getViewerWidth()
          Return the viewerWidth calculated in createContents, which is called by the constructor.
 void initializeSettings(boolean cts, boolean sts, int expandLevel, java.util.List selectedHints)
          One time initialize of the dialog's starting settings
protected  void reset()
          Reset button click handler, called to initialize the dialog
 void resetRootElement(SelectableElement newRootElement)
          Resets the root SelectableElement.
 void saveCachedValues()
          Saves the user input, so that it is available after the widgets have been disposed.
 void setAllConnected()
          Set the selection to supplier radio button for expansion.
 void setBoth()
          Set the both radio button for expansion.
 void setConsumerToSelection()
          Set the consumer to selection radio button for expansion.
 void setDetailsChangedListener(IShowRelatedElementsWithDetails newDetailsChangedListener)
          Set the details changed listener for listening to changes of details.
 void setExpand(int expandLevels)
          Set the expand levels.
 void setSelectionToSupplier()
          Set the selection to supplier radio button for expansion.
protected  void setTreeViewer(TreeViewer aViewer)
          Sets the tree viewer
 void updateRelationships(ShowRelatedElementsPreset preset)
          Update the relationships with the information contained in the preset
 java.lang.String validate(boolean alert)
          Performs validation.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, 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, setBackgroundImage, 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
 

Field Detail

showAllConnected

protected boolean showAllConnected
For now, not all SRE implementors are supporting all connected. Later on, this variable will be removed and we will always show "All connected" because it will be required to be supported.


detailsChangedListener

protected IShowRelatedElementsWithDetails detailsChangedListener
Listener for details being changed


contributedExpansionGroupComposite

protected Composite contributedExpansionGroupComposite
Contributed the expansion group.


viewerWidth

protected int viewerWidth
Viewer width that's passed in from the constructor We don't have to calculate it.

Constructor Detail

ShowRelatedElementsComposite

public ShowRelatedElementsComposite(Composite parent,
                                    SelectableElement aRootElement,
                                    int preferredViewerWidth)
Constructor for ShowRelatedElementsComposite.

Parameters:
parent - parent Composite
aRootElement - root SelectableElement
preferredViewerWidth - the preferred viewer width hint

ShowRelatedElementsComposite

public ShowRelatedElementsComposite(Composite parent,
                                    SelectableElement aRootElement,
                                    boolean createExpansion,
                                    int preferredViewerWidth)
Constructor for ShowRelatedElementsComposite.

Parameters:
parent - parent Composite
aRootElement - root SelectableElement
createExpansion - true to create the expansion group, false not to create it
preferredViewerWidth - the preferred viewer width hint
Method Detail

createContents

protected void createContents()
Creates content for this composite.


getViewerWidth

public int getViewerWidth()
Return the viewerWidth calculated in createContents, which is called by the constructor.

Returns:
int viewerWidth calculated in createContents, which is called by the constructor.

reset

protected void reset()
Reset button click handler, called to initialize the dialog


getTreeViewer

public TreeViewer getTreeViewer()
Returns the tree viewer

Returns:
CheckboxTreeViewer on the left side of the dialog

getLevels

public Text getLevels()
Method getLevels.

Returns:
Text Control for levels

getExpandIndefinitely

public boolean getExpandIndefinitely()
Gets cached value for expandIndefinitely.

Returns:
boolean true if expand indefinitely was checked when cached, false if it wasn't checked when cached.

getExpandLevel

public int getExpandLevel()
Gets cached value for expandLevels.

Returns:
int cached expand levels

getExpansionType

public ExpansionType getExpansionType()
Return the user's expansion type choice

Returns:
ExpansionType the ExpansionType that was saved when cached

getConsumerToSelection

public boolean getConsumerToSelection()
Gets cached value for consumerToSelection. This will be deprecated when all SRE implementors implement the all connected option. Use getExpansionType() instead.

Returns:
boolean true if at least one of the incoming or both checkboxes were selected when cached, false if none were selected when cached.

getSelectionToSupplier

public boolean getSelectionToSupplier()
Gets cached value for selectiontoSupplier. This will be deprecated when all SRE implementors implement the all connected option. Use getExpansionType() instead.

Returns:
boolean true if at least one of the outgoing or both checkboxes were selected when cached, false if none were selected when cached.

getAllConnected

public boolean getAllConnected()
Gets cached value for all connected. This will be deprecated when all SRE implementors implement the all connected option. Use getExpansionType() instead.

Returns:
boolean true if the all connected checkbox was selected when cached, false if it was not selected when cached.

getSelectedRelationshipTypes

public java.util.List getSelectedRelationshipTypes()
Returns a list of the selected relationship types.

Returns:
List of relationship types that were from SelectableElement objects under the root that had a SelectedType of SELECTED.

setTreeViewer

protected void setTreeViewer(TreeViewer aViewer)
Sets the tree viewer

Parameters:
aViewer - is the CheckboxTreeViewer

createViewer

protected void createViewer()
Create the tree viewer in this composite. The tree viewer is used to display relationships.


contributeToExpansionGroupComposite

protected void contributeToExpansionGroupComposite(Composite parent)
Contribute to the expansion group composite

Parameters:
parent - the parent expansion group composite that we are going to contribute to.

createExpansionControls

protected void createExpansionControls()
Create group on left side of composite, to select expansion criteria.


validate

public java.lang.String validate(boolean alert)
Performs validation. For now, only levels needs to be validated.

Parameters:
alert - is true to alert the user when it fails, false to not alert the user
Returns:
String null if it validated, the explanation message String if it did not validate

saveCachedValues

public void saveCachedValues()
Saves the user input, so that it is available after the widgets have been disposed.


checkAndAskExpandIndefinitely

public void checkAndAskExpandIndefinitely()
Asks the user if they really want to expand indefinitely. This method could clear the checkbox if it was already checked. If the expand indefinitely checkbox is not checked, then it does not do anything


resetRootElement

public void resetRootElement(SelectableElement newRootElement)
Resets the root SelectableElement.

Parameters:
newRootElement - the new SelectableElement to be used for the viewer's input

setBoth

public void setBoth()
Set the both radio button for expansion.


setConsumerToSelection

public void setConsumerToSelection()
Set the consumer to selection radio button for expansion.


setSelectionToSupplier

public void setSelectionToSupplier()
Set the selection to supplier radio button for expansion.


setAllConnected

public void setAllConnected()
Set the selection to supplier radio button for expansion.


setExpand

public void setExpand(int expandLevels)
Set the expand levels. Set to less than 0 for expand indefinitely.

Parameters:
expandLevels - less than 0 for expand indefinitely, max int is 99.

ExpandIndefinitely

public void ExpandIndefinitely(boolean enable)
Method ExpandIndefinitely

Parameters:
enable - true to expand indefinitely and disable the levels text box

getRootElement

public SelectableElement getRootElement()
Return the root element for the viewer

Returns:
the root SelectableElement for the viewer

enableDirectionControls

public void enableDirectionControls(boolean enable)
Enables or disables the controls that let the user choose the expansion direction. These are the incoming, outgoing, and both controls.

Parameters:
enable - true to enable, false to disable

enableExpandLevels

public void enableExpandLevels(boolean enable)
Enables or disables the controls that let the user choose the number of levels to expand. These are the expand indefinitely checkbox and the levels text control.

Parameters:
enable - true to enable, false to disable

initializeSettings

public void initializeSettings(boolean cts,
                               boolean sts,
                               int expandLevel,
                               java.util.List selectedHints)
One time initialize of the dialog's starting settings

Parameters:
cts - consumer to selection, true if we want to show consumer to selection
sts - selection to supplier, true if we want to show selection to supplier
expandLevel - int with levels to expand, -1 for indefinite or 0 to 99.
selectedHints - List of SelectableElement hints

updateRelationships

public void updateRelationships(ShowRelatedElementsPreset preset)
Update the relationships with the information contained in the preset

Parameters:
preset - ShowRelatedElementsPreset that contains the information that I will be updating with.

getImmediateIds

public java.util.List getImmediateIds()
Return the immediate selected IDs for presisting the relationships that the user selected.

Returns:
Immediate selected IDs.

getImmediateCustomData

protected java.lang.Object getImmediateCustomData()
Return the custom data. Default implementation is to return null. Subclasses should override this to return the data that would correspond to data returned from the contributed composite.

Returns:
custom data.

getImmediateExpansionLevels

protected int getImmediateExpansionLevels()
Return the immediate expansion levels.

Returns:
immediate expansion levels.

getImmediateExpansionType

protected int getImmediateExpansionType()
Return the immediate expansion type.

Returns:
immedate expansion type. See the ExpansionType EnumeratedType for more information.

getCurrentSettings

public ShowRelatedElementsPreset getCurrentSettings()
Return the unnamed current settings that make these details correspond to a preset.

Returns:
the unnamed current settings for the preset.

detailsChanged

public void detailsChanged()
Notify the listener that the details of this composite were changed.


setDetailsChangedListener

public void setDetailsChangedListener(IShowRelatedElementsWithDetails newDetailsChangedListener)
Set the details changed listener for listening to changes of details.

Parameters:
newDetailsChangedListener - IShowRelatedElementsWithDetails

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.