mauda.treeoperationview
Class TreeOperationView

java.lang.Object
  extended by mauda.treeoperationview.TreeOperationView
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.util.EventListener, ExerciseUpdateListener

public class TreeOperationView
extends java.lang.Object
implements ExerciseUpdateListener, java.awt.event.MouseListener, java.awt.event.ActionListener

Provides methods for displaying and manipulating a view of the operations as a tree.

Author:
Markus Krebs

Field Summary
static int DISPLAY_MODE
          Contains the actual display-mode
static int GENERATION_DISPLAY_MODE
          ID for displaying the operation-text with e.g. the word (template).
static int NORMAL_DISPLAY_MODE
          ID for displaying the operation-text without e.g. the word (template) that marks a operation as non-executed.
 
Constructor Summary
TreeOperationView(Exercise exercise)
          Creates a Tree-Operation-View
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 UndoRedoUnit cutTree()
          Removes all following (relativly to the actual tree-node) tree-nodes from the tree.
 void disableJumping()
          Disables jumping by the user
 void enableJumping()
          Enables jumping by the user
 void enableStop()
          Enables the stop-button, so that the replay of an exercise can stopped.
 void exerciseUpdate(ExerciseUpdateEvent e)
          Invoked when an Event occures
 int getActionIndex()
          Returns the index of the node, that context-menu was lastly activated.
 NodePopup getNodePopup()
          Gets the associated context-menu
 javax.swing.JPanel getPanel()
          Gets the drawing-panel of the tree
 javax.swing.JTree getTree()
          Gets the tree-component of the tree
 void load(java.util.Vector v)
          Loads the values of the current tree with the values of the delivered vector-representation
 void makeActual(javax.swing.tree.DefaultMutableTreeNode node)
          Makes a specific node as the actual-node
 void makeActualProcessing(javax.swing.tree.DefaultMutableTreeNode node)
          Makes a specific node as the actual-node that was in process
 void markActAsCorrect()
          Marks the actual node as correct
 void markActAsIncorrect()
          Marks the actual node as incorrect
 void markAsCorrect(int index)
          Marks a specific node as correct
 void markAsIncorrect(int index)
          Marks a specific node as incorrect
 void markCorrectness(boolean limited, boolean folderMark)
          Marks the correctness in the tree.
 void markTodoPosition()
          Marks init- and todo-operations in the tree.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void noFinishedLoadingMessage()
          Defines that the tree should immediatly recording operations, not until a FINISHED_LOADING-Message received.
 java.util.Vector save()
          Converts the important values into a vector-representation for saving-purposes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_DISPLAY_MODE

public static final int NORMAL_DISPLAY_MODE
ID for displaying the operation-text without e.g. the word (template) that marks a operation as non-executed.

See Also:
Constant Field Values

GENERATION_DISPLAY_MODE

public static final int GENERATION_DISPLAY_MODE
ID for displaying the operation-text with e.g. the word (template). This is needed in Generation-Editor

See Also:
Constant Field Values

DISPLAY_MODE

public static int DISPLAY_MODE
Contains the actual display-mode

Constructor Detail

TreeOperationView

public TreeOperationView(Exercise exercise)
Creates a Tree-Operation-View

Parameters:
exercise - Exercise
Method Detail

getPanel

public javax.swing.JPanel getPanel()
Gets the drawing-panel of the tree

Returns:
panel

getTree

public javax.swing.JTree getTree()
Gets the tree-component of the tree

Returns:
tree

enableJumping

public void enableJumping()
Enables jumping by the user


disableJumping

public void disableJumping()
Disables jumping by the user


noFinishedLoadingMessage

public void noFinishedLoadingMessage()
Defines that the tree should immediatly recording operations, not until a FINISHED_LOADING-Message received.


markTodoPosition

public void markTodoPosition()
Marks init- and todo-operations in the tree. Only used in Generation-Editor.


getNodePopup

public NodePopup getNodePopup()
Gets the associated context-menu

Returns:
context-menu-component

exerciseUpdate

public void exerciseUpdate(ExerciseUpdateEvent e)
Description copied from interface: ExerciseUpdateListener
Invoked when an Event occures

Specified by:
exerciseUpdate in interface ExerciseUpdateListener
Parameters:
e - The event

cutTree

public UndoRedoUnit cutTree()
Removes all following (relativly to the actual tree-node) tree-nodes from the tree.


makeActual

public void makeActual(javax.swing.tree.DefaultMutableTreeNode node)
Makes a specific node as the actual-node

Parameters:
node - TreeNode

makeActualProcessing

public void makeActualProcessing(javax.swing.tree.DefaultMutableTreeNode node)
Makes a specific node as the actual-node that was in process

Parameters:
node - TreeNode

markCorrectness

public void markCorrectness(boolean limited,
                            boolean folderMark)
Marks the correctness in the tree.

Parameters:
limited - true means: Marking only up to the current node, false means to mark all nodes
folderMark - true if the folders should marked (e.g. INSERT), false otherwise

markActAsCorrect

public void markActAsCorrect()
Marks the actual node as correct


markActAsIncorrect

public void markActAsIncorrect()
Marks the actual node as incorrect


markAsCorrect

public void markAsCorrect(int index)
Marks a specific node as correct

Parameters:
index - Index (counted by 0)

markAsIncorrect

public void markAsIncorrect(int index)
Marks a specific node as incorrect

Parameters:
index - Index (counted by 0)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

enableStop

public void enableStop()
Enables the stop-button, so that the replay of an exercise can stopped.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getActionIndex

public int getActionIndex()
Returns the index of the node, that context-menu was lastly activated. So it is possible, to get information on which node the context-menu-action was performed.

Returns:
Index

save

public java.util.Vector save()
Converts the important values into a vector-representation for saving-purposes.

Returns:
vector-representation

load

public void load(java.util.Vector v)
Loads the values of the current tree with the values of the delivered vector-representation

Parameters:
v - vector-representation