Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tonbeller.wcf.tree
Class GroupingTreeModelDecorator

    java.lang.Object
      com.tonbeller.wcf.tree.TreeModelDecorator
          com.tonbeller.wcf.tree.GroupingTreeModelDecorator

All Implemented Interfaces:
  DecoratedTreeModel, TreeModel

public class GroupingTreeModelDecorator
extends TreeModelDecorator

groups large amounts of children into groups by inserting intermediate "artificial" nodes into the tree model. This is to prevent users to open a large amount of children.

The implementation uses HashMap's so the tree nodes must properly support this. TreeMaps will not work, because the result tree contains nodes of different types that are not really comparable.

Author:
  av

Nested Class Summary
`class` | `GroupingTreeModelDecorator.Group`

Field Summary

Fields inherited from interface com.tonbeller.wcf.tree.TreeModel
`EMPTY_MODEL`

Constructor Summary
`GroupingTreeModelDecorator(java.util.Comparator nodeComparator, LabelProvider labelProvider, TreeModel decoree, int limit)` creates a GroupingTreeModel using HashMap's
`GroupingTreeModelDecorator(LabelProvider labelProvider, TreeModel decoree, int limit)` creates a GroupingTreeModel using HashMap's

Method Summary
`java.lang.Object[]` | `getChildren(java.lang.Object node)`
`int` | `getLimit()`
`java.lang.Object` | `getParent(java.lang.Object node)`
`java.lang.Object[]` | `getRoots()` returns the root members of the tree.
`boolean` | `hasChildren(java.lang.Object node)`
`void` | `setLimit(int limit)`

Methods inherited from class com.tonbeller.wcf.tree.TreeModelDecorator
`addTreeModelChangeListener, fireModelChanged, getDecoree, removeTreeModelChangeListener, setDecoree`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GroupingTreeModelDecorator

    public GroupingTreeModelDecorator(LabelProvider labelProvider,
                                      TreeModel decoree,
                                      int limit)

  creates a GroupingTreeModel using HashMap's

Parameters:
  `labelProvider` - provides labels for the nodes in the tree model
  `decoree` - the tree model
  `limit` - number of children that will not divided into groups

### GroupingTreeModelDecorator

    public GroupingTreeModelDecorator(java.util.Comparator nodeComparator,
                                      LabelProvider labelProvider,
                                      TreeModel decoree,
                                      int limit)

  creates a GroupingTreeModel using HashMap's

Parameters:
  `nodeComparator` - compares nodes from underlying (decoree) tree model
  `labelProvider` - provides labels for the nodes in the tree model
  `decoree` - the tree model
  `limit` - number of children that will not divided into groups

Method Detail

### getRoots

    public java.lang.Object[] getRoots()

  Description copied from interface: `TreeModel`
  returns the root members of the tree.

  Specified by:
    `getRoots` in interface `TreeModel`
  Overrides:
    `getRoots` in class `TreeModelDecorator`

### hasChildren

    public boolean hasChildren(java.lang.Object node)

  Specified by:
    `hasChildren` in interface `TreeModel`
  Overrides:
    `hasChildren` in class `TreeModelDecorator`

### getChildren

    public java.lang.Object[] getChildren(java.lang.Object node)

  Specified by:
    `getChildren` in interface `TreeModel`
  Overrides:
    `getChildren` in class `TreeModelDecorator`

### getParent

    public java.lang.Object getParent(java.lang.Object node)

  Specified by:
    `getParent` in interface `TreeModel`
  Overrides:
    `getParent` in class `TreeModelDecorator`

### getLimit

    public int getLimit()

### setLimit

    public void setLimit(int limit)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD