Java Doc for JGraphEditorModel.java in  » Graphic-Library » jgraphpad » com » jgraph » editor » 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 » Graphic Library » jgraphpad » com.jgraph.editor 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.tree.DefaultTreeModel
      com.jgraph.editor.JGraphEditorModel

JGraphEditorModel
public class JGraphEditorModel extends DefaultTreeModel (Code)
Default document model for JGraph editors. This class is in charge of preparing the bean info classes and has a map of persistence delegate for XML encoding. You should use the writeObject and readObject method of this class for file I/O to properly use the registered peristence delegates.
Note: The API refers to the children of the JGraphEditorModel.rootNode as roots.


Field Summary
protected  MappersistenceDelegates
     Holds the (class, persistence delegate) pairs.
protected  DefaultMutableTreeNoderootNode
     Reference to the mutable root node.

Constructor Summary
public  JGraphEditorModel()
     Constructs a new JGraph editor model adding persistence delegates for the DefaultGraphModel, GraphLayoutCache and DefaultEdge.DefaultRouting classes.

Method Summary
public  MutableTreeNodeaddChild(MutableTreeNode child, MutableTreeNode parent)
     Adds the specified child to parent.
public  ObjectaddFile(String uri)
     Reads the specified URI and adds it as a root.
Parameters:
  uri - The URI to read the object from.
public  ObjectaddPersistenceDelegate(Class clazz, PersistenceDelegate delegate)
     Associates the specified persistence delegate with clazz for XML encoding.
Parameters:
  clazz - The class to associate the delegate with.
public  MutableTreeNodeaddRoot(MutableTreeNode node)
     Adds the specified root as a child to JGraphEditorModel.rootNode .
protected  voidconfigureEncoder(XMLEncoder enc)
     Hook for subclassers to configure a new XML encoder for writing an object.
public  JGraphEditorFilegetFileByFilename(String filename)
     Returns the file for the specified filename if it is in the model or null if no such file exists.
Parameters:
  filename - The filename to return the file for.
public  InputStreamgetInputStream(String uri)
     Hook for subclassers to create an input stream for the specified URI. This implementation creates an input stream using JGraphEditorResources.getInputStream(String) and wraps it in a GZIPInputStream if the URI ends with .gz.
Parameters:
  uri - The URI to return the input stream for.
public  OutputStreamgetOutputStream(String uri)
     Hook for subclassers to create an output stream for the specified URI. This implementation creates an output stream using JGraphEditorResources.getOutputStream(String) and wraps it in a java.util.zip.GZIPOutputStream if the URI ends with .gz.
Parameters:
  uri - The URI to return the output stream for.
public static  JGraphEditorFilegetParentFile(TreeNode node)
     Returns the parent file for node or the node itself, if it is a file.
public  PersistenceDelegategetPersistenceDelegate(Class clazz)
     Returns the associated persistence delegate for clazz or null if no association exists.
Parameters:
  clazz - The clazz to return the delegate for.
protected  voidinstallDiagramListeners(JGraphEditorDiagram diagram)
     Installs the listeners required to update the modified state of the parent file node to diagram.
protected  voidinstallListeners(TreeNode node)
     Hook for subclassers to install the required listeners in new tree nodes.
public static  voidmakeCellViewFieldsTransient(Class clazz)
     Makes all fields but cell and attributes transient in the bean info of clazz.
public static  voidmakeTransient(Class clazz, String field)
     Makes the specified field transient in the bean info of clazz.
public  ObjectreadObject(InputStream in)
     Returns a new object from the specified stream using a new XML decoder. This method does nothing special.
public  Enumerationroots()
     Returns the first generation of childs, aka roots.
public  voidsetFilename(JGraphEditorFile file, String filename)
     Sets the filename of the specified file and dispatches a notification event.
public  voidsetModified(JGraphEditorFile file, boolean modified)
     Sets the modified state of the specified file and dispatches a notification event.
public  voidsetName(JGraphEditorDiagram diagram, String name)
     Sets the name of the specified diagram and dispatches a notification event.
public  voidsetUserObject(TreeNode node, Object userObject)
     Sets the user object of the specified node and dispatches a notification event.
public  voidwriteObject(Object object, OutputStream out)
     Writes the specified object to the output stream using an xml encoder which was configured using JGraphEditorModel.configureEncoder(XMLEncoder) .

Field Detail
persistenceDelegates
protected Map persistenceDelegates(Code)
Holds the (class, persistence delegate) pairs.



rootNode
protected DefaultMutableTreeNode rootNode(Code)
Reference to the mutable root node.




Constructor Detail
JGraphEditorModel
public JGraphEditorModel()(Code)
Constructs a new JGraph editor model adding persistence delegates for the DefaultGraphModel, GraphLayoutCache and DefaultEdge.DefaultRouting classes. This also adds a tree model listener to this model to update the modified state of parent files for child changes.




Method Detail
addChild
public MutableTreeNode addChild(MutableTreeNode child, MutableTreeNode parent)(Code)
Adds the specified child to parent. Calls JGraphEditorModel.installListeners(TreeNode) on the child.
Parameters:
  child - The node to add to parent.
Parameters:
  parent - The parent to add child to. Returns the child that has been added.



addFile
public Object addFile(String uri) throws MalformedURLException, IOException(Code)
Reads the specified URI and adds it as a root.
Parameters:
  uri - The URI to read the object from. Returns the object stat was added.



addPersistenceDelegate
public Object addPersistenceDelegate(Class clazz, PersistenceDelegate delegate)(Code)
Associates the specified persistence delegate with clazz for XML encoding.
Parameters:
  clazz - The class to associate the delegate with. Returns the previous delegate for clazz.



addRoot
public MutableTreeNode addRoot(MutableTreeNode node)(Code)
Adds the specified root as a child to JGraphEditorModel.rootNode . Calls JGraphEditorModel.installListeners(TreeNode) on the node.
Parameters:
  node - The node to add to JGraphEditorModel.rootNode. Returns the node that has been added.



configureEncoder
protected void configureEncoder(XMLEncoder enc)(Code)
Hook for subclassers to configure a new XML encoder for writing an object. This implementation sets all registered persistence delegates and installs default mappings for classes (eg. it assigns the list persistence delegates to array lists).
Parameters:
  enc - The encoder to be configured.



getFileByFilename
public JGraphEditorFile getFileByFilename(String filename)(Code)
Returns the file for the specified filename if it is in the model or null if no such file exists.
Parameters:
  filename - The filename to return the file for. Returns the file for filename or null.



getInputStream
public InputStream getInputStream(String uri) throws MalformedURLException, FileNotFoundException, IOException(Code)
Hook for subclassers to create an input stream for the specified URI. This implementation creates an input stream using JGraphEditorResources.getInputStream(String) and wraps it in a GZIPInputStream if the URI ends with .gz.
Parameters:
  uri - The URI to return the input stream for. Return an input stream for the specified URI.



getOutputStream
public OutputStream getOutputStream(String uri) throws IOException(Code)
Hook for subclassers to create an output stream for the specified URI. This implementation creates an output stream using JGraphEditorResources.getOutputStream(String) and wraps it in a java.util.zip.GZIPOutputStream if the URI ends with .gz.
Parameters:
  uri - The URI to return the output stream for. Returns an output stream for the specified URI.



getParentFile
public static JGraphEditorFile getParentFile(TreeNode node)(Code)
Returns the parent file for node or the node itself, if it is a file. This method returns null if no parent file is found for node.
Parameters:
  node - The node to find the parent file for. Returns the parent file for node, the node itself ornull.



getPersistenceDelegate
public PersistenceDelegate getPersistenceDelegate(Class clazz)(Code)
Returns the associated persistence delegate for clazz or null if no association exists.
Parameters:
  clazz - The clazz to return the delegate for. Returns the persistence delegate for clazz ornull.



installDiagramListeners
protected void installDiagramListeners(JGraphEditorDiagram diagram)(Code)
Installs the listeners required to update the modified state of the parent file node to diagram. This implementation adds a graph layout cache listener and a graph model listener.
Parameters:
  diagram - The diagram to install the listeners to.



installListeners
protected void installListeners(TreeNode node)(Code)
Hook for subclassers to install the required listeners in new tree nodes. This is invoked recursively for tree nodes and calls JGraphEditorModel.installDiagramListeners(JGraphEditorDiagram) on all diagrams that are found along the invocation chain.
Parameters:
  node - The node to scan for diagrams.



makeCellViewFieldsTransient
public static void makeCellViewFieldsTransient(Class clazz)(Code)
Makes all fields but cell and attributes transient in the bean info of clazz.
Parameters:
  clazz - The cell view class who fields should be made transient.



makeTransient
public static void makeTransient(Class clazz, String field)(Code)
Makes the specified field transient in the bean info of clazz.
Parameters:
  clazz - The class whos field should be made transient.
Parameters:
  field - The name of the field that should be made transient.



readObject
public Object readObject(InputStream in)(Code)
Returns a new object from the specified stream using a new XML decoder. This method does nothing special. Subclassers can override this method if they need to do anything special with opened files.
Note: You should use this method as a global hook to read all XML files. Returns a new object from the specified stream.



roots
public Enumeration roots()(Code)
Returns the first generation of childs, aka roots. This usually returns the documents and repositories, eg files that are currently open. Returns the children of JGraphEditorModel.rootNode.



setFilename
public void setFilename(JGraphEditorFile file, String filename)(Code)
Sets the filename of the specified file and dispatches a notification event.
Parameters:
  file - The file to change the filename for.
Parameters:
  filename - The new filename.



setModified
public void setModified(JGraphEditorFile file, boolean modified)(Code)
Sets the modified state of the specified file and dispatches a notification event.
Parameters:
  file - The file to change the modified state for.
Parameters:
  modified - The new modified state.



setName
public void setName(JGraphEditorDiagram diagram, String name)(Code)
Sets the name of the specified diagram and dispatches a notification event.
Parameters:
  diagram - The diagram to change the name for.
Parameters:
  name - The new name.



setUserObject
public void setUserObject(TreeNode node, Object userObject)(Code)
Sets the user object of the specified node and dispatches a notification event.
Parameters:
  node - The node to change the user object for.
Parameters:
  userObject - The new user object.



writeObject
public void writeObject(Object object, OutputStream out)(Code)
Writes the specified object to the output stream using an xml encoder which was configured using JGraphEditorModel.configureEncoder(XMLEncoder) . The exceptions that are thrown during encoding are caught by a local handler and passed to the caller as a RuntimeException with description of the encoding problems.
Note: You should use this method as a global hook to write all XML files.
Parameters:
  object - The object to be written.
Parameters:
  out - The output strem to write to.
throws:
  RuntimeException - If there are problems during encoding.



Fields inherited from javax.swing.tree.DefaultTreeModel
protected boolean asksAllowsChildren(Code)(Java Doc)
protected EventListenerList listenerList(Code)(Java Doc)
protected TreeNode root(Code)(Java Doc)

Methods inherited from javax.swing.tree.DefaultTreeModel
public void addTreeModelListener(TreeModelListener l)(Code)(Java Doc)
public boolean asksAllowsChildren()(Code)(Java Doc)
protected void fireTreeNodesChanged(Object source, Object[] path, int[] childIndices, Object[] children)(Code)(Java Doc)
protected void fireTreeNodesInserted(Object source, Object[] path, int[] childIndices, Object[] children)(Code)(Java Doc)
protected void fireTreeNodesRemoved(Object source, Object[] path, int[] childIndices, Object[] children)(Code)(Java Doc)
protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children)(Code)(Java Doc)
public Object getChild(Object parent, int index)(Code)(Java Doc)
public int getChildCount(Object parent)(Code)(Java Doc)
public int getIndexOfChild(Object parent, Object child)(Code)(Java Doc)
public T[] getListeners(Class<T> listenerType)(Code)(Java Doc)
public TreeNode[] getPathToRoot(TreeNode aNode)(Code)(Java Doc)
protected TreeNode[] getPathToRoot(TreeNode aNode, int depth)(Code)(Java Doc)
public Object getRoot()(Code)(Java Doc)
public TreeModelListener[] getTreeModelListeners()(Code)(Java Doc)
public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)(Code)(Java Doc)
public boolean isLeaf(Object node)(Code)(Java Doc)
public void nodeChanged(TreeNode node)(Code)(Java Doc)
public void nodeStructureChanged(TreeNode node)(Code)(Java Doc)
public void nodesChanged(TreeNode node, int[] childIndices)(Code)(Java Doc)
public void nodesWereInserted(TreeNode node, int[] childIndices)(Code)(Java Doc)
public void nodesWereRemoved(TreeNode node, int[] childIndices, Object[] removedChildren)(Code)(Java Doc)
public void reload()(Code)(Java Doc)
public void reload(TreeNode node)(Code)(Java Doc)
public void removeNodeFromParent(MutableTreeNode node)(Code)(Java Doc)
public void removeTreeModelListener(TreeModelListener l)(Code)(Java Doc)
public void setAsksAllowsChildren(boolean newValue)(Code)(Java Doc)
public void setRoot(TreeNode root)(Code)(Java Doc)
public void valueForPathChanged(TreePath path, Object newValue)(Code)(Java Doc)

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.