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:
- Locatable, Widget
- public class Tree
- extends AbstractWidget
A tree widget, heavily inspired by Swing's JTree
.
- Version:
- $Id: Tree.java 190962 2005-06-16 17:17:00Z sylvain $
Methods inherited from class org.apache.cocoon.forms.formmodel.AbstractWidget |
addValidator, broadcastEvent, 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 |
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
Tree
protected Tree(TreeDefinition definition)
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.
(@link 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 tolocale
- 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)
setExpandsSelectedPath
public void setExpandsSelectedPath(boolean value)
getWidgetForPath
public Widget getWidgetForPath(TreePath path)
Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.