org.problets.lib.conceptmap.view.userbuilt
Class UserBuiltForestView

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.problets.lib.conceptmap.view.ForestView
                      extended by org.problets.lib.conceptmap.view.userbuilt.UserBuiltForestView
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class UserBuiltForestView
extends ForestView

Derived from ForestView. Adds to the functionality of a forest view to handle a user-built forest view.

Author:
Adrian Maries
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class org.problets.lib.conceptmap.view.ForestView
DEFAULT_NUMBER_OF_COLUMNS, DEFAULT_NUMBER_OF_ROWS
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
UserBuiltForestView(java.awt.event.ActionListener inRoot, ForestModel inActualForestModel, UserBuiltForestModel studentForestModel, StudentActionLog inForestStudent)
          Creates a UserBuiltForestView object using an inorrect forest model (which the user is supposed to change) and the correct tree (used for feedback) as arguments.
 
Method Summary
 javax.swing.JPopupMenu createPopupMenu(java.util.Vector menuItemNames)
          Creates the popup menu to be displayed when the user clicks on a link.
 void handleActionPerformed(int xCoord, int yCoord)
          Handles the actionPerformed event.
 boolean handleMouseDragged(int xCoord, int yCoord)
          Handles the mouseDragged event.
 MousePressedInfo handleMousePressed(java.awt.event.MouseEvent e)
          Handles the mousePressed event.
 boolean handleMouseReleased(int xCoord, int yCoord)
          Handles the mouseReleased event.
static void main(java.lang.String[] args)
           
 void paintComponent(java.awt.Graphics g)
          Performs the painting of the user-built forest view.
 void removeTree(TreeView treeView)
          Removes the tree passed as argument from the vectors of tree views and tree models.
 
Methods inherited from class org.problets.lib.conceptmap.view.ForestView
getMaxDepth, getNumberOfColumns, getNumberOfRows, getNumTreeViews, handleMouseClicked, handleMouseMoved, setCoord
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserBuiltForestView

public UserBuiltForestView(java.awt.event.ActionListener inRoot,
                           ForestModel inActualForestModel,
                           UserBuiltForestModel studentForestModel,
                           StudentActionLog inForestStudent)
Creates a UserBuiltForestView object using an inorrect forest model (which the user is supposed to change) and the correct tree (used for feedback) as arguments.

Parameters:
forestModel - the forest model this forest view represents (the one to be changed by the user)
inActualForestModel - the correct forest model (used for feedback)
Method Detail

createPopupMenu

public javax.swing.JPopupMenu createPopupMenu(java.util.Vector menuItemNames)
Creates the popup menu to be displayed when the user clicks on a link.

Parameters:
menuItemsVector - the vector with the names of the items in the popup menu
Returns:
the popup menu just created

paintComponent

public void paintComponent(java.awt.Graphics g)
Performs the painting of the user-built forest view.

Overrides:
paintComponent in class ForestView
Parameters:
g - the graphics context

handleMousePressed

public MousePressedInfo handleMousePressed(java.awt.event.MouseEvent e)
Handles the mousePressed event.

Overrides:
handleMousePressed in class ForestView
Parameters:
e - the mousePressed event
Returns:
a MousePressedInfo object

handleMouseReleased

public boolean handleMouseReleased(int xCoord,
                                   int yCoord)
Handles the mouseReleased event.

Overrides:
handleMouseReleased in class ForestView
Parameters:
xCoord - the x-coordinate of the mouse event
yCoord - the y-coordinate of the mouse event
Returns:
true if the mouse has been released on the forest, false otherwise

handleMouseDragged

public boolean handleMouseDragged(int xCoord,
                                  int yCoord)
Handles the mouseDragged event.

Overrides:
handleMouseDragged in class ForestView
Parameters:
xCoord - the x-coordinate of the mouse event
yCoord - the y-coordinate of the mouse event
Returns:
true if the mouse has been pressed on the forest and dragged, false otherwise

handleActionPerformed

public void handleActionPerformed(int xCoord,
                                  int yCoord)
Handles the actionPerformed event.

Parameters:
xCoord - the x-coordinate of the last mousePressed event
yCoord - the y-coordinate of the last mousePressed event

removeTree

public void removeTree(TreeView treeView)
Removes the tree passed as argument from the vectors of tree views and tree models. Needed when connecting two trees, the tree that is dragged has to be removed.

Parameters:
treeView - the tree view to be removed

main

public static void main(java.lang.String[] args)