Java 2 Platform
v1.3

edu.umich.visualsoar.operatorwindow
Class FileNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--edu.umich.visualsoar.operatorwindow.TreeNode
              |
              +--edu.umich.visualsoar.operatorwindow.OperatorNode
                    |
                    +--edu.umich.visualsoar.operatorwindow.FileNode
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode
Direct Known Subclasses:
LinkNode, SoarOperatorNode

public class FileNode
extends OperatorNode
implements java.io.Serializable

This is the file node for the operator window

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.tree.DefaultMutableTreeNode
 
Field Summary
protected  java.lang.String fileAssociation
          a string that is the path to the file which is associated with this file
protected  java.lang.String fullTransferFileName
           
protected  edu.umich.visualsoar.ruleeditor.RuleEditor ruleEditor
          a reference to the rule editor, null if there isn't one
protected  javax.swing.tree.TreePath transferTreePath
           
 
Fields inherited from class edu.umich.visualsoar.operatorwindow.OperatorNode
addFileItem, addSuboperatorItem, checkChildrenAgainstDataMapItem, conflictImpasseItem, constraintImpasseItem, contextMenu, deleteItem, exportItem, id, impasseSubMenu, importItem, name, openDataMapItem, openRulesItem, renameItem, stateNoChangeImpasseItem, tieImpasseItem
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
FileNode(java.lang.String inName, int inId, java.lang.String inFile)
           
 
Method Summary
 void addFile(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, java.lang.String newFileName)
          This is the function that gets called when you want to add a file to this node
 void clearRuleEditor()
          This resets the rule editor to null for this node
 void copyStructures(java.io.File folderToWriteTo)
           
 void delete(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow)
          Removes the selected file from the tree if it is allowed
 void exportDataMap(java.io.Writer w)
           
 void exportDesc(java.io.Writer w)
          Given a Writer this writes out a description of the operator node that can be read back later
 void exportFile(java.io.Writer w, int id)
          Given a Writer this writes out the rules as it is either in the file or the rule editor
 void exportType(java.io.Writer w)
           
 java.lang.String getFileName()
          Use this getter function to get the path to the rule file
protected  java.lang.String getFullPathName()
           
 javax.swing.tree.TreePath getTransferTreePath()
           
 void moveAssociations()
           
 boolean needsToSourceChildren()
           
 void notifyChildrenOfRename(java.lang.String oldFilePath, java.lang.String newFilePath)
          An ancestor has been renamed so we must update our file association
 void openRules(edu.umich.visualsoar.MainFrame pw)
          This opens/shows a rule editor with this nodes associated file
 void openRules(edu.umich.visualsoar.MainFrame pw, int line)
          This opens/shows a rule editor with this nodes associated file and places the caret on the given line number
 java.util.Vector parseProductions()
          This will parse the productions for a given file node if a rule editor is open for the file it just forwards the call to the open rule editor, else it opens the file and attempts to parse the productions
 void rename(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow, java.lang.String newName)
          The user wants to rename this node
protected  void renameFile(java.lang.String newFileName)
          This is a helper function that renames the file for which this node is associated to it's new file name, and also notifies the rule editor if there is one of the change
 void setRuleEditor(edu.umich.visualsoar.ruleeditor.RuleEditor re)
           
 void setTransferFullPath()
           
 void showContextMenu(java.awt.Component c, int x, int y)
          This adjusts the context menu so that only the valid commands are displayed
 void source(java.io.Writer w)
           
 void sourceChildren()
           
 void sourceRecursive()
           
 void write(java.io.Writer w)
          Given a Writer this writes out a description of the operator node that can be read back in later
 
Methods inherited from class edu.umich.visualsoar.operatorwindow.OperatorNode
addFileOperator, addImpasseOperator, addLink, addSuboperator, checkChildrenAgainstDataMap, export, getFolderName, getId, getStateIdVertex, getUniqueName, importFunc, isDragOk, isDropOk, move, notifyDeletionOfChild, notifyRenameOfAncestor, okayToCreate, okayToCreate, okayToCreateReplace, openDataMap, recursiveDelete, renameToDeleted, toString
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileAssociation

protected java.lang.String fileAssociation
a string that is the path to the file which is associated with this file


ruleEditor

protected edu.umich.visualsoar.ruleeditor.RuleEditor ruleEditor
a reference to the rule editor, null if there isn't one


fullTransferFileName

protected java.lang.String fullTransferFileName

transferTreePath

protected javax.swing.tree.TreePath transferTreePath
Constructor Detail

FileNode

public FileNode(java.lang.String inName,
                int inId,
                java.lang.String inFile)
Method Detail

getFileName

public java.lang.String getFileName()
Use this getter function to get the path to the rule file

Overrides:
getFileName in class OperatorNode
Returns:
the path to the datamap

addFile

public void addFile(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                    java.lang.String newFileName)
             throws java.io.IOException
This is the function that gets called when you want to add a file to this node

Overrides:
addFile in class OperatorNode
Parameters:
newFileName - the name of the new operator to add
java.io.IOException

setTransferFullPath

public void setTransferFullPath()

getTransferTreePath

public javax.swing.tree.TreePath getTransferTreePath()

moveAssociations

public void moveAssociations()

renameFile

protected void renameFile(java.lang.String newFileName)
This is a helper function that renames the file for which this node is associated to it's new file name, and also notifies the rule editor if there is one of the change

Parameters:
newFileName - a String that represents the new file path

clearRuleEditor

public void clearRuleEditor()
This resets the rule editor to null for this node

Overrides:
clearRuleEditor in class OperatorNode

setRuleEditor

public void setRuleEditor(edu.umich.visualsoar.ruleeditor.RuleEditor re)

notifyChildrenOfRename

public void notifyChildrenOfRename(java.lang.String oldFilePath,
                                   java.lang.String newFilePath)
An ancestor has been renamed so we must update our file association

Parameters:
oldFilePath - the ancestor's old File path
newFilePath - the ancestor's new File path

rename

public void rename(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow,
                   java.lang.String newName)
            throws java.io.IOException
The user wants to rename this node

Overrides:
rename in class OperatorNode
Parameters:
newName - the new name that the user wants this node to be called
java.io.IOException

write

public void write(java.io.Writer w)
           throws java.io.IOException
Given a Writer this writes out a description of the operator node that can be read back in later

Specified by:
write in class TreeNode
Parameters:
w - the writer
Throws:
java.io.IOException - if there is an error writing to the writer

exportDesc

public void exportDesc(java.io.Writer w)
                throws java.io.IOException
Given a Writer this writes out a description of the operator node that can be read back later

Specified by:
exportDesc in class OperatorNode
Parameters:
w - where the description should be written to
Throws:
java.io.IOException - if there is an error writing to the writer

exportType

public void exportType(java.io.Writer w)
                throws java.io.IOException
Specified by:
exportType in class OperatorNode
java.io.IOException

exportFile

public void exportFile(java.io.Writer w,
                       int id)
                throws java.io.IOException
Given a Writer this writes out the rules as it is either in the file or the rule editor

Specified by:
exportFile in class OperatorNode
Parameters:
w - where the file should be written to
Throws:
java.io.IOException - if there is an error writing to the writer

showContextMenu

public void showContextMenu(java.awt.Component c,
                            int x,
                            int y)
This adjusts the context menu so that only the valid commands are displayed

Specified by:
showContextMenu in class OperatorNode
Parameters:
c - the owner of the context menu, should be the OperatorWindow
x - the horizontal position on the screen where the context menu should be displayed
y - the vertical position on the screen where the context menu should be displayed

delete

public void delete(edu.umich.visualsoar.operatorwindow.OperatorWindow operatorWindow)
Removes the selected file from the tree if it is allowed

Overrides:
delete in class OperatorNode

parseProductions

public java.util.Vector parseProductions()
                                  throws ParseException,
                                         java.io.IOException
This will parse the productions for a given file node if a rule editor is open for the file it just forwards the call to the open rule editor, else it opens the file and attempts to parse the productions

Overrides:
parseProductions in class OperatorNode
ParseException
java.io.IOException

openRules

public void openRules(edu.umich.visualsoar.MainFrame pw)
This opens/shows a rule editor with this nodes associated file

Overrides:
openRules in class OperatorNode
Parameters:
pw - the MainFrame

openRules

public void openRules(edu.umich.visualsoar.MainFrame pw,
                      int line)
This opens/shows a rule editor with this nodes associated file and places the caret on the given line number

Overrides:
openRules in class OperatorNode
Parameters:
pw - the Project window
line - the line number to place the caret on

getFullPathName

protected java.lang.String getFullPathName()
Specified by:
getFullPathName in class OperatorNode

exportDataMap

public void exportDataMap(java.io.Writer w)
                   throws java.io.IOException
Specified by:
exportDataMap in class OperatorNode
java.io.IOException

copyStructures

public void copyStructures(java.io.File folderToWriteTo)
                    throws java.io.IOException
Specified by:
copyStructures in class OperatorNode
java.io.IOException

source

public void source(java.io.Writer w)
            throws java.io.IOException
Specified by:
source in class OperatorNode
java.io.IOException

needsToSourceChildren

public boolean needsToSourceChildren()

sourceChildren

public void sourceChildren()
                    throws java.io.IOException
Specified by:
sourceChildren in class OperatorNode
java.io.IOException

sourceRecursive

public void sourceRecursive()
                     throws java.io.IOException
Specified by:
sourceRecursive in class OperatorNode
java.io.IOException

Java 2 Platform
v1.3