ColumnBrowser - lcaron/opal GitHub Wiki
Introduction
A widget that displays a tree structure a la mac in miller columns (look at http://en.wikipedia.org/wiki/Miller_Columns).
Usage
ColumnBrowserWidget
The widget itself contains the following method :
public ColumnBrowserWidget(final Composite parent, final int style)
: Constructor the widgetpublic void addSelectionListener(final SelectionListener listener)
: Add a selection listenerpublic void clear(final boolean needPacking)
: remove all data of the widgetpublic ColumnItem getSelection()
: get the ColumnItem selected (or null)public void removeSelectionListener(final SelectionListener listener)
public void select(final ColumnItem item)
: select a given item
Column item
The elements displayed in the widget are called ColumnItem
public ColumnItem(final ColumnBrowserWidget widget)
: create an item and associate it to a given widgetpublic ColumnItem(final ColumnBrowserWidget widget, final int index)
: idem, but the item is at a zero-based given positionpublic ColumnItem(final ColumnItem parent)
: create a item that is a child of another ColumnItempublic ColumnItem(final ColumnItem parent, final int index)
: idem, but the item is at a zero-based given positionpublic void remove(final ColumnItem item)
: remove a child of the current itempublic void remove(final int index)
: remove a child of the current itempublic void removeAll()
: remove all childs of the current itempublic ColumnItem getItem(final int index)
: get a children at a given positionpublic int getItemCount()
: get the number of children of the current itempublic ColumnItem[] getItems()
: get all children of the current itempublic ColumnBrowserWidget getParent()
: get the widget that stores the current itempublic ColumnItem getParentItem()
: get the parent of the current item, or null if there is notpublic int indexOf(final ColumnItem item)
: returns the position of a children
You can notice that the behaviour of this widget is very similar to the couple Tree/TreeItem.
Example
An example called ColumnsSnippet.java is located in the directory src/test/java/org/mihalis/opal/columns.
This example is also available here : https://github.com/lcaron/opal/blob/master/src/test/java/org/mihalis/opal/columns/ColumnsSnippet.java