org.eclipse.nebula.jface.galleryviewer
Class GalleryTreeViewer

java.lang.Object
  extended byorg.eclipse.jface.viewers.Viewer
      extended byorg.eclipse.jface.viewers.ContentViewer
          extended byorg.eclipse.jface.viewers.StructuredViewer
              extended byorg.eclipse.jface.viewers.ColumnViewer
                  extended byorg.eclipse.jface.viewers.AbstractTreeViewer
                      extended byorg.eclipse.nebula.jface.galleryviewer.GalleryTreeViewer
All Implemented Interfaces:
IInputProvider, IInputSelectionProvider, IPostSelectionProvider, ISelectionProvider

public class GalleryTreeViewer
extends AbstractTreeViewer

A concrete viewer based on a Nebula Gallery control.

This class is not intended to be subclassed outside the viewer framework. It is designed to be instantiated with a pre-existing Nebula Gallery control and configured with a domain-specific content provider, label provider, element filter (optional), and element sorter (optional).

SWT.VIRTUAL is currently unsupported

THIS VIEWER SHOULD BE CONSIDERED AS ALPHA

Since:
Dec 5, 2007
Author:
Peter Centgraf

Field Summary
 
Fields inherited from class org.eclipse.jface.viewers.AbstractTreeViewer
ALL_LEVELS
 
Constructor Summary
GalleryTreeViewer(Composite parent)
          Creates a gallery viewer on a newly-created gallery control under the given parent.
GalleryTreeViewer(Composite parent, int style)
          Creates a gallery viewer on a newly-created gallery control under the given parent.
GalleryTreeViewer(Gallery gallery)
          Creates a gallery viewer on the given gallery control.
 
Method Summary
 void editElement(Object element, int column)
           
 Control getControl()
           
 Gallery getGallery()
          Returns this gallery viewer's gallery.
 void remove(Object parentOrTreePath, int index)
          Removes the element at the specified index of the parent.
 void setAutoExpandLevel(int level)
           
 void setChildCount(Object elementOrTreePath, int count)
          For a GalleryViewer with a gallery with the VIRTUAL style bit set, set the number of children of the given element or tree path.
 void setContentProvider(IContentProvider provider)
           Gallery expects contents to have exactly 2 levels of hierarchy, with groups as the root elements and image thumbnails as direct children of the groups.
 
Methods inherited from class org.eclipse.jface.viewers.AbstractTreeViewer
add, add, addTreeListener, collapseAll, collapseToLevel, expandAll, expandToLevel, expandToLevel, getAutoExpandLevel, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getSelection, getVisibleExpandedElements, insert, isExpandable, remove, remove, remove, removeTreeListener, reveal, scrollDown, scrollUp, setExpandedElements, setExpandedState, setExpandedTreePaths
 
Methods inherited from class org.eclipse.jface.viewers.ColumnViewer
cancelEditing, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getLabelProvider, isBusy, isCellEditorActive, refresh, refresh, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setLabelProvider, update
 
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, getComparator, getComparer, getFilters, getSorter, refresh, refresh, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setFilters, setInput, setSelection, setSorter, setUseHashlookup, testFindItem, testFindItems, update
 
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, getLabelProvider
 
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, getData, removeHelpListener, removeSelectionChangedListener, setData, setSelection
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
 

Constructor Detail

GalleryTreeViewer

public GalleryTreeViewer(Composite parent)
Creates a gallery viewer on a newly-created gallery control under the given parent. The gallery control is created using the SWT style bits MULTI, V_SCROLL, and BORDER. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
parent - the parent control

GalleryTreeViewer

public GalleryTreeViewer(Composite parent,
                         int style)
Creates a gallery viewer on a newly-created gallery control under the given parent. The gallery control is created using the given SWT style bits. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
parent - the parent control
style - the SWT style bits used to create the gallery.

GalleryTreeViewer

public GalleryTreeViewer(Gallery gallery)
Creates a gallery viewer on the given gallery control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
gallery - the gallery control
Method Detail

setAutoExpandLevel

public void setAutoExpandLevel(int level)

setContentProvider

public void setContentProvider(IContentProvider provider)

Gallery expects contents to have exactly 2 levels of hierarchy, with groups as the root elements and image thumbnails as direct children of the groups. This method accepts ITreeContentProvider and ITreePathContentProvider as-is, and relies on the providers to return contents with the correct structure.

This method also accepts IStructuredContentProvider and wraps it in a FlatTreeContentProvider with an empty string as the root node. If you need a different root node, construct your own FlatTreeContentProvider and pass it here. If you want the Gallery to suppress the collapsable group header, call

getGallery().setGroupRenderer(new NoGroupRenderer());


getControl

public Control getControl()

getGallery

public Gallery getGallery()
Returns this gallery viewer's gallery.

Returns:
the gallery control

setChildCount

public void setChildCount(Object elementOrTreePath,
                          int count)
For a GalleryViewer with a gallery with the VIRTUAL style bit set, set the number of children of the given element or tree path. To set the number of children of the invisible root of the gallery, you can pass the input object or an empty tree path.

Parameters:
elementOrTreePath - the element, or tree path
count -
Since:
3.2

remove

public void remove(Object parentOrTreePath,
                   int index)
Removes the element at the specified index of the parent. The selection is updated if required.

Parameters:
parentOrTreePath - the parent element, the input element, or a tree path to the parent element
index - child index
Since:
3.3

editElement

public void editElement(Object element,
                        int column)