Java Doc for ItsNatTree.java in  » Ajax » ItsNat » org » itsnat » comp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » ItsNat » org.itsnat.comp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.itsnat.comp.ItsNatTree

All known Subclasses:   org.itsnat.impl.comp.ItsNatTreeImpl,
ItsNatTree
public interface ItsNatTree extends ItsNatElementComponent(Code)
Is the base interface of tree based components.

A tree component manages a javax.swing.tree.TreeModel data model, tree node values are rendered as markup using a special object, the renderer, and may be optionally edited "in place" using a user defined editor.

Any change to the data model is notified to the component and the markup is rendered again. The data model ever mandates over the markup, any initial markup content (initial root node) is removed.

Almost a root node must be present in the markup, this element is used as a pattern to create new tree nodes, and is removed because by default the data model is empty.

This component family uses a javax.swing.tree.TreeSelectionModel to keep track of selection states. When a tree node is selected (usually by clicking it) the selection state is updated accordingly using the selection model (this one fires any listener registered).

There is no default decoration of tree node selection, selection model listeners may be used to decorate the tree node markup when its selection state changes.

The component internally manages the expand/collapse behavior, when a mouse event is received (by default one click on handler, double click if icon or label) usually changes the expand/collapse state, this change is notified sending a javax.swing.event.TreeExpansionEvent to the registered listeners, these listeners must be used to manage how the expansion/collapsing is rendered visually (by default the component does not modify the view, does not force a default view behavior).

By default this component uses the default renderer and editor and a javax.swing.tree.DefaultTreeModel data model.

Row indexes start in 0.

This component family is the "componentized" version of org.itsnat.core.domutil.ElementTree and follows a similar philosophy.

ItsNat only provides "free trees" because no <tree> tag is present in HTML.


author:
   Jose Maria Arranz Santamaria




Method Summary
public  voidaddTreeExpansionListener(TreeExpansionListener tel)
     Registers a new tree expansion listener.
public  voidaddTreeWillExpandListener(TreeWillExpandListener tel)
     Registers a new "tree will expand" listener.
public  voidcollapseNode(TreePath treePath)
     Marks the specified node as collapsed.
public  voidcollapsePath(TreePath path)
     Collapses the specified node and node parents.
public  TreeModelcreateDefaultTreeModel()
     Creates a data model instance appropriated to this component.
public  voidexpandNode(TreePath treePath)
     Marks the specified node as expanded.
public  voidexpandPath(TreePath path)
     Expands the specified node and node parents.
public  TreePathgetEditingPath()
     Returns the path of the tree node being edited. the path of the tree node item being edited.
public  intgetEditingRow()
     Returns the row index of the tree node being edited. the row index of the tree node item being edited.
public  StringgetEditorActivatorEvent()
     Returns the event type used to activate the tree node edition process by the user. the event type used to activate the edition.
public  ItsNatTreeCellEditorgetItsNatTreeCellEditor()
     Returns the current tree node label editor.
public  ItsNatTreeCellRenderergetItsNatTreeCellRenderer()
     Returns the current component renderer.
public  ItsNatTreeStructuregetItsNatTreeStructure()
     Returns the component structure.
public  ItsNatTreeUIgetItsNatTreeUI()
     Returns the user interface manager of this component.
public  TreePathgetLastPath()
    
public  TreePathgetNextPath(TreePath path)
     Returns the path of the next node seeing the data model as a list (tree order).
public  TreePathgetNextSiblingPath(TreePath path)
     Returns the path of the next sibling node.
public  TreePathgetPreviousPath(TreePath path)
     Returns the previous path seeing the data model as a list (tree order).
public  TreePathgetPreviousSiblingPath(TreePath path)
     Returns the path of the previous sibling node.
public  intgetRowForPath(TreePath path)
     Returns the row position of the specified path.
public  RowMappergetRowMapper()
     Returns the built-in row mapper.
public  intgetToggleClickCount()
     Returns the number of mouse clicks needed to expand or close a node.

This number only counts for icon and label parts, the handle ever expands/collapses the node with every click.

Valid numbers: 0,1 and 2.

public  TreeExpansionListener[]getTreeExpansionListeners()
    
public  TreeModelgetTreeModel()
     Returns the current data model of this component.
public  intgetTreeNodeCount()
     Returns the number of nodes.
public  TreePathgetTreePathForRow(int row)
     Returns the path of the node at the specified row position.
public  TreeSelectionModelgetTreeSelectionModel()
     Returns the current selection model. the current selection model.
public  TreeWillExpandListener[]getTreeWillExpandListeners()
    
public  booleanisEditing()
     Informs whether a tree node value is being edited.
public  booleanisExpandedNode(TreePath treePath)
     Informs whether the specified path is expanded.
Parameters:
  treePath - the specified path.
public  booleanisExpandsSelectedPaths()
     Returns the expandsSelectedPaths property.
public  booleanisRootless()
     Informs whether this tree has a visible root.

In a root-less tree the root node has no markup, direct child nodes are top level nodes.

public  booleanisTreeTable()
     Informs whether this tree is a tree-table.

The tree-table mode only affects to the layout of tree nodes.

public  voidremoveTreeExpansionListener(TreeExpansionListener tel)
     Unregisters the specified tree expansion listener.
public  voidremoveTreeWillExpandListener(TreeWillExpandListener tel)
     Unregisters the specified "tree will expand" listener.
public  voidsetEditorActivatorEvent(String eventType)
     Sets the event type used to activate the tree node edition process by the user.
public  voidsetExpandsSelectedPaths(boolean newValue)
     Sets the expandsSelectedPaths property.
public  voidsetItsNatTreeCellEditor(ItsNatTreeCellEditor editor)
     Sets the tree node label editor.

Tree node edition works very much the same as label edition (see ItsNatLabel.setItsNatLabelEditor(ItsNatLabelEditor) ).

Some differences:

The edition process starts programmatically by calling ItsNatTree.startEditingAtPath(javax.swing.tree.TreePath) or ItsNatTree.startEditingAtRow(int) .

The edition takes place inside the tree node label element as returned by ItsNatTreeStructure.getLabelElement(ItsNatTreeintorg.w3c.dom.Element) .

The new tree node value is set to the data model calling javax.swing.tree.TreeModel.valueForPathChanged(javax.swing.tree.TreePath,Object).


Parameters:
  editor - the new editor.
public  voidsetItsNatTreeCellRenderer(ItsNatTreeCellRenderer renderer)
     Sets the component renderer.
public  voidsetToggleClickCount(int toggleClickCount)
     Sets the number of mouse clicks needed to expand or close a node.
Parameters:
  toggleClickCount - number of mouse clicks to expand/collapse a node.
public  voidsetTreeModel(TreeModel dataModel)
     Changes the data model of this component.

Current data model is disconnected from this component, and the new data model is bound to this component, every change is tracked and updates the user interfaces accordingly.

If the specified data model is the same instance as the current data model, then is reset, component listener is removed and added again.

public  voidsetTreeSelectionModel(TreeSelectionModel selectionModel)
     Sets the new selection model.

If the new selection model is the current defined then is "reset", component listener is removed and added again.

public  voidstartEditingAtPath(TreePath path)
     Used to start programmatically a tree node edition process "in place".
public  voidstartEditingAtRow(int row)
     Used to start programmatically a tree node edition process "in place".
public  voidtoggleExpansionStateNode(TreePath treePath)
     Changes the expansion state of the specified node to the contrary.



Method Detail
addTreeExpansionListener
public void addTreeExpansionListener(TreeExpansionListener tel)(Code)
Registers a new tree expansion listener. This listener is called after a tree node is expanded/collapsed.
Parameters:
  tel - the listener to register.
See Also:   ItsNatTree.removeTreeExpansionListener(javax.swing.event.TreeExpansionListener)



addTreeWillExpandListener
public void addTreeWillExpandListener(TreeWillExpandListener tel)(Code)
Registers a new "tree will expand" listener. This listener is called before a tree node is going to expand/collapse and can veto this action.
Parameters:
  tel - the listener to register.
See Also:   ItsNatTree.removeTreeWillExpandListener(javax.swing.event.TreeWillExpandListener)



collapseNode
public void collapseNode(TreePath treePath)(Code)
Marks the specified node as collapsed.

Symmetric behavior is applied to collapse request than ItsNatTree.expandNode(javax.swing.tree.TreePath) .


Parameters:
  treePath - the node path to collapse.
See Also:   ItsNatTree.expandNode(javax.swing.tree.TreePath)
See Also:   
See Also:   org.itsnat.comp.ui.ItsNatTreeCellUI.expand(boolean)
See Also:   



collapsePath
public void collapsePath(TreePath path)(Code)
Collapses the specified node and node parents.
Parameters:
  path - the path to expand.
See Also:   ItsNatTree.expandPath(javax.swing.tree.TreePath)



createDefaultTreeModel
public TreeModel createDefaultTreeModel()(Code)
Creates a data model instance appropriated to this component. This instance is not bound to the component. a new data model instance.



expandNode
public void expandNode(TreePath treePath)(Code)
Marks the specified node as expanded.

First of all a javax.swing.event.TreeExpansionEvent event is sent to the registered javax.swing.event.TreeWillExpandListener listeners, if expansion request is not vetoed then the node is marked as expanded and previous event is sent again to the registered javax.swing.event.TreeExpansionListener listeners.


Parameters:
  treePath - the node path to expand.
See Also:   ItsNatTree.collapseNode(javax.swing.tree.TreePath)
See Also:   org.itsnat.comp.ui.ItsNatTreeCellUI.expand(boolean)
See Also:   



expandPath
public void expandPath(TreePath path)(Code)
Expands the specified node and node parents.
Parameters:
  path - the path to expand.
See Also:   ItsNatTree.collapsePath(javax.swing.tree.TreePath)



getEditingPath
public TreePath getEditingPath()(Code)
Returns the path of the tree node being edited. the path of the tree node item being edited. Null if none is being edited.



getEditingRow
public int getEditingRow()(Code)
Returns the row index of the tree node being edited. the row index of the tree node item being edited. -1 if none is being edited.



getEditorActivatorEvent
public String getEditorActivatorEvent()(Code)
Returns the event type used to activate the tree node edition process by the user. the event type used to activate the edition. By default is "dblclick".
See Also:   ItsNatTree.setEditorActivatorEvent(String)



getItsNatTreeCellEditor
public ItsNatTreeCellEditor getItsNatTreeCellEditor()(Code)
Returns the current tree node label editor. This object is used to edit in place a tree node value. the current editor. By default uses the default editor calling (ItsNatComponentManager.createDefaultItsNatTreeCellEditor(ItsNatComponent)) with a null parameter.
See Also:   ItsNatTree.setItsNatTreeCellEditor(ItsNatTreeCellEditor)



getItsNatTreeCellRenderer
public ItsNatTreeCellRenderer getItsNatTreeCellRenderer()(Code)
Returns the current component renderer. This renderer converts a tree node value to markup. the current renderer. By default uses the default renderer (ItsNatComponentManager.createDefaultItsNatTreeCellRenderer)
See Also:   ItsNatTree.setItsNatTreeCellRenderer(ItsNatTreeCellRenderer)



getItsNatTreeStructure
public ItsNatTreeStructure getItsNatTreeStructure()(Code)
Returns the component structure. the component structure.



getItsNatTreeUI
public ItsNatTreeUI getItsNatTreeUI()(Code)
Returns the user interface manager of this component. the user interface manager.



getLastPath
public TreePath getLastPath()(Code)
Returns the last node (tree order) the last node, null if the tree is empty.



getNextPath
public TreePath getNextPath(TreePath path)(Code)
Returns the path of the next node seeing the data model as a list (tree order).

First tries to return the first child, if no child returns the next sibling, if no next sibling returns the next sibling of the parent node, if none then the next sibling of the parent of the parent and so on.

the next path or null if this node is the last.
See Also:   ItsNatTree.getPreviousPath(javax.swing.tree.TreePath)
See Also:   ItsNatTree.getNextSiblingPath(javax.swing.tree.TreePath)



getNextSiblingPath
public TreePath getNextSiblingPath(TreePath path)(Code)
Returns the path of the next sibling node. the next sibling path or null if specified path is the last child node or is the root.
See Also:   ItsNatTree.getPreviousSiblingPath(javax.swing.tree.TreePath)



getPreviousPath
public TreePath getPreviousPath(TreePath path)(Code)
Returns the previous path seeing the data model as a list (tree order).

First tries to return the previous sibling, if no sibling then returns the parent.

the previous path or null if specified path is the root node.
See Also:   ItsNatTree.getNextPath(javax.swing.tree.TreePath)
See Also:   ItsNatTree.getPreviousSiblingPath(javax.swing.tree.TreePath)



getPreviousSiblingPath
public TreePath getPreviousSiblingPath(TreePath path)(Code)
Returns the path of the previous sibling node. the previous sibling path or null if specified path is the first child node or is the root.
See Also:   ItsNatTree.getNextSiblingPath(javax.swing.tree.TreePath)



getRowForPath
public int getRowForPath(TreePath path)(Code)
Returns the row position of the specified path. This position is obtained calling the built-in row mapper. the row position of the path. #getRowMapper()



getRowMapper
public RowMapper getRowMapper()(Code)
Returns the built-in row mapper.

This row mapper can not be replaced and is set automatically to the registered selection model ( ItsNatTree.setTreeSelectionModel(javax.swing.tree.TreeSelectionModel) ).

Current implementation converts a TreePath to the matched row seeing the tree as a list (root node is 0), where every node is "visible" (in a server point of view, the same node in the client may be hidden).

the built-in row mapper.



getToggleClickCount
public int getToggleClickCount()(Code)
Returns the number of mouse clicks needed to expand or close a node.

This number only counts for icon and label parts, the handle ever expands/collapses the node with every click.

Valid numbers: 0,1 and 2. If 0 icon and label do not expand/collapse the node when clicked.

number of mouse clicks to expand/collapse a node. By default is 2.
See Also:   ItsNatTree.setToggleClickCount(int)



getTreeExpansionListeners
public TreeExpansionListener[] getTreeExpansionListeners()(Code)
Returns all registered "tree expansion" listeners an array with all registered "tree expansion" listeners



getTreeModel
public TreeModel getTreeModel()(Code)
Returns the current data model of this component. the current data model
See Also:   ItsNatTree.setTreeModel(javax.swing.tree.TreeModel)



getTreeNodeCount
public int getTreeNodeCount()(Code)
Returns the number of nodes. This value is got traversing the data model. the number of nodes.



getTreePathForRow
public TreePath getTreePathForRow(int row)(Code)
Returns the path of the node at the specified row position.

Current implementation specifies every node is visible (server point of view) row-path conversion is straightforward seeing the tree as a list.


Parameters:
  row - the specified row position. the path of the node at this row position.
See Also:   ItsNatTree.getRowMapper()



getTreeSelectionModel
public TreeSelectionModel getTreeSelectionModel()(Code)
Returns the current selection model. the current selection model. By default a javax.swing.tree.DefaultTreeSelectionModel instance.
See Also:   ItsNatTree.setTreeSelectionModel(javax.swing.tree.TreeSelectionModel)



getTreeWillExpandListeners
public TreeWillExpandListener[] getTreeWillExpandListeners()(Code)
Returns all registered tree "tree will expand" listeners an array with all registered "tree will expand" listeners



isEditing
public boolean isEditing()(Code)
Informs whether a tree node value is being edited. true if a tree node item value is being edited.
See Also:   ItsNatTree.startEditingAtPath(javax.swing.tree.TreePath)
See Also:   ItsNatTree.startEditingAtRow(int)



isExpandedNode
public boolean isExpandedNode(TreePath treePath)(Code)
Informs whether the specified path is expanded.
Parameters:
  treePath - the specified path. true if the specified path is expanded, true by default.
See Also:   org.itsnat.comp.ui.ItsNatTreeCellUI.isExpanded



isExpandsSelectedPaths
public boolean isExpandsSelectedPaths()(Code)
Returns the expandsSelectedPaths property. true if selection changes result in the parent path being expanded
See Also:   ItsNatTree.setExpandsSelectedPaths(boolean)



isRootless
public boolean isRootless()(Code)
Informs whether this tree has a visible root.

In a root-less tree the root node has no markup, direct child nodes are top level nodes. This feature may be used to build trees with "multiple roots" visually, this is very useful in vertical tree-based menus where a root node is disturbing.

true if root node has no markup.



isTreeTable
public boolean isTreeTable()(Code)
Informs whether this tree is a tree-table.

The tree-table mode only affects to the layout of tree nodes. If not tree-table (normal) child nodes are contained by the parent tree node markup, in a tree-table layout is as a list, all tree nodes are "top" level nodes as whether they all were roots (only from a layout point of view).

true if this tree has a tree-table layout.



removeTreeExpansionListener
public void removeTreeExpansionListener(TreeExpansionListener tel)(Code)
Unregisters the specified tree expansion listener.
Parameters:
  tel - the listener to unregister.
See Also:   ItsNatTree.addTreeExpansionListener(javax.swing.event.TreeExpansionListener)



removeTreeWillExpandListener
public void removeTreeWillExpandListener(TreeWillExpandListener tel)(Code)
Unregisters the specified "tree will expand" listener.
Parameters:
  tel - the listener to unregister.
See Also:   ItsNatTree.addTreeWillExpandListener(javax.swing.event.TreeWillExpandListener)



setEditorActivatorEvent
public void setEditorActivatorEvent(String eventType)(Code)
Sets the event type used to activate the tree node edition process by the user.
Parameters:
  eventType - the event type used to activate the edition.
See Also:   ItsNatTree.getEditorActivatorEvent()
See Also:   



setExpandsSelectedPaths
public void setExpandsSelectedPaths(boolean newValue)(Code)
Sets the expandsSelectedPaths property. If true, any time the selection is changed, either via the TreeSelectionModel, or the cover methods provided by this component like ItsNatTree.expandNode(javax.swing.tree.TreePath) , the TreePaths parents will be expanded too to make them visible (visible meaning the parent path is expanded, not necessarily in the visible rectangle of the tree). If false, when the selection changes the node parents are not expanded. This is useful if you wish to have your selection model maintain selected paths that are not always expanded (all parents expanded).
Parameters:
  newValue - the new value for expandsSelectedPaths
See Also:   ItsNatTree.isExpandsSelectedPaths()



setItsNatTreeCellEditor
public void setItsNatTreeCellEditor(ItsNatTreeCellEditor editor)(Code)
Sets the tree node label editor.

Tree node edition works very much the same as label edition (see ItsNatLabel.setItsNatLabelEditor(ItsNatLabelEditor) ).

Some differences:

The edition process starts programmatically by calling ItsNatTree.startEditingAtPath(javax.swing.tree.TreePath) or ItsNatTree.startEditingAtRow(int) .

The edition takes place inside the tree node label element as returned by ItsNatTreeStructure.getLabelElement(ItsNatTreeintorg.w3c.dom.Element) .

The new tree node value is set to the data model calling javax.swing.tree.TreeModel.valueForPathChanged(javax.swing.tree.TreePath,Object).


Parameters:
  editor - the new editor. May be null (edition disabled).
See Also:   ItsNatTree.getItsNatTreeCellEditor()
See Also:   



setItsNatTreeCellRenderer
public void setItsNatTreeCellRenderer(ItsNatTreeCellRenderer renderer)(Code)
Sets the component renderer.
Parameters:
  renderer - the new renderer.
See Also:   ItsNatTree.getItsNatTreeCellRenderer()
See Also:   



setToggleClickCount
public void setToggleClickCount(int toggleClickCount)(Code)
Sets the number of mouse clicks needed to expand or close a node.
Parameters:
  toggleClickCount - number of mouse clicks to expand/collapse a node. Valid numbers: 0,1 and 2.
See Also:   ItsNatTree.getToggleClickCount()



setTreeModel
public void setTreeModel(TreeModel dataModel)(Code)
Changes the data model of this component.

Current data model is disconnected from this component, and the new data model is bound to this component, every change is tracked and updates the user interfaces accordingly.

If the specified data model is the same instance as the current data model, then is reset, component listener is removed and added again. Use this technique if you want to add a data model listener to be executed before the default component listener.
Parameters:
  dataModel - the new data model.
See Also:   ItsNatTree.getTreeModel()




setTreeSelectionModel
public void setTreeSelectionModel(TreeSelectionModel selectionModel)(Code)
Sets the new selection model.

If the new selection model is the current defined then is "reset", component listener is removed and added again. Use this technique if you want to add a listener to be executed before the default component listener.

The component automatically replaces the current selection model javax.swing.tree.RowMapper with the internal row mapper ( ItsNatTree.getRowMapper() ) calling TreeSelectionModel.setRowMapper(RowMapper).


Parameters:
  selectionModel - the new selection model.
See Also:   ItsNatTree.getTreeSelectionModel()



startEditingAtPath
public void startEditingAtPath(TreePath path)(Code)
Used to start programmatically a tree node edition process "in place".
Parameters:
  path - the tree node path to edit.
See Also:   ItsNatTree.startEditingAtRow(int)
See Also:   ItsNatTree.isEditing()



startEditingAtRow
public void startEditingAtRow(int row)(Code)
Used to start programmatically a tree node edition process "in place".
Parameters:
  row - the tree node row to edit.
See Also:   ItsNatTree.startEditingAtPath(javax.swing.tree.TreePath)
See Also:   ItsNatTree.isEditing()



toggleExpansionStateNode
public void toggleExpansionStateNode(TreePath treePath)(Code)
Changes the expansion state of the specified node to the contrary.

Same behavior as ItsNatTree.expandNode(javax.swing.tree.TreePath) and ItsNatTree.collapseNode(javax.swing.tree.TreePath) .


Parameters:
  treePath - the node path to change expansion state.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.