RSE
Release 1.0

org.eclipse.rse.ui.view
Class SystemViewForm

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.rse.ui.view.SystemViewForm
All Implemented Interfaces:
Drawable, ISystemTree

public class SystemViewForm
extends Composite
implements ISystemTree

This re-usable widget is for a single widget that displays a toolbar underneath which is a systems view tree.


Field Summary
protected  Object caller
           
protected  boolean callerInstanceOfSystemPromptDialog
           
protected  boolean callerInstanceOfWizardPage
           
static int DEFAULT_HEIGHT
           
static int DEFAULT_WIDTH
           
protected  ViewerFilter[] initViewerFilters
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
 
Fields inherited from class org.eclipse.swt.widgets.Widget
handle
 
Constructor Summary
SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, boolean singleSelectionMode, ISystemMessageLine msgLine)
          Constructor
SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, boolean singleSelectionMode, ISystemMessageLine msgLine, int horizontalSpan, int verticalSpan)
          Constructor when you want to span more than one column or row
SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, boolean singleSelectionMode, ISystemMessageLine msgLine, int horizontalSpan, int verticalSpan, ViewerFilter[] initViewerFilters)
          Constructor when you want to span more than one column or row
 
Method Summary
 void addListRequestListener(ISystemLongRunningRequestListener listener)
          Add a listener that is informed when a remote list request starts and stops.
protected  void addOurMouseListener()
           
protected  void addOurSelectionListener()
           
 void addSelectionChangedListener(ISelectionChangedListener listener)
          Register a listener interested in an item is selected in the system view
 boolean areAnySelectedItemsExpandable()
          Returns true if any of the selected items are expandable but not yet expanded
 boolean areAnySelectedItemsExpanded()
          Returns true if any of the selected items are currently expanded
protected  void createButtonBar(Composite parentComposite, int nbrButtons)
           
protected  void createSystemView(Shell shell, ISystemViewInputProvider inputProvider, boolean singleSelectionMode)
           
protected  void createToolBar(Shell shell)
           
protected  void enableButtonBarButtons(boolean enableRefresh)
          Enable/Disable refresh and getList buttons.
protected  void fireRequestStartEvent()
          Fire long running request listener event
protected  void fireRequestStopEvent()
          Fire long running request listener event
 int getChildCount(Object element)
          Return the number of immediate children in the tree, for the given tree node
 Object[] getElementNodes(Object element)
          This returns an array containing each element in the tree, up to but not including the root.
 Object getNextElement()
          This returns the element immediately after the last selected element in this tree level Often needed for enablement decisions for move down actions.
 Object getPreviousElement()
          This returns the element immediately before the first selected element in this tree level.
 Object getRootParent()
          This is called to walk the tree back up to the roots and return the visible root node for the first selected object.
 Object getSelectedParent()
          This is called to accurately get the parent object for the current selection for this viewer.
 ISelection getSelection()
          Return the selection of the tree viewer
 SystemView getSystemView()
          Return the system view tree viewer
 ToolBarManager getToolBarManager()
          Return the toolbar widget manager
 Tree getTreeControl()
          Return the system view tree viewer tree widget
 Item getViewerItem()
          Returns the tree item of the first selected object.
 boolean isSelectedOrChildSelected(Object parentElement)
          Helper method to determine if a given object is currently selected.
 boolean okToClose()
          Returns true if it is ok to close the dialog or wizard page.
protected  void populateToolBar(Shell shell)
           
protected  Composite prepareComposite(int numColumns, int horizontalSpan, int verticalSpan)
          Prepares this composite control and sets the default layout data.
protected  void processGetListButton()
          Process the getList button.
protected  void processRefreshButton()
          Process the refresh button.
 void refresh()
          Refresh contents
 void removeListRequestListener(ISystemLongRunningRequestListener listener)
          Add a listener that is informed when a remote list request starts and stops.
 void removeSelectionChangedListener(ISelectionChangedListener listener)
          Remove a previously set system view selection listener.
 void reset(ISystemViewInputProvider inputProvider)
          Reset contents
 boolean sameParent()
          This is called to ensure all elements in a multiple-selection have the same parent in the tree viewer.
 void select(Object element, boolean expand)
          Called to select an object within the tree, and optionally expand it
 void setEnabled(boolean enabled)
          Disable/Enable all the child controls.
 void setToolTipText(String tip)
          Set the tree's tooltip text
 void updatePropertySheet()
          Called when a property is updated and we need to inform the Property Sheet viewer.
 
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, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, 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

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
See Also:
Constant Field Values

caller

protected Object caller

callerInstanceOfWizardPage

protected boolean callerInstanceOfWizardPage

callerInstanceOfSystemPromptDialog

protected boolean callerInstanceOfSystemPromptDialog

initViewerFilters

protected ViewerFilter[] initViewerFilters
Constructor Detail

SystemViewForm

public SystemViewForm(Shell shell,
                      Composite parent,
                      int style,
                      ISystemViewInputProvider inputProvider,
                      boolean singleSelectionMode,
                      ISystemMessageLine msgLine)
Constructor

Parameters:
shell - The owning window
parent - The owning composite
style - The swt style to apply to the overall composite. Typically SWT.NULL
inputProvider - Who is supplying the roots for the system viewer?
singleSelectionMode - Are users allowed to select multiple things at once?
msgLine - where to show messages and tooltip text

SystemViewForm

public SystemViewForm(Shell shell,
                      Composite parent,
                      int style,
                      ISystemViewInputProvider inputProvider,
                      boolean singleSelectionMode,
                      ISystemMessageLine msgLine,
                      int horizontalSpan,
                      int verticalSpan)
Constructor when you want to span more than one column or row

Parameters:
shell - The owning window
parent - The owning composite
style - The swt style to apply to the overall composite. Typically SWT.NULL
inputProvider - Who is supplying the roots for the system viewer?
singleSelectionMode - Are users allowed to select multiple things at once?
msgLine - where to show messages and tooltip text
horizontalSpan - how many columns in parent composite to span
verticalSpan - how many rows in parent composite to span

SystemViewForm

public SystemViewForm(Shell shell,
                      Composite parent,
                      int style,
                      ISystemViewInputProvider inputProvider,
                      boolean singleSelectionMode,
                      ISystemMessageLine msgLine,
                      int horizontalSpan,
                      int verticalSpan,
                      ViewerFilter[] initViewerFilters)
Constructor when you want to span more than one column or row

Parameters:
shell - The owning window
parent - The owning composite
style - The swt style to apply to the overall composite. Typically SWT.NULL
inputProvider - Who is supplying the roots for the system viewer?
singleSelectionMode - Are users allowed to select multiple things at once?
msgLine - where to show messages and tooltip text
horizontalSpan - how many columns in parent composite to span
verticalSpan - how many rows in parent composite to span
initViewerFilters - the initial viewer filters to apply.
Method Detail

getToolBarManager

public ToolBarManager getToolBarManager()
Return the toolbar widget manager


getSystemView

public SystemView getSystemView()
Return the system view tree viewer


getTreeControl

public Tree getTreeControl()
Return the system view tree viewer tree widget


setToolTipText

public void setToolTipText(String tip)
Set the tree's tooltip text


refresh

public void refresh()
Refresh contents


reset

public void reset(ISystemViewInputProvider inputProvider)
Reset contents


setEnabled

public void setEnabled(boolean enabled)
Disable/Enable all the child controls.


addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)
Register a listener interested in an item is selected in the system view

See Also:
removeSelectionChangedListener(ISelectionChangedListener)

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)
Remove a previously set system view selection listener.

See Also:
addSelectionChangedListener(ISelectionChangedListener)

addListRequestListener

public void addListRequestListener(ISystemLongRunningRequestListener listener)
Add a listener that is informed when a remote list request starts and stops. This allows for the listener to do things like disable the Close button


removeListRequestListener

public void removeListRequestListener(ISystemLongRunningRequestListener listener)
Add a listener that is informed when a remote list request starts and stops. This allows for the listener to do things like disable the Close button


getSelection

public ISelection getSelection()
Return the selection of the tree viewer


areAnySelectedItemsExpanded

public boolean areAnySelectedItemsExpanded()
Returns true if any of the selected items are currently expanded

Specified by:
areAnySelectedItemsExpanded in interface ISystemTree
Returns:
true if any of the selected items are currently expanded

areAnySelectedItemsExpandable

public boolean areAnySelectedItemsExpandable()
Returns true if any of the selected items are expandable but not yet expanded

Specified by:
areAnySelectedItemsExpandable in interface ISystemTree
Returns:
true if any of the selected items are expandable but not yet expanded

sameParent

public boolean sameParent()
This is called to ensure all elements in a multiple-selection have the same parent in the tree viewer. If they don't we automatically disable all actions.

Designed to be as fast as possible by going directly to the SWT widgets

Specified by:
sameParent in interface ISystemTree
Returns:
true if the elements of the selection in the viewer all have the same parent

getSelectedParent

public Object getSelectedParent()
This is called to accurately get the parent object for the current selection for this viewer.

The getParent() method in the adapter is very unreliable... adapters can't be sure of the context which can change via filtering and view options.

Specified by:
getSelectedParent in interface ISystemTree
Returns:
the parent of the selection

getPreviousElement

public Object getPreviousElement()
This returns the element immediately before the first selected element in this tree level. Often needed for enablement decisions for move up actions.

Specified by:
getPreviousElement in interface ISystemTree
Returns:
the object prior to the selection, null if there is none

getNextElement

public Object getNextElement()
This returns the element immediately after the last selected element in this tree level Often needed for enablement decisions for move down actions.

Specified by:
getNextElement in interface ISystemTree
Returns:
the object after the selection, null if there is none

getRootParent

public Object getRootParent()
This is called to walk the tree back up to the roots and return the visible root node for the first selected object.

Specified by:
getRootParent in interface ISystemTree
Returns:
the root object

getElementNodes

public Object[] getElementNodes(Object element)
This returns an array containing each element in the tree, up to but not including the root. The array is in reverse order, starting at the leaf and going up.

Specified by:
getElementNodes in interface ISystemTree
Parameters:
element - the element from which to begin
Returns:
the array of objects in the path from leaf to root. Excluding the leaf and root.

isSelectedOrChildSelected

public boolean isSelectedOrChildSelected(Object parentElement)
Helper method to determine if a given object is currently selected. Does consider if a child node of the given object is currently selected.

Specified by:
isSelectedOrChildSelected in interface ISystemTree
Parameters:
parentElement - the element to query
Returns:
true if the element covers any portion of the selection

getChildCount

public int getChildCount(Object element)
Return the number of immediate children in the tree, for the given tree node

Specified by:
getChildCount in interface ISystemTree
Parameters:
element - the element in the tree to query
Returns:
the number of immediate children in the tree, for the given tree node

updatePropertySheet

public void updatePropertySheet()
Called when a property is updated and we need to inform the Property Sheet viewer. There is no formal mechanism for this so we simulate a selection changed event as this is the only event the property sheet listens for.

Specified by:
updatePropertySheet in interface ISystemTree

select

public void select(Object element,
                   boolean expand)
Called to select an object within the tree, and optionally expand it

Specified by:
select in interface ISystemTree
Parameters:
element - the element in the tree to select
expand - true if the element is to be expanded

getViewerItem

public Item getViewerItem()
Returns the tree item of the first selected object. Used for setViewerItem in a resource change event.

Specified by:
getViewerItem in interface ISystemTree
Returns:
the item

okToClose

public boolean okToClose()
Returns true if it is ok to close the dialog or wizard page. Returns false if there is a remote request currently in progress.


prepareComposite

protected Composite prepareComposite(int numColumns,
                                     int horizontalSpan,
                                     int verticalSpan)
Prepares this composite control and sets the default layout data.


createSystemView

protected void createSystemView(Shell shell,
                                ISystemViewInputProvider inputProvider,
                                boolean singleSelectionMode)

createToolBar

protected void createToolBar(Shell shell)

populateToolBar

protected void populateToolBar(Shell shell)

createButtonBar

protected void createButtonBar(Composite parentComposite,
                               int nbrButtons)

addOurSelectionListener

protected void addOurSelectionListener()

addOurMouseListener

protected void addOurMouseListener()

processRefreshButton

protected void processRefreshButton()
Process the refresh button.


processGetListButton

protected void processGetListButton()
Process the getList button.


enableButtonBarButtons

protected void enableButtonBarButtons(boolean enableRefresh)
Enable/Disable refresh and getList buttons. Note that these are mutually exclusive


fireRequestStartEvent

protected void fireRequestStartEvent()
Fire long running request listener event


fireRequestStopEvent

protected void fireRequestStopEvent()
Fire long running request listener event


RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.