freemind.view.mindmapview

Class MapView

public class MapView extends JPanel implements Printable

This class represents the view of a whole MindMap (in analogy to class JTree).
Nested Class Summary
protected classMapView.nodesDepthComparator
This class sortes nodes by ascending depth of their paths to root.
Constructor Summary
MapView(MindMap model, Controller controller)
Method Summary
voidcenterNode(NodeView node)
Problem: Before scrollRectToVisible is called, the node has the location (0,0), ie. the location first gets calculated after the scrollpane is actually scrolled.
protected voidcollectLabels(NodeView source, HashMap labels)
collect all existing labels in the current map.
voiddeselect(NodeView newSelected)
MindMapArrowLinkdetectCollision(Point p)
ControllergetController()
intgetMaxNodeWidth()
MindMapgetModel()
DimensiongetPreferredSize()
protected NodeViewgetRoot()
NodeViewgetSelected()
ArrayListgetSelectedNodesSortedByY()
LinkedListgetSelecteds()
LinkedListgetSelectedsByDepth()
ArrayListgetSelectedsSortedByY()
intgetSiblingMaxLevel()
floatgetZoom()
intgetZoomed(int number)
voidinitRoot()
booleanisPrinting()
For nodes, they can ask, whether or not the width must be bigger to prevent the "..." at the output.
booleanisSelected(NodeView n)
voidmakeTheSelected(NodeView newSelected)
Add the node to the selection if it is not yet there, making it the focused selected node.
voidmove(KeyEvent e)
voidmoveToRoot()
voidpaintChildren(Graphics graphics)
P A I N T I N G **
protected voidpaintClouds(NodeView source, Graphics graphics, int iterativeLevel)
protected voidpaintLinks(NodeView source, Graphics2D graphics, HashMap labels, HashSet LinkAlreadyVisited)
intprint(Graphics graphics, PageFormat pageFormat, int pageIndex)
voidscrollBy(int x, int y)
Scroll the viewport of the map to the south-west, i.e. scroll the map itself to the north-east.
voidscrollNodeToVisible(NodeView node)
voidscrollNodeToVisible(NodeView node, int extraWidth)
voidselectAsTheOnlyOneSelected(NodeView newSelected)
Select the node, resulting in only that one being selected.
voidselectBranch(NodeView newlySelectedNodeView, boolean extend)
Select the node and his descendants.
booleanselectContinuous(NodeView newSelected)
voidsetMoveCursor(boolean isHand)
voidsetSiblingMaxLevel(int level)
voidsetZoom(float zoom)
voidtoggleSelected(NodeView newSelected)
Add the node to the selection if it is not yet there, remove it otherwise.

Constructor Detail

MapView

public MapView(MindMap model, Controller controller)

Method Detail

centerNode

public void centerNode(NodeView node)
Problem: Before scrollRectToVisible is called, the node has the location (0,0), ie. the location first gets calculated after the scrollpane is actually scrolled. Thus, as a workaround, I simply call scrollRectToVisible twice, the first time the location of the node is calculated, the second time the scrollPane is actually scrolled.

collectLabels

protected void collectLabels(NodeView source, HashMap labels)
collect all existing labels in the current map.

deselect

public void deselect(NodeView newSelected)

detectCollision

public MindMapArrowLink detectCollision(Point p)

getController

public Controller getController()

getMaxNodeWidth

public int getMaxNodeWidth()

getModel

public MindMap getModel()

getPreferredSize

public Dimension getPreferredSize()

getRoot

protected NodeView getRoot()

getSelected

public NodeView getSelected()

getSelectedNodesSortedByY

public ArrayList getSelectedNodesSortedByY()

getSelecteds

public LinkedList getSelecteds()

getSelectedsByDepth

public LinkedList getSelectedsByDepth()

Returns: a LinkedList of NodeViews ordered by depth. nodes with greater depth occur first.

getSelectedsSortedByY

public ArrayList getSelectedsSortedByY()

getSiblingMaxLevel

public int getSiblingMaxLevel()

getZoom

public float getZoom()

getZoomed

public int getZoomed(int number)

initRoot

public void initRoot()

isPrinting

public boolean isPrinting()
For nodes, they can ask, whether or not the width must be bigger to prevent the "..." at the output. (Bug of java).

isSelected

public boolean isSelected(NodeView n)

makeTheSelected

public void makeTheSelected(NodeView newSelected)
Add the node to the selection if it is not yet there, making it the focused selected node.

move

public void move(KeyEvent e)

moveToRoot

public void moveToRoot()

paintChildren

public void paintChildren(Graphics graphics)
P A I N T I N G **

paintClouds

protected void paintClouds(NodeView source, Graphics graphics, int iterativeLevel)

Parameters: iterativeLevel describes the n-th nested cloud that is to be painted.

paintLinks

protected void paintLinks(NodeView source, Graphics2D graphics, HashMap labels, HashSet LinkAlreadyVisited)

print

public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)

scrollBy

public void scrollBy(int x, int y)
Scroll the viewport of the map to the south-west, i.e. scroll the map itself to the north-east.

scrollNodeToVisible

public void scrollNodeToVisible(NodeView node)

scrollNodeToVisible

public void scrollNodeToVisible(NodeView node, int extraWidth)

selectAsTheOnlyOneSelected

public void selectAsTheOnlyOneSelected(NodeView newSelected)
Select the node, resulting in only that one being selected.

selectBranch

public void selectBranch(NodeView newlySelectedNodeView, boolean extend)
Select the node and his descendants. On extend = false clear up the previous selection. if extend is false, the past selection will be empty. if yes, the selection will extended with this node and its children

selectContinuous

public boolean selectContinuous(NodeView newSelected)

setMoveCursor

public void setMoveCursor(boolean isHand)

setSiblingMaxLevel

public void setSiblingMaxLevel(int level)

setZoom

public void setZoom(float zoom)

toggleSelected

public void toggleSelected(NodeView newSelected)
Add the node to the selection if it is not yet there, remove it otherwise.