Java Doc for FoldHierarchy.java in  » IDE-Netbeans » editor » org » netbeans » api » editor » fold » 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 » IDE Netbeans » editor » org.netbeans.api.editor.fold 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.api.editor.fold.FoldHierarchy

FoldHierarchy
final public class FoldHierarchy (Code)
Hierarchy of the folds for a single text component represents a model of the code-folding.
It is the main entry point into the Code Folding API.
Its instance can be obtained by FoldHierarchy.get(javax.swing.text.JTextComponent) .
The hierarhcy mainly provides access to the root fold by FoldHierarchy.getRootFold() and allows to expand/collapse the folds and listen for fold events describing folds structure changes and state changes of any of the folds in the hierarchy.

Hierarchy is logically bound to view i.e. javax.swing.text.JTextComponent instead of the document model because if there would be two views over the same document then a particular fold can be collapsed in one view but uncollapsed in another.
It's up to the concrete fold implementations to possibly share some common information even on document model level e.g. java-related folds in multiple views over a single java source document can share the document-level parsing information.
On the other hand user-defined folds (e.g. by collapsing caret selection) will only be held for the component in which they were created.

Only one thread at the time can access the code folding hierarchy. Prior working with the hierarchy a document-level lock must be obtained first followed by call to FoldHierarchy.render(Runnable) (or FoldHierarchy.lock() for advanced uses) which ensure that the hierarchy gets locked exclusively.
The document lock can be either readlock e.g. by using javax.swing.text.Document.render(Runnable) or writelock e.g. when in javax.swing.event.DocumentListener ) and must be obtained on component's document i.e. javax.swing.text.JTextComponent.getDocument should be used.

The whole fold hierarchy related code expects that the document instances of the text component will subclass javax.swing.text.AbstractDocument.
author:
   Miloslav Metelka
version:
   1.00



Field Summary
final public static  FoldTypeROOT_FOLD_TYPE
     Fold type for the root fold.


Method Summary
public  voidaddFoldHierarchyListener(FoldHierarchyListener l)
     Add listener for changes done in the hierarchy.
public  voidcollapse(Fold f)
     Collapse the given fold.
public  voidcollapse(Collection c)
     Collapse all the folds contained in the given collection.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  c - collection of the Folds to be collapsed.

public  voidexpand(Fold f)
     Expand the given fold.
public  voidexpand(Collection c)
     Expand all the folds contained in the given collection.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  c - collection of the Folds to be collapsed.

public static synchronized  FoldHierarchyget(JTextComponent component)
     Get the fold hierarchy for the given component.
public  JTextComponentgetComponent()
     Get the text component for which this fold hierarchy was created.
public  FoldgetRootFold()
     Get the root fold of this hierarchy.
public  voidlock()
     Lock the hierarchy for exclusive use.
public  voidremoveFoldHierarchyListener(FoldHierarchyListener l)
     Remove previously added listener for changes done in the hierarchy.
public  voidrender(Runnable r)
     Execute the given runnable over the exclusively locked hierarchy.
Prior using this method the document must be locked. The document lock can be either readlock e.g.
public  StringtoString()
     Get a string description of the hierarchy for debugging purposes.
public  voidtoggle(Fold f)
     Collapse the given fold if it's expanded and expand it if it's collapsed.
public  voidunlock()
     Unlock the hierarchy from exclusive use.

Field Detail
ROOT_FOLD_TYPE
final public static FoldType ROOT_FOLD_TYPE(Code)
Fold type for the root fold.





Method Detail
addFoldHierarchyListener
public void addFoldHierarchyListener(FoldHierarchyListener l)(Code)
Add listener for changes done in the hierarchy.
Parameters:
  l - non-null listener to be added.



collapse
public void collapse(Fold f)(Code)
Collapse the given fold.
Nothing is done if the fold is already collapsed.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  f - fold to be collapsed.




collapse
public void collapse(Collection c)(Code)
Collapse all the folds contained in the given collection.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  c - collection of the Folds to be collapsed. The foldsmust be present in this hierarchy.




expand
public void expand(Fold f)(Code)
Expand the given fold.
Nothing is done if the fold is already expanded.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  f - fold to be expanded.




expand
public void expand(Collection c)(Code)
Expand all the folds contained in the given collection.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  c - collection of the Folds to be collapsed. The foldsmust be present in this hierarchy.




get
public static synchronized FoldHierarchy get(JTextComponent component)(Code)
Get the fold hierarchy for the given component. If the hierarchy does not exist yet it will get created.
The hierarchy will exist for the entire lifetime of the component. It is maintained as a client property of it. non-null fold hierarchy for the component.



getComponent
public JTextComponent getComponent()(Code)
Get the text component for which this fold hierarchy was created. non-null text component for which this fold hierarchy was created.



getRootFold
public Fold getRootFold()(Code)
Get the root fold of this hierarchy. root fold of this hierarchy.The root fold covers the whole document and is uncollapsable.



lock
public void lock()(Code)
Lock the hierarchy for exclusive use. This method must only be used together with FoldHierarchy.unlock() in try..finally block.
Prior using this method the document must be locked. The document lock can be either readlock e.g. by using javax.swing.text.Document.render(Runnable) or writelock e.g. when in javax.swing.event.DocumentListener ) and must be obtained on component's document i.e. javax.swing.text.JTextComponent.getDocument should be used.

Note: The clients using this method must ensure that they always use this method in the following pattern:

 lock();
 try {
 ...
 } finally {
 unlock();
 }
 

See Also:   FoldHierarchy.render(Runnable)



removeFoldHierarchyListener
public void removeFoldHierarchyListener(FoldHierarchyListener l)(Code)
Remove previously added listener for changes done in the hierarchy.
Parameters:
  l - non-null listener to be removed.



render
public void render(Runnable r)(Code)
Execute the given runnable over the exclusively locked hierarchy.
Prior using this method the document must be locked. The document lock can be either readlock e.g. by using javax.swing.text.Document.render(Runnable) or writelock e.g. when in javax.swing.event.DocumentListener ) and must be obtained on component's document i.e. javax.swing.text.JTextComponent.getDocument should be used.
Parameters:
  r - the runnable to be executed.



toString
public String toString()(Code)
Get a string description of the hierarchy for debugging purposes.
Like all other methods this one can only be used under locking conditions for the hierarchy.



toggle
public void toggle(Fold f)(Code)
Collapse the given fold if it's expanded and expand it if it's collapsed.

Note: The hierarchy must be locked prior using of this method.
Parameters:
  f - fold which state should be toggled.




unlock
public void unlock()(Code)
Unlock the hierarchy from exclusive use. This method must only be used together with FoldHierarchy.lock() in try..finally block.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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