org.activemath.author.toc
Class EditableTOCJTree

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.activemath.author.toc.EditableTOCJTree
All Implemented Interfaces:
MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, TreeModelListener, TreeSelectionListener

public class EditableTOCJTree
extends JPanel
implements TreeModelListener, TreeSelectionListener, MouseListener

A JTree object that contains a tree view of concepts that is read from a mBase server. Any user's sessions may be displayed.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EditableTOCJTree(AMSessionInfo session, TOC parentTOC)
          create a new EditableTOCJTree the new EditableTOCJTree will load the session sessionName of user userName from server serverName Preferred language: not implemented yet...
EditableTOCJTree(String fileName, TOC parentTOC)
          Missing description of constructor for the EditableTOCJTree object
EditableTOCJTree(TOC parentTOC)
          creates an empty EditableTOCJtree
 
Method Summary
 DefaultMutableTreeNode buildSavedDoc(org.jdom.Element startOmgroup)
          recursively builds a tree froma file saved with TOC.
 boolean catalogueInsert(String ID, DefaultMutableTreeNode destinationNode, boolean isRef)
          returns true if insertion succeeds, false if there's trouble
 boolean catalogueInsert(String ID, DefaultMutableTreeNode destinationNode, boolean isRef, int index)
           
 void drawBottomLine(TreePath path)
          draw intermediate line above the node
 void drawRect(TreePath path)
          draw the outline of a node
 void drawTopLine(TreePath path)
          draw intermediate line above the node
 DefaultMutableTreeNode getDeepClone(DefaultMutableTreeNode startNode)
          Missing description of the gets the deepClone attribute of the EditableTOCJTree object
 org.jdom.Element getDocument(DefaultMutableTreeNode startNode)
          returns this tree as a root element, starting document-building at startNode .
 DefaultMutableTreeNode getDraggedNode()
          Missing description of the gets the draggedNode attribute of the EditableTOCJTree object
 JTree getJTree()
          returns this EditableTOCJTree's JTree element
 MBaseRef getMBase()
          Returns this EditableTOCJTree's registered MBaseRef
 DefaultMutableTreeNode getRoot()
          returns this EditableTOCJTree's root node
 DefaultMutableTreeNode getSelectedNode()
          returns the currently selected node, or null if no node is selected.
 void insertCatalogueSubTree(DefaultMutableTreeNode newChild, DefaultMutableTreeNode destinationNode)
           
 void insertCatalogueSubTree(DefaultMutableTreeNode newChild, DefaultMutableTreeNode destinationNode, int index)
          inserts a given subtree into this tree, (used for pasting)
 void insertCatalogueSubTrees(Vector newChilds, DefaultMutableTreeNode destinationNode, int index)
          inserts several given subtrees into destinationNode
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void print(DefaultMutableTreeNode aNode)
          prints out a string representation of this EditableTOCJtree
 void removeNode(DefaultMutableTreeNode removeIt)
          deletes a node from the treemodel of this EditableTOCJTree.
 DefaultMutableTreeNode returnSecondChild(DefaultMutableTreeNode returnNode)
           
 void saveToSession()
           
 void setDraggedNode(DefaultMutableTreeNode dN)
          Missing description Sets the draggedNode attribute of the EditableTOCJTree object some kind of drawback from the single selection constraint at the beginning, will not be used
 void setRootLabel(String newLabel)
          Sets the label i.e. the user object of root to a new String
 void treeNodesChanged(TreeModelEvent e)
          a method that is part of the TreeModelListener interface called when the user changes the TreeModel.
 void treeNodesInserted(TreeModelEvent e)
          a method that is part of the TreeModelListener interface called when the user changes the TreeModel.
 void treeNodesRemoved(TreeModelEvent e)
          a method that is part of the TreeModelListener interface called when the user changes the TreeModel.
 void treeStructureChanged(TreeModelEvent e)
          a method that is part of the TreeModelListener interface called when the user changes the TreeModel.
 void valueChanged(TreeSelectionEvent e)
          Missing description of the Method
 void writeOmgroupFile(File outFile)
          creates an omgroup-style omdoc from this EditableTOCJtree's nodes.
 void writeOmgroupFile(String name)
          creates an omgroup-style omdoc from this EditableTOCJtree's nodes.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EditableTOCJTree

public EditableTOCJTree(AMSessionInfo session,
                        TOC parentTOC)
create a new EditableTOCJTree the new EditableTOCJTree will load the session sessionName of user userName from server serverName Preferred language: not implemented yet...

Parameters:
session - Missing description of Parameter
parentTOC - Missing description of Parameter

EditableTOCJTree

public EditableTOCJTree(String fileName,
                        TOC parentTOC)
Missing description of constructor for the EditableTOCJTree object

Parameters:
fileName - Missing description of Parameter
parentTOC - Missing description of Parameter

EditableTOCJTree

public EditableTOCJTree(TOC parentTOC)
creates an empty EditableTOCJtree

Parameters:
parentTOC - Missing description of Parameter
Method Detail

setRootLabel

public void setRootLabel(String newLabel)
Sets the label i.e. the user object of root to a new String

Parameters:
newLabel - Missing description The new rootLabel value

setDraggedNode

public void setDraggedNode(DefaultMutableTreeNode dN)
Missing description Sets the draggedNode attribute of the EditableTOCJTree object some kind of drawback from the single selection constraint at the beginning, will not be used

Parameters:
dN - Missing description The new draggedNode value

getDocument

public org.jdom.Element getDocument(DefaultMutableTreeNode startNode)
returns this tree as a root element, starting document-building at startNode .

Parameters:
startNode - Missing description of Parameter
Returns:
Missing description of return The document value

getDeepClone

public DefaultMutableTreeNode getDeepClone(DefaultMutableTreeNode startNode)
Missing description of the gets the deepClone attribute of the EditableTOCJTree object

Parameters:
startNode - Missing description of Parameter
Returns:
Missing description of return The deepClone value

getMBase

public MBaseRef getMBase()
Returns this EditableTOCJTree's registered MBaseRef

Returns:
Missing description of return The mBase value

getRoot

public DefaultMutableTreeNode getRoot()
returns this EditableTOCJTree's root node

Returns:
Missing description of return The root value

getJTree

public JTree getJTree()
returns this EditableTOCJTree's JTree element

Returns:
Missing description of return The jTree value

getDraggedNode

public DefaultMutableTreeNode getDraggedNode()
Missing description of the gets the draggedNode attribute of the EditableTOCJTree object

Returns:
Missing description of return The draggedNode value

getSelectedNode

public DefaultMutableTreeNode getSelectedNode()
returns the currently selected node, or null if no node is selected.

Returns:
Missing description of return The selectedNode value

valueChanged

public void valueChanged(TreeSelectionEvent e)
Missing description of the Method

Specified by:
valueChanged in interface TreeSelectionListener
Parameters:
e - Missing description of Parameter

treeNodesChanged

public void treeNodesChanged(TreeModelEvent e)
a method that is part of the TreeModelListener interface called when the user changes the TreeModel. This is possible if setEditable() is set to true.

Specified by:
treeNodesChanged in interface TreeModelListener
Parameters:
e - Missing description of Parameter

treeNodesInserted

public void treeNodesInserted(TreeModelEvent e)
a method that is part of the TreeModelListener interface called when the user changes the TreeModel. This is possible if setEditable() is set to true.

Specified by:
treeNodesInserted in interface TreeModelListener
Parameters:
e - Missing description of Parameter

treeNodesRemoved

public void treeNodesRemoved(TreeModelEvent e)
a method that is part of the TreeModelListener interface called when the user changes the TreeModel. This is possible if setEditable() is set to true.

Specified by:
treeNodesRemoved in interface TreeModelListener
Parameters:
e - Missing description of Parameter

treeStructureChanged

public void treeStructureChanged(TreeModelEvent e)
a method that is part of the TreeModelListener interface called when the user changes the TreeModel. This is possible if setEditable() is set to true.

Specified by:
treeStructureChanged in interface TreeModelListener
Parameters:
e - Missing description of Parameter

catalogueInsert

public boolean catalogueInsert(String ID,
                               DefaultMutableTreeNode destinationNode,
                               boolean isRef)
returns true if insertion succeeds, false if there's trouble

Parameters:
ID - Missing description of Parameter
destinationNode - Missing description of Parameter
isRef - Missing description of Parameter
Returns:
Missing description of the Returned Value

catalogueInsert

public boolean catalogueInsert(String ID,
                               DefaultMutableTreeNode destinationNode,
                               boolean isRef,
                               int index)

insertCatalogueSubTree

public void insertCatalogueSubTree(DefaultMutableTreeNode newChild,
                                   DefaultMutableTreeNode destinationNode,
                                   int index)
inserts a given subtree into this tree, (used for pasting)

Parameters:
newChild - Missing description of Parameter
destinationNode - Missing description of Parameter

insertCatalogueSubTrees

public void insertCatalogueSubTrees(Vector newChilds,
                                    DefaultMutableTreeNode destinationNode,
                                    int index)
inserts several given subtrees into destinationNode

Parameters:
newChild - Missing description of Parameter
destinationNode - Missing description of Parameter

insertCatalogueSubTree

public void insertCatalogueSubTree(DefaultMutableTreeNode newChild,
                                   DefaultMutableTreeNode destinationNode)

removeNode

public void removeNode(DefaultMutableTreeNode removeIt)
deletes a node from the treemodel of this EditableTOCJTree.

Parameters:
removeIt - Missing description of Parameter

buildSavedDoc

public DefaultMutableTreeNode buildSavedDoc(org.jdom.Element startOmgroup)
recursively builds a tree froma file saved with TOC. There is a difference in format of saved groupings and imported sessions.

Parameters:
startOmgroup - an omgroup element from which recursion will be started. This element will become the root node of the resulting tree.
Returns:
a DefaultMutableTreeNode that is the root node of a tree whose nodes contain OJgroup and OJref elements.

writeOmgroupFile

public void writeOmgroupFile(File outFile)
                      throws IOException
creates an omgroup-style omdoc from this EditableTOCJtree's nodes.

Parameters:
outFile - Missing description of Parameter
Throws:
IOException - Missing description of Exception

writeOmgroupFile

public void writeOmgroupFile(String name)
                      throws IOException
creates an omgroup-style omdoc from this EditableTOCJtree's nodes.

Parameters:
name - Missing description of Parameter
Throws:
IOException - Missing description of Exception

saveToSession

public void saveToSession()

print

public void print(DefaultMutableTreeNode aNode)
prints out a string representation of this EditableTOCJtree

Parameters:
aNode - Missing description of Parameter

drawRect

public void drawRect(TreePath path)
draw the outline of a node


drawTopLine

public void drawTopLine(TreePath path)
draw intermediate line above the node


drawBottomLine

public void drawBottomLine(TreePath path)
draw intermediate line above the node


mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

returnSecondChild

public DefaultMutableTreeNode returnSecondChild(DefaultMutableTreeNode returnNode)