|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.lib.conceptmap.view.NodeView
public class NodeView
The NodeView class performs the painting for each node. Each node instantiates a view for painting its node. The locations for the painting are set by the model while layoutModel() is being called. At the end of each paint operation, the current actual coordinates used for the drawing are saved. If a button press/release occurs, that location will be compared to these values to determine if this NodeView was selected.
Field Summary | |
---|---|
static int |
NO_NODE_PRESSED
|
static int |
NO_NODE_RELEASED
|
static int |
NON_ROOT_PRESSED
|
static int |
NON_ROOT_RELEASED
|
static int |
ROOT_PRESSED
|
static int |
ROOT_RELEASED
|
Constructor Summary | |
---|---|
NodeView(NodeView inParent,
NodeModel inNodeModel)
Creates a NodeView object using the parent node view and the node model as arguments. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g)
This method is called by the tree view to request a painting of a regular node view. |
NodeView |
findNode(java.util.Vector fullName)
Attempts to find a node view given the full path. |
LinkView |
getChildLink(int index)
Returns the link view at the specified position in the vector of child links. |
NodeView |
getChildNode(int index)
Returns the node view at the specified position in the vector of child nodes. |
int |
getCurrentXEnd()
Returns this node's current ending x-coordinate. |
int |
getCurrentXStart()
Returns this node's current starting x-coordinate. |
int |
getCurrentYEnd()
Returns this node's current ending y-coordinate. |
int |
getCurrentYStart()
Returns this node's current starting y-coordinate. |
int |
getIndex(java.lang.String name)
Returns the index of the child node whose name is passed as argument. |
boolean |
getIsExpanded()
Indicates if this node's children are expanded. |
boolean |
getIsHighlighted()
Indicates if this node is highlighted. |
boolean |
getIsVisible()
Indicates if this node is visible. |
int |
getMaxHeightOfDescendants()
Recursively determine the maximum height of this node's descendants. |
int |
getMaxWidthOfDescendants()
Recursively determine the maximum width of this node view's descendants. |
boolean |
getMouseoverVisible()
Returns the status of the flag responsible for this node's visibility. |
NodeView |
getMouseoverVisibleNode()
Returns the node view whose mouseover is visible. |
NodeModel |
getNodeModel()
Returns the node model which this view represents. |
int |
getNumChildren()
Returns the number of children this node view has. |
NodeView |
getParent()
Returns this node's parent. |
MouseClickedInfo |
handleMouseClicked(int xCoord,
int yCoord)
Handles the mouseClicked event. |
boolean |
handleMouseDragged(int xCoord,
int yCoord)
Handles the mouseDragged event. |
boolean |
handleMouseMoved(int xCoord,
int yCoord)
Handles the mouseMoved event. |
MousePressedInfo |
handleMousePressed(java.awt.event.MouseEvent e)
Handles the mousePressed event. |
int |
handleMouseReleased(int xCoord,
int yCoord)
Handles the mouseReleased event. |
NodeView |
isOnChildLinks(int x,
int y)
Method overridden by UserBuiltNodeView in order to check if any mouse event (given by the coordinates passed as arguments) occurred inside any of this node view's child links. |
boolean |
isOnNode(int x,
int y)
Checks if any mouse event (given by the coordinates passed as arguments) occurred inside this node view. |
int |
layout(int upperLeftCornerColumn,
int upperLeftCornerRow,
int depth,
int height)
Lays out this node and all its children. |
static void |
main(java.lang.String[] args)
|
void |
paintMouseover(java.awt.Graphics g)
This method is called by the node to request a painting of the mouseover for this node. |
void |
setCoord(int width,
int height,
int horizSpacing,
int verticalSpacing)
Sets the coordinates of the node view. |
void |
setExpandedUpToDepth(int depth)
Sets the tree expanded up to the specified depth. |
void |
setIsHighlighted(boolean inIsHighlighted)
Sets this node as either highlighted or normal. |
void |
setIsHighlightedAncestorPath(boolean inIsHighlighted)
Sets this node and all of its ancestors as either highlighted or normal. |
void |
setIsLastPressed(boolean inIsLastPressed)
Sets this node's isLastPressed flag. |
void |
setIsVisible(boolean inIsVisible)
Sets the flag for this node's visibility. |
void |
setLinksVisible(boolean isVisible)
Sets the isVisible flag for this node's child link views. |
void |
setMouseoverVisible(boolean inMouseoverVisible)
Sets the flag for this node's mouseover visiblity. |
void |
setParent(NodeView inParent)
Sets this node's parent. |
void |
setTextFont(java.awt.Font inFont)
Sets the font used when displaying the name of the node. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NO_NODE_PRESSED
public static final int NON_ROOT_PRESSED
public static final int ROOT_PRESSED
public static final int NO_NODE_RELEASED
public static final int NON_ROOT_RELEASED
public static final int ROOT_RELEASED
Constructor Detail |
---|
public NodeView(NodeView inParent, NodeModel inNodeModel)
inParent
- the parent node viewinNodeModel
- the node model for which this view was createdMethod Detail |
---|
public NodeView getMouseoverVisibleNode()
public void draw(java.awt.Graphics g)
g
- the graphics contextpublic void paintMouseover(java.awt.Graphics g)
g
- the graphics contextpublic MouseClickedInfo handleMouseClicked(int xCoord, int yCoord)
xCoord
- the x-coordinate of the mouse eventyCoord
- the y-coordinate of the mouse event
public boolean handleMouseMoved(int xCoord, int yCoord)
xCoord
- the x-coordinate of the mouse eventyCoord
- the y-coordinate of the mouse event
public MousePressedInfo handleMousePressed(java.awt.event.MouseEvent e)
e
- the mousePressed event
public int handleMouseReleased(int xCoord, int yCoord)
xCoord
- the x-coordinate of the mouse eventyCoord
- the y-coordinate of the mouse event
public boolean handleMouseDragged(int xCoord, int yCoord)
xCoord
- the x-coordinate of the mouse eventyCoord
- the y-coordinate of the mouse event
public NodeModel getNodeModel()
public NodeView getParent()
public int getCurrentXStart()
public int getCurrentYStart()
public int getCurrentXEnd()
public int getCurrentYEnd()
public boolean isOnNode(int x, int y)
x
- the x-coordinate of the mouse eventy
- the y-coordinate of the mouse event
public NodeView isOnChildLinks(int x, int y)
x
- the x-coordinate of the mouse eventy
- the y-coordinate of the mouse event
public boolean getIsHighlighted()
public boolean getIsVisible()
public boolean getIsExpanded()
public boolean getMouseoverVisible()
public int getNumChildren()
public NodeView getChildNode(int index)
index
- an index into the vector of child nodes
public LinkView getChildLink(int index)
index
- an index into the vector of child links
public int getIndex(java.lang.String name)
name
- the name of the child node whose index is returned
public NodeView findNode(java.util.Vector fullName)
fullName
- the vector containing the full path to the sought node
public int getMaxHeightOfDescendants()
public int getMaxWidthOfDescendants()
public void setTextFont(java.awt.Font inFont)
the
- font used when displaying the name of the nodepublic void setParent(NodeView inParent)
inParent
- this node's parentpublic void setIsLastPressed(boolean inIsLastPressed)
inIsLastPressed
- true if this node view was the last one pressedpublic void setCoord(int width, int height, int horizSpacing, int verticalSpacing)
width
- the width of one node viewheight
- the height of one node viewhorizSpacing
- the width of one cell in the gridverticalSpacing
- the height of one cell in the gridpublic void setIsVisible(boolean inIsVisible)
inIsVisible
- true if this node is visible, false otherwisepublic void setMouseoverVisible(boolean inMouseoverVisible)
inMouseoverVisible
- true if this node's mouseover is
visible, false otherwisepublic void setExpandedUpToDepth(int depth)
depth
- the depth up to which the tree is expandedpublic void setLinksVisible(boolean isVisible)
isVisible
- true if all this node's child link views are visible,
false otherwisepublic void setIsHighlighted(boolean inIsHighlighted)
inIsHighlighted
- true if this node is highlighted, false otherwisepublic void setIsHighlightedAncestorPath(boolean inIsHighlighted)
inIsHighlighted
- true if this node's ancestors are highlighted,
false otherwisepublic int layout(int upperLeftCornerColumn, int upperLeftCornerRow, int depth, int height)
upperLeftXCoord
- the x-coordinate of the upper left corner of the treeupperLeftYCoord
- the y-coordinate of the upper left corner of the treedepth
- this node's depthheight
- the height of this node's children
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |