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

## org.apache.cocoon.forms.formmodel.tree
Class Tree

    java.lang.Object
      org.apache.cocoon.forms.formmodel.AbstractWidget
          org.apache.cocoon.forms.formmodel.tree.Tree

All Implemented Interfaces:
  org.apache.cocoon.util.location.Locatable, Widget

public class Tree
extends AbstractWidget

A tree widget, heavily inspired by Swing's `JTree`.

Version:
  $Id: Tree.java 587759 2007-10-24 03:00:37Z vgritsenko $

Nested Class Summary
`static interface` | `Tree.ActionHandler`

Field Summary
`static int` | `MULTIPLE_SELECTION`
`static int` | `SINGLE_SELECTION`

Fields inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget
`wasValid`

Fields inherited from interface org.apache.cocoon.forms.formmodel.Widget
`PATH_SEPARATOR`

Constructor Summary
`protected` | `Tree(TreeDefinition definition)`

Method Summary
`void` | `addSelectionPath(TreePath path)`
`void` | `addSelectionPaths(TreePath[] paths)`
`void` | `addTreeSelectionListener(TreeSelectionListener listener)`
`void` | `broadcastEvent(WidgetEvent event)` Broadcast an event previously queued by this widget to its event listeners. Abstract implementation throws a `UnsupportedOperationException`. Concrete subclass widgets need to override when supporting event broadcasting. Abstract implementation throws a `UnsupportedOperationException`.
`void` | `clearSelection()`
`void` | `collapseAll()`
`void` | `collapsePath(TreePath path)`
`void` | `expandAll()`
`void` | `expandPath(TreePath path)`
`protected void` | `generateItemSaxFragment(ContentHandler contentHandler, Locale locale)` Generates nested additional content nested inside the main element for this widget which is generated by `AbstractWidget.generateSaxFragment(ContentHandler, Locale)` The implementation on the AbstractWidget level inserts no additional XML.
`WidgetDefinition` | `getDefinition()` Concrete subclasses should allow access to their underlaying Definition through this method.
`TreeModel` | `getModel()`
`int` | `getSelectionCount()`
`TreePath` | `getSelectionPath()`
`TreePath[]` | `getSelectionPaths()`
`Widget` | `getWidgetForPath(TreePath path)`
`protected String` | `getXMLElementName()` The XML element name used in `AbstractWidget.generateSaxFragment(ContentHandler, Locale)` to produce the wrapping element for all the XML-instance-content of this Widget.
`boolean` | `isCollapsed(TreePath path)`
`boolean` | `isExpanded(TreePath path)`
`boolean` | `isPathSelected(TreePath path)`
`boolean` | `isRootVisible()`
`boolean` | `isSelectionEmpty()`
`boolean` | `isVisible(TreePath path)` Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded.
`void` | `makeVisible(TreePath path)`
`void` | `readFromRequest(FormContext formContext)` Lets this widget read its data from a request.
`void` | `removeSelectionPath(TreePath path)`
`void` | `removeSelectionPaths(TreePath[] paths)`
`void` | `removeTreeSelectionListener(TreeSelectionListener listener)`
`void` | `setExpandsSelectedPath(boolean value)`
`void` | `setModel(TreeModel model)`
`void` | `setRootVisible(boolean visible)`
`void` | `setSelectionModel(int model)`
`void` | `setSelectionPath(TreePath path)`
`void` | `setSelectionPaths(TreePath[] paths)`

Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget
`addValidator, generateDisplayData, generateLabel, generateSaxFragment, getAttribute, getChild, getCombinedState, getForm, getFullName, getId, getLocation, getName, getParent, getRequestParameterName, getState, getValue, getWidget, getXMLElementAttributes, initialize, isRequired, isValid, lookupWidget, removeAttribute, removeValidator, setAttribute, setParent, setState, setValue, toString, validate, widgetNameChanged`

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

Field Detail

### SINGLE_SELECTION

    public static final int SINGLE_SELECTION

See Also:
  Constant Field Values

### MULTIPLE_SELECTION

    public static final int MULTIPLE_SELECTION

See Also:
  Constant Field Values

Constructor Detail

### Tree

    protected Tree(TreeDefinition definition)

Method Detail

### getDefinition

    public WidgetDefinition getDefinition()

  Description copied from class: `AbstractWidget`
  Concrete subclasses should allow access to their underlaying Definition through this method. If subclasses decide to return `null` they should also organize own implementations of `AbstractWidget.getId()`, `AbstractWidget.getLocation()`, `AbstractWidget.validate()`, `AbstractWidget.generateLabel(ContentHandler)` and `AbstractWidget.generateDisplayData(ContentHandler)` to avoid NPE's.

  Specified by:
    `getDefinition` in interface `Widget`
  Specified by:
    `getDefinition` in class `AbstractWidget`
  Returns:
    the widgetDefinition from which this widget was instantiated. (See `WidgetDefinition.createInstance()`)

### getXMLElementName

    protected String getXMLElementName()

  Description copied from class: `AbstractWidget`
  The XML element name used in `AbstractWidget.generateSaxFragment(ContentHandler, Locale)` to produce the wrapping element for all the XML-instance-content of this Widget.

  Specified by:
    `getXMLElementName` in class `AbstractWidget`
  Returns:
    the main elementname for this widget's sax-fragment.

### generateItemSaxFragment

    protected void generateItemSaxFragment(ContentHandler contentHandler,
                                           Locale locale)
                                    throws SAXException

  Description copied from class: `AbstractWidget`
  Generates nested additional content nested inside the main element for this widget which is generated by `AbstractWidget.generateSaxFragment(ContentHandler, Locale)` The implementation on the AbstractWidget level inserts no additional XML. Subclasses need to override to insert widget specific content.

  Overrides:
    `generateItemSaxFragment` in class `AbstractWidget`
  Parameters:
    `contentHandler` - to send the SAX events to
    `locale` - in which context potential content needs to be put.
  Throws:
    `SAXException`

### readFromRequest

    public void readFromRequest(FormContext formContext)

  Description copied from interface: `Widget`
  Lets this widget read its data from a request. At this point the Widget may try to convert the request parameter to its native datatype (if it is not a string), but it should not yet generate any validation errors.

### getModel

    public TreeModel getModel()

### setModel

    public void setModel(TreeModel model)

### setSelectionModel

    public void setSelectionModel(int model)

### getSelectionCount

    public int getSelectionCount()

### getSelectionPath

    public TreePath getSelectionPath()

### getSelectionPaths

    public TreePath[] getSelectionPaths()

### isPathSelected

    public boolean isPathSelected(TreePath path)

### isSelectionEmpty

    public boolean isSelectionEmpty()

### setSelectionPath

    public void setSelectionPath(TreePath path)

### setSelectionPaths

    public void setSelectionPaths(TreePath[] paths)

### addSelectionPath

    public void addSelectionPath(TreePath path)

### addSelectionPaths

    public void addSelectionPaths(TreePath[] paths)

### removeSelectionPath

    public void removeSelectionPath(TreePath path)

### removeSelectionPaths

    public void removeSelectionPaths(TreePath[] paths)

### clearSelection

    public void clearSelection()

### addTreeSelectionListener

    public void addTreeSelectionListener(TreeSelectionListener listener)

### removeTreeSelectionListener

    public void removeTreeSelectionListener(TreeSelectionListener listener)

### isCollapsed

    public boolean isCollapsed(TreePath path)

### isExpanded

    public boolean isExpanded(TreePath path)

### isVisible

    public boolean isVisible(TreePath path)

  Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded. Otherwise, this method returns false.

  Returns:
    true if the node is viewable, otherwise false

### makeVisible

    public void makeVisible(TreePath path)

### isRootVisible

    public boolean isRootVisible()

### setRootVisible

    public void setRootVisible(boolean visible)

### collapsePath

    public void collapsePath(TreePath path)

### expandPath

    public void expandPath(TreePath path)

### collapseAll

    public void collapseAll()

### expandAll

    public void expandAll()

### setExpandsSelectedPath

    public void setExpandsSelectedPath(boolean value)

### getWidgetForPath

    public Widget getWidgetForPath(TreePath path)

### broadcastEvent

    public void broadcastEvent(WidgetEvent event)

  Description copied from class: `AbstractWidget`
  Broadcast an event previously queued by this widget to its event listeners. Abstract implementation throws a `UnsupportedOperationException`. Concrete subclass widgets need to override when supporting event broadcasting.

  Specified by:
    `broadcastEvent` in interface `Widget`
  Overrides:
    `broadcastEvent` in class `AbstractWidget`

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

Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.