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

java.lang.Object
  extended by org.problets.lib.conceptmap.view.NodeView
      extended by org.problets.lib.conceptmap.view.userbuilt.UserBuiltNodeView
Direct Known Subclasses:
TempUserBuiltNodeView

public class UserBuiltNodeView
extends NodeView

Derived from NodeView. Adds to the functionality of a node view in order to handle a user-built node view.

Author:
Adrian Maries

Field Summary
 
Fields inherited from class org.problets.lib.conceptmap.view.NodeView
NO_NODE_PRESSED, NO_NODE_RELEASED, NON_ROOT_PRESSED, NON_ROOT_RELEASED, ROOT_PRESSED, ROOT_RELEASED
 
Constructor Summary
UserBuiltNodeView(UserBuiltNodeView parent, UserBuiltNodeModel nodeModel)
          Creates a UserBuiltNodeView object using the parent node view and the corresponding model as arguments.
 
Method Summary
 boolean addChildIfOverlap(int xCoord, int yCoord, UserBuiltNodeView newChild)
          Adss the node passed as argument to the current node's vector of child node views if the two nodes overlap.
 void addChildLink(UserBuiltLinkView childLink)
          Adds a child link view to this node's vector of child links.
 UserBuiltNodeView getOverlappedNode(int xCoord, int yCoord, UserBuiltNodeView nodeView)
          Returns the node that is overlapped by the node passed as argument.
 UserBuiltNodeView handleActionPerformed(int xCoord, int yCoord)
          Handles the actionPerformed event.
 NodeView isOnChildLinks(int x, int y)
          Checks if any mouse event (given by the coordinates passed as arguments) occurred inside any of this node view's child links.
static void main(java.lang.String[] args)
           
 
Methods inherited from class org.problets.lib.conceptmap.view.NodeView
draw, findNode, getChildLink, getChildNode, getCurrentXEnd, getCurrentXStart, getCurrentYEnd, getCurrentYStart, getIndex, getIsExpanded, getIsHighlighted, getIsVisible, getMaxHeightOfDescendants, getMaxWidthOfDescendants, getMouseoverVisible, getMouseoverVisibleNode, getNodeModel, getNumChildren, getParent, handleMouseClicked, handleMouseDragged, handleMouseMoved, handleMousePressed, handleMouseReleased, isOnNode, layout, paintMouseover, setCoord, setExpandedUpToDepth, setIsHighlighted, setIsHighlightedAncestorPath, setIsLastPressed, setIsVisible, setLinksVisible, setMouseoverVisible, setParent, setTextFont
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserBuiltNodeView

public UserBuiltNodeView(UserBuiltNodeView parent,
                         UserBuiltNodeModel nodeModel)
Creates a UserBuiltNodeView object using the parent node view and the corresponding model as arguments.

Parameters:
parent - this node view's parent
nodeModel - the model representing this node view
Method Detail

handleActionPerformed

public UserBuiltNodeView 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
Returns:
the node view the removed link used to connect to this node

getOverlappedNode

public UserBuiltNodeView getOverlappedNode(int xCoord,
                                           int yCoord,
                                           UserBuiltNodeView nodeView)
Returns the node that is overlapped by the node passed as argument.

Parameters:
xCoord - the x-coordinate of the mouse event
yCoord - the y-coordinate of the mouse event
nodeView - the node that may overlap this node
Returns:
the node that is overlapped by the node passed as argument

isOnChildLinks

public NodeView isOnChildLinks(int x,
                               int y)
Checks if any mouse event (given by the coordinates passed as arguments) occurred inside any of this node view's child links.

Overrides:
isOnChildLinks in class NodeView
Parameters:
x - the x-coordinate of the mouse event
y - the y-coordinate of the mouse event
Returns:
the target node view of the pressed link

addChildLink

public void addChildLink(UserBuiltLinkView childLink)
Adds a child link view to this node's vector of child links.

Parameters:
childLink - the link view to be added to this node's vector of child links

addChildIfOverlap

public boolean addChildIfOverlap(int xCoord,
                                 int yCoord,
                                 UserBuiltNodeView newChild)
Adss the node passed as argument to the current node's vector of child node views if the two nodes overlap.

Parameters:
xCoord - the x-coordinate of the mouse event
yCoord - the y-coordinate of the mouse event
newChild - the node to compare with the current node
Returns:
true if the two nodes overlap

main

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