Remote Systems
v6.4.1

com.ibm.etools.systems.files.importexport.jar
Class RemoteCheckboxTreeAndListGroup

java.lang.Object
  extended bycom.ibm.etools.systems.files.importexport.jar.RemoteCheckboxTreeAndListGroup

public class RemoteCheckboxTreeAndListGroup
extends Object

Combines a CheckboxTreeViewer and CheckboxListViewer. All viewer selection-driven interactions are handled within this viewer


Constructor Summary
RemoteCheckboxTreeAndListGroup(Composite parent, Object rootObject, ITreeContentProvider treeContentProvider, ILabelProvider treeLabelProvider, IStructuredContentProvider listContentProvider, ILabelProvider listLabelProvider, int style, int width, int height)
          Creates an instance of this class.
 
Method Summary
 void aboutToOpen()
          This method must be called just before this window becomes visible.
 void addCheckStateListener(ICheckStateListener listener)
          Adds the passed listener to self's collection of clients that listen for changes to element checked states
 void addListFilter(ViewerFilter filter)
          Adds the given filter to the list viewer and triggers refiltering and resorting of the elements.
 void addTreeFilter(ViewerFilter filter)
          Adds the given filter to the tree viewer and triggers refiltering and resorting of the elements.
protected  boolean areAllChildrenWhiteChecked(Object treeElement)
          Returns a boolean indicating whether all children of the passed tree element are currently white-checked
protected  boolean areAllElementsChecked(Object treeElement)
          Returns a boolean indicating whether all list elements associated with the passed tree element are currently checked
protected  void checkNewTreeElements(Object[] elements)
          Iterates through the passed elements which are being realized for the first time and check each one in the tree viewer as appropriate
 void checkStateChanged(CheckStateChangedEvent event)
          An item was checked in one of self's two views.
protected  void createContents(Composite parent, int width, int height, int style)
          Lay out and initialize self's visual components.
protected  void createListViewer(Composite parent, int width, int height)
          Creates this group's list viewer.
protected  void createTreeViewer(Composite parent, int width, int height)
          Creates this group's tree viewer.
protected  boolean determineShouldBeAtLeastGrayChecked(Object treeElement)
          Returns a boolean indicating whether the passed tree element should be at LEAST gray-checked.
protected  boolean determineShouldBeWhiteChecked(Object treeElement)
          Returns a boolean indicating whether the passed tree item should be white-checked.
protected  void determineWhiteCheckedDescendents(Object treeElement)
          Recursively adds appropriate tree elements to the collection of known white-checked tree elements.
 void expandAll()
          Causes the tree viewer to expand all its items
 void expandTreeToLevel(Object object, int level)
          For a given element, expand its chidren to a level.
protected  Object[] filter(ViewerFilter[] filters, Object[] elements)
          Returns the result of running the given elements through the filters.
 Iterator getAllCheckedListItems()
          Answers a flat collection of all of the checked elements in the list portion of self
 Set getAllCheckedTreeItems()
          Answer a collection of all of the checked elements in the tree portion of self
 int getCheckedElementCount()
          Answers the number of elements that have been checked by the user.
protected  int getListItemsSize(Object treeElement)
          Returns a count of the number of list items associated with a given tree item.
 Table getTable()
          Gets the table that displays the folder content
 Tree getTree()
          Gets the tree that displays the list for a folder
 Set getWhiteCheckedTreeItems()
           
protected  void grayCheckHierarchy(Object treeElement)
          Logically gray-check all ancestors of treeItem by ensuring that they appear in the checked table
 void initialCheckListItem(Object element)
          Sets the initial checked state of the passed list element to true.
 void initialCheckTreeItem(Object element)
          Sets the initial checked state of the passed element to true, as well as to all of its children and associated list elements
protected  void initialize()
          Initializes this group's viewers after they have been laid out.
 boolean isTreeItemGreyChecked(Object object)
          Checks if an element is grey checked.
protected  void listItemChecked(Object listElement, boolean state, boolean updatingFromSelection)
          Callback that's invoked when the checked status of an item in the list is changed by the user.
protected  void notifyCheckStateChangeListeners(CheckStateChangedEvent event)
          Notifies all checked state listeners that the passed element has had its checked state changed to the passed state
protected  void populateListViewer(Object treeElement)
          Sets the contents of the list viewer based upon the specified selected tree element.
 void removeCheckStateListener(ICheckStateListener listener)
          Removes the passed listener from self's collection of clients that listen for changes to element checked states
 void selectionChanged(SelectionChangedEvent event)
          Handles the selection of an item in the tree viewer
 void setAllSelections(boolean selection)
          Selects or deselect all of the elements in the tree depending on the value of the selection boolean.
 void setListProviders(IStructuredContentProvider contentProvider, ILabelProvider labelProvider)
          Sets the list viewer's providers to those passed
 void setListSorter(ViewerSorter sorter)
          Sets the sorter that is to be applied to self's list viewer
 void setRoot(Object newRoot)
          Sets the root of the widget to be new Root.
protected  void setTreeChecked(Object treeElement, boolean state)
          Sets the checked state of the passed tree element appropriately, and do so recursively to all of its child tree elements as well
 void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider)
          Sets the tree viewer's providers to those passed
 void setTreeSelection(ISelection selection)
           
 void setTreeSorter(ViewerSorter sorter)
          Sets the sorter that is to be applied to self's tree viewer
protected  void setWhiteChecked(Object treeElement, boolean isWhiteChecked)
          Adjusts the collection of references to white-checked tree elements appropriately.
 void treeCollapsed(TreeExpansionEvent event)
          Handle the collapsing of an element in a tree viewer
 void treeExpanded(TreeExpansionEvent event)
          Handles the expansionsion of an element in a tree viewer
protected  void treeItemChecked(Object treeElement, boolean state)
          Callback that's invoked when the checked status of an item in the tree is changed by the user.
protected  void ungrayCheckHierarchy(Object treeElement)
          Logically un-gray-check all ancestors of treeItem iff appropriate.
protected  void updateHierarchy(Object treeElement)
          Sets the checked state of self and all ancestors appropriately
 void updateSelections(Map items)
          Update the selections of the tree elements in items to reflect the new selections provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteCheckboxTreeAndListGroup

public RemoteCheckboxTreeAndListGroup(Composite parent,
                                      Object rootObject,
                                      ITreeContentProvider treeContentProvider,
                                      ILabelProvider treeLabelProvider,
                                      IStructuredContentProvider listContentProvider,
                                      ILabelProvider listLabelProvider,
                                      int style,
                                      int width,
                                      int height)
Creates an instance of this class. Use this constructor if you wish to specify the width and/or height of the combined widget (to only hardcode one of the sizing dimensions, specify the other dimension's value as -1)

Method Detail

aboutToOpen

public void aboutToOpen()
This method must be called just before this window becomes visible.


addCheckStateListener

public void addCheckStateListener(ICheckStateListener listener)
Adds the passed listener to self's collection of clients that listen for changes to element checked states

Parameters:
listener - ICheckStateListener

areAllChildrenWhiteChecked

protected boolean areAllChildrenWhiteChecked(Object treeElement)
Returns a boolean indicating whether all children of the passed tree element are currently white-checked

Parameters:
treeElement - java.lang.Object
Returns:
boolean

areAllElementsChecked

protected boolean areAllElementsChecked(Object treeElement)
Returns a boolean indicating whether all list elements associated with the passed tree element are currently checked

Parameters:
treeElement - java.lang.Object
Returns:
boolean

checkNewTreeElements

protected void checkNewTreeElements(Object[] elements)
Iterates through the passed elements which are being realized for the first time and check each one in the tree viewer as appropriate


checkStateChanged

public void checkStateChanged(CheckStateChangedEvent event)
An item was checked in one of self's two views. Determine which view this occurred in and delegate appropriately

Parameters:
event - CheckStateChangedEvent

createContents

protected void createContents(Composite parent,
                              int width,
                              int height,
                              int style)
Lay out and initialize self's visual components.

Parameters:
parent - org.eclipse.swt.widgets.Composite
width - int
height - int

createListViewer

protected void createListViewer(Composite parent,
                                int width,
                                int height)
Creates this group's list viewer.


createTreeViewer

protected void createTreeViewer(Composite parent,
                                int width,
                                int height)
Creates this group's tree viewer.


determineShouldBeAtLeastGrayChecked

protected boolean determineShouldBeAtLeastGrayChecked(Object treeElement)
Returns a boolean indicating whether the passed tree element should be at LEAST gray-checked. Note that this method does not consider whether it should be white-checked, so a specified tree item which should be white-checked will result in a true answer from this method. To determine whether a tree item should be white-checked use method #determineShouldBeWhiteChecked(Object).

Parameters:
treeElement - java.lang.Object
Returns:
boolean
See Also:
determineShouldBeWhiteChecked(java.lang.Object)

determineShouldBeWhiteChecked

protected boolean determineShouldBeWhiteChecked(Object treeElement)
Returns a boolean indicating whether the passed tree item should be white-checked.

Parameters:
treeElement - java.lang.Object
Returns:
boolean

determineWhiteCheckedDescendents

protected void determineWhiteCheckedDescendents(Object treeElement)
Recursively adds appropriate tree elements to the collection of known white-checked tree elements.

Parameters:
treeElement - java.lang.Object

expandAll

public void expandAll()
Causes the tree viewer to expand all its items


getAllCheckedListItems

public Iterator getAllCheckedListItems()
Answers a flat collection of all of the checked elements in the list portion of self

Returns:
java.util.Vector

getAllCheckedTreeItems

public Set getAllCheckedTreeItems()
Answer a collection of all of the checked elements in the tree portion of self

Returns:
java.util.Vector

getCheckedElementCount

public int getCheckedElementCount()
Answers the number of elements that have been checked by the user.

Returns:
int

getListItemsSize

protected int getListItemsSize(Object treeElement)
Returns a count of the number of list items associated with a given tree item.

Parameters:
treeElement - java.lang.Object
Returns:
int

getTable

public Table getTable()
Gets the table that displays the folder content

Returns:
the table used to show the list

getTree

public Tree getTree()
Gets the tree that displays the list for a folder

Returns:
the tree used to show the folders

addTreeFilter

public void addTreeFilter(ViewerFilter filter)
Adds the given filter to the tree viewer and triggers refiltering and resorting of the elements.

Parameters:
filter - a viewer filter

addListFilter

public void addListFilter(ViewerFilter filter)
Adds the given filter to the list viewer and triggers refiltering and resorting of the elements.

Parameters:
filter - a viewer filter

grayCheckHierarchy

protected void grayCheckHierarchy(Object treeElement)
Logically gray-check all ancestors of treeItem by ensuring that they appear in the checked table


initialCheckListItem

public void initialCheckListItem(Object element)
Sets the initial checked state of the passed list element to true.


initialCheckTreeItem

public void initialCheckTreeItem(Object element)
Sets the initial checked state of the passed element to true, as well as to all of its children and associated list elements


initialize

protected void initialize()
Initializes this group's viewers after they have been laid out.


listItemChecked

protected void listItemChecked(Object listElement,
                               boolean state,
                               boolean updatingFromSelection)
Callback that's invoked when the checked status of an item in the list is changed by the user. Do not try and update the hierarchy if we are building the initial list.


notifyCheckStateChangeListeners

protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event)
Notifies all checked state listeners that the passed element has had its checked state changed to the passed state


populateListViewer

protected void populateListViewer(Object treeElement)
Sets the contents of the list viewer based upon the specified selected tree element. This also includes checking the appropriate list items.

Parameters:
treeElement - java.lang.Object

removeCheckStateListener

public void removeCheckStateListener(ICheckStateListener listener)
Removes the passed listener from self's collection of clients that listen for changes to element checked states

Parameters:
listener - ICheckStateListener

selectionChanged

public void selectionChanged(SelectionChangedEvent event)
Handles the selection of an item in the tree viewer

Parameters:
event - ISelection

setAllSelections

public void setAllSelections(boolean selection)
Selects or deselect all of the elements in the tree depending on the value of the selection boolean. Be sure to update the displayed files as well.


setListProviders

public void setListProviders(IStructuredContentProvider contentProvider,
                             ILabelProvider labelProvider)
Sets the list viewer's providers to those passed

Parameters:
contentProvider - ITreeContentProvider
labelProvider - ILabelProvider

setListSorter

public void setListSorter(ViewerSorter sorter)
Sets the sorter that is to be applied to self's list viewer


setRoot

public void setRoot(Object newRoot)
Sets the root of the widget to be new Root. Regenerate all of the tables and lists from this value.

Parameters:
newRoot -

setTreeChecked

protected void setTreeChecked(Object treeElement,
                              boolean state)
Sets the checked state of the passed tree element appropriately, and do so recursively to all of its child tree elements as well


setTreeProviders

public void setTreeProviders(ITreeContentProvider contentProvider,
                             ILabelProvider labelProvider)
Sets the tree viewer's providers to those passed

Parameters:
contentProvider - ITreeContentProvider
labelProvider - ILabelProvider

setTreeSorter

public void setTreeSorter(ViewerSorter sorter)
Sets the sorter that is to be applied to self's tree viewer


setWhiteChecked

protected void setWhiteChecked(Object treeElement,
                               boolean isWhiteChecked)
Adjusts the collection of references to white-checked tree elements appropriately.

Parameters:
treeElement - java.lang.Object
isWhiteChecked - boolean

treeCollapsed

public void treeCollapsed(TreeExpansionEvent event)
Handle the collapsing of an element in a tree viewer


treeExpanded

public void treeExpanded(TreeExpansionEvent event)
Handles the expansionsion of an element in a tree viewer


treeItemChecked

protected void treeItemChecked(Object treeElement,
                               boolean state)
Callback that's invoked when the checked status of an item in the tree is changed by the user.


ungrayCheckHierarchy

protected void ungrayCheckHierarchy(Object treeElement)
Logically un-gray-check all ancestors of treeItem iff appropriate.


updateHierarchy

protected void updateHierarchy(Object treeElement)
Sets the checked state of self and all ancestors appropriately


updateSelections

public void updateSelections(Map items)
Update the selections of the tree elements in items to reflect the new selections provided.

Parameters:
items - with keys of Object (the tree element) and values of List (the selected list elements).

filter

protected Object[] filter(ViewerFilter[] filters,
                          Object[] elements)
Returns the result of running the given elements through the filters.

Parameters:
elements - the elements to filter
Returns:
only the elements which all filters accept

getWhiteCheckedTreeItems

public Set getWhiteCheckedTreeItems()

isTreeItemGreyChecked

public boolean isTreeItemGreyChecked(Object object)
Checks if an element is grey checked.


expandTreeToLevel

public void expandTreeToLevel(Object object,
                              int level)
For a given element, expand its chidren to a level.


setTreeSelection

public void setTreeSelection(ISelection selection)
Parameters:
selection -

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.