|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.tree.DefaultTreeModel
ch.randelshofer.cubetwister.doc.DocumentModel
public class DocumentModel
Holds a CubeTwister document. A document is a tree of EntityModels. DocumentModels must be self-contained, that is, the the EntityModels in this DocumentModel must not have a reference to an EntityModel in another DocumentModel.
| Field Summary | |
|---|---|
static int |
CUBE_INDEX
|
static int |
NOTATION_INDEX
|
static java.lang.String |
PROP_DEFAULT_CUBE
|
static java.lang.String |
PROP_DEFAULT_NOTATION
|
protected java.beans.PropertyChangeSupport |
propertySupport
|
static int |
SCRIPT_INDEX
|
static int |
TEXT_INDEX
|
| Fields inherited from class javax.swing.tree.DefaultTreeModel |
|---|
asksAllowsChildren, listenerList, root |
| Fields inherited from interface ch.randelshofer.gui.tree.MutableTreeModel |
|---|
ENABLED_PROPERTY |
| Constructor Summary | |
|---|---|
DocumentModel()
Creates a new DocumentModel. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
void |
addSerializedNode(java.io.InputStream in)
Adds the contents of the input stream to the DocumentModel. |
void |
addTo(javax.swing.tree.DefaultMutableTreeNode newChild,
javax.swing.tree.TreeNode parent)
Invoked this to add newChild to parents children. |
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener l)
Adds an UndoableEditListener. |
void |
addXMLNode(nanoxml.XMLElement doc)
|
void |
close()
Shuts down all background processes. |
javax.swing.tree.TreePath |
createNodeAt(java.lang.Object newNodeType,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
Invoke this to insert a new child at location index in parents children. |
void |
dispatch(java.lang.Runnable runner)
Dispatches a runnable on the worker thread of the document model. |
void |
dispatchSolver(java.lang.Runnable runner)
Dispatches a runnable on the global thread pool of the virtual machine. |
void |
dispose()
|
java.awt.datatransfer.Transferable |
exportTransferable(javax.swing.tree.DefaultMutableTreeNode[] nodes)
Copies the indicated nodes to the clipboard. |
void |
fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
Notify all listeners that have registered interest for notification on this event type. |
java.lang.Object |
getCreatableNodeType(java.lang.Object parent)
Returns the default type of children that can be created at the specified node. |
java.lang.Object[] |
getCreatableNodeTypes(java.lang.Object parent)
Returns the types of children that may be created at this node. |
EntityModel |
getCubes()
|
CubeModel |
getDefaultCube()
Gets the default cube. |
NotationModel |
getDefaultNotation(int layerCount)
Gets the default notation. |
javax.swing.Action[] |
getNodeActions(javax.swing.tree.DefaultMutableTreeNode[] nodes)
Gets actions for the specified nodes. |
EntityModel |
getNotations()
|
EntityModel |
getScripts()
|
EntityModel |
getTexts()
|
java.util.List<javax.swing.tree.TreePath> |
importTransferable(java.awt.datatransfer.Transferable transfer,
int action,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
Causes a transfer to the model from a clipboard or a DND drop operation. |
void |
insertNodeInto(javax.swing.tree.MutableTreeNode newChild,
javax.swing.tree.MutableTreeNode parent,
int index)
Invoked this to add newChild to parents children. |
protected void |
insertNodeIntoQuiet(javax.swing.tree.DefaultMutableTreeNode newChild,
javax.swing.tree.TreeNode parent,
int index)
|
void |
insertSerializedNodeInto(java.io.InputStream in,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
Adds the contents of the input stream to the DocumentModel. |
void |
insertSerializedNodeInto(java.io.Reader r,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
Adds the contents of the input stream to the DocumentModel. |
void |
insertXMLNodeInto(nanoxml.XMLElement doc,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
|
boolean |
isCloseable()
Returns true, if no background processes are working on the model. |
boolean |
isImportable(java.awt.datatransfer.DataFlavor[] flavors,
int action,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
Indicates whether the model would accept an import of the given set of data flavors prior to actually attempting to import it. |
boolean |
isLeaf(java.lang.Object node)
|
boolean |
isNodeAddable(javax.swing.tree.DefaultMutableTreeNode parent,
int index)
Returns wether the specified node may be inserted. |
boolean |
isNodeEditable(javax.swing.tree.DefaultMutableTreeNode node)
Returns wether the specified node may be renamed. |
boolean |
isNodeRemovable(javax.swing.tree.DefaultMutableTreeNode node)
Returns wether the specified node may be removed. |
boolean |
isWriteMember(EntityModel m)
|
void |
removeNodeFromParent(javax.swing.tree.DefaultMutableTreeNode node)
Message this to remove node from its parent. |
protected void |
removeNodeFromParentQuiet(javax.swing.tree.DefaultMutableTreeNode node)
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
|
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
Removes an UndoableEditListener. |
void |
setDefaultCube(CubeModel newValue)
Sets the default cube. |
void |
setDefaultNotation(NotationModel value)
Sets the default notation. |
void |
setDispatcher(SequentialDispatcher d)
|
void |
writeXML(java.io.OutputStream out,
java.lang.Object[] entities)
Writes the indicated entities of the DocumentModel into the output stream. |
void |
writeXML(java.io.PrintWriter out)
Writes the contents of the DocumentModel into the output stream. |
| Methods inherited from class javax.swing.tree.DefaultTreeModel |
|---|
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.tree.TreeModel |
|---|
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, removeTreeModelListener, valueForPathChanged |
| Field Detail |
|---|
public static final int CUBE_INDEX
public static final int NOTATION_INDEX
public static final int SCRIPT_INDEX
public static final int TEXT_INDEX
public static final java.lang.String PROP_DEFAULT_CUBE
public static final java.lang.String PROP_DEFAULT_NOTATION
protected java.beans.PropertyChangeSupport propertySupport
| Constructor Detail |
|---|
public DocumentModel()
| Method Detail |
|---|
public void setDispatcher(SequentialDispatcher d)
public void dispatch(java.lang.Runnable runner)
Note that the worker thread executes the runnables sequentially.
Use this method to dispatch tasks which block the user interface until the task has finished. i.e. Loading and Saving a document from a file.
public void dispatchSolver(java.lang.Runnable runner)
Note that the worker thread executes the runnables concurrently.
Use this method to dispatch tasks which do not block the user interface until the task has finished. i.e. Solving a scrambled cube.
public EntityModel getScripts()
public EntityModel getTexts()
public EntityModel getNotations()
public EntityModel getCubes()
public CubeModel getDefaultCube()
public void setDefaultCube(CubeModel newValue)
public NotationModel getDefaultNotation(int layerCount)
public void setDefaultNotation(NotationModel value)
public void writeXML(java.io.OutputStream out,
java.lang.Object[] entities)
throws java.io.IOException
java.io.IOExceptionpublic boolean isWriteMember(EntityModel m)
public void writeXML(java.io.PrintWriter out)
throws java.io.IOException
java.io.IOException
public void addSerializedNode(java.io.InputStream in)
throws java.io.IOException
java.io.IOException
public void insertSerializedNodeInto(java.io.InputStream in,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
throws java.io.IOException
java.io.IOException
public void insertSerializedNodeInto(java.io.Reader r,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
throws java.io.IOException
java.io.IOException
public void addXMLNode(nanoxml.XMLElement doc)
throws java.io.IOException
java.io.IOException
public void insertXMLNodeInto(nanoxml.XMLElement doc,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
throws java.io.IOException
java.io.IOException
public void addTo(javax.swing.tree.DefaultMutableTreeNode newChild,
javax.swing.tree.TreeNode parent)
public void insertNodeInto(javax.swing.tree.MutableTreeNode newChild,
javax.swing.tree.MutableTreeNode parent,
int index)
insertNodeInto in class javax.swing.tree.DefaultTreeModel
protected void insertNodeIntoQuiet(javax.swing.tree.DefaultMutableTreeNode newChild,
javax.swing.tree.TreeNode parent,
int index)
protected void removeNodeFromParentQuiet(javax.swing.tree.DefaultMutableTreeNode node)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
MutableTreeModel
addPropertyChangeListener in interface MutableTreeModel
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
MutableTreeModel
removePropertyChangeListener in interface MutableTreeModel
public void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
public boolean isNodeRemovable(javax.swing.tree.DefaultMutableTreeNode node)
isNodeRemovable in interface MutableTreeModelnode - a node from the tree, obtained from this data source.public void removeNodeFromParent(javax.swing.tree.DefaultMutableTreeNode node)
removeNodeFromParent in interface MutableTreeModelnode - a node from the tree, obtained from this data source.
java.lang.IllegalStateException - if the node is not removable.
public javax.swing.tree.TreePath createNodeAt(java.lang.Object newNodeType,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
throws java.lang.IllegalStateException
createNodeAt in interface MutableTreeModelnewNodeType - the type of the new child to be created, obtained
from getCreatableChildrenparent - a node from the tree, obtained from this data source.index - index of the child.
java.lang.IllegalStateException - if the parent node does not allow children.public boolean isNodeEditable(javax.swing.tree.DefaultMutableTreeNode node)
isNodeEditable in interface MutableTreeModelnode - a node from the tree, obtained from this data source.public java.lang.Object[] getCreatableNodeTypes(java.lang.Object parent)
getCreatableNodeTypes in interface MutableTreeModelparent - a node from the tree, obtained from this data source.
public java.lang.Object getCreatableNodeType(java.lang.Object parent)
MutableTreeModel
getCreatableNodeType in interface MutableTreeModelparent - a node from the tree, obtained from this data source.
public boolean isNodeAddable(javax.swing.tree.DefaultMutableTreeNode parent,
int index)
isNodeAddable in interface MutableTreeModelparent - a node from the tree, obtained from this data source.index - the insertion index.public boolean isLeaf(java.lang.Object node)
isLeaf in interface javax.swing.tree.TreeModelisLeaf in class javax.swing.tree.DefaultTreeModelpublic void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
removeUndoableEditListener in interface MutableTreeModelremoveUndoableEditListener in interface Undoablepublic void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
addUndoableEditListener in interface MutableTreeModeladdUndoableEditListener in interface Undoablepublic void fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
fireUndoableEdit in interface MutableTreeModelpublic java.awt.datatransfer.Transferable exportTransferable(javax.swing.tree.DefaultMutableTreeNode[] nodes)
exportTransferable in interface MutableTreeModelnodes - The nodes to be copied.
java.lang.IllegalStateException - if the nodes can not be removed.
public java.util.List<javax.swing.tree.TreePath> importTransferable(java.awt.datatransfer.Transferable transfer,
int action,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
MutableTreeModel
importTransferable in interface MutableTreeModeltransfer - The transfer data.parent - a node from the tree, obtained from this data source.index - The insertion point.
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
public boolean isImportable(java.awt.datatransfer.DataFlavor[] flavors,
int action,
javax.swing.tree.DefaultMutableTreeNode parent,
int index)
MutableTreeModel
isImportable in interface MutableTreeModelflavors - the data formats availableaction - the action, this is either COPY, MOVE or LINK.parent - a node from the tree, obtained from this data source.index - The insertion point.
public boolean isCloseable()
public void close()
public javax.swing.Action[] getNodeActions(javax.swing.tree.DefaultMutableTreeNode[] nodes)
MutableTreeModel
getNodeActions in interface MutableTreeModelnodes - The nodes.public void dispose()
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||