freemind.view.mindmapview
Class MapView

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byfreemind.view.mindmapview.MapView
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable

public class MapView
extends javax.swing.JPanel
implements java.awt.print.Printable

This class represents the view of a whole MindMap (in analogy to class JTree).

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MapView(MindMap model, Controller controller)
           
 
Method Summary
 void centerNode(NodeView node)
          Problem: Before scrollRectToVisible is called, the node has the location (0,0), ie.
protected  void collectLabels(NodeView source, java.util.HashMap labels)
          collect all existing labels in the current map.
 void deselect(NodeView newSelected)
           
 MindMapArrowLink detectCollision(java.awt.Point p)
           
 void endPrinting()
          Call preparePrinting() before printing and endPrinting() after printing to minimize calculation efforts
 Controller getController()
           
 java.awt.Rectangle getInnerBounds(NodeView source)
          Return the bounding box of all the descendants of the source view, that without BORDER.
 int getMaxNodeWidth()
           
 MindMap getModel()
           
 java.awt.Dimension getPreferredSize()
           
protected  NodeView getRoot()
           
 NodeView getSelected()
           
 java.util.ArrayList getSelectedNodesSortedByY()
           
 java.util.LinkedList getSelecteds()
           
 java.util.ArrayList getSelectedsSortedByY()
           
 int getSiblingMaxLevel()
           
 java.awt.Dimension getViewportSize()
          Returns the size of the visible part of the view in view coordinates.
 float getZoom()
           
 int getZoomed(int number)
           
 int getZoomedFoldingSymbolHalfWidth()
           
 void initRoot()
           
 boolean isCurrentlyPrinting()
          For nodes, they can ask, whether or not the width must be bigger to prevent the "..." at the output.
 boolean isSelected(NodeView n)
           
 void makeTheSelected(NodeView newSelected)
          Add the node to the selection if it is not yet there, making it the focused selected node.
 void move(java.awt.event.KeyEvent e)
           
 void moveToRoot()
           
 void paintChildren(java.awt.Graphics graphics)
          P A I N T I N G **
protected  void paintClouds(NodeView source, java.awt.Graphics graphics)
           
protected  void paintLinks(NodeView source, java.awt.Graphics2D graphics, java.util.HashMap labels, java.util.HashSet LinkAlreadyVisited)
           
 void preparePrinting()
          Call preparePrinting() before printing and endPrinting() after printing to minimize calculation efforts
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
           
 void scrollBy(int x, int y, boolean repaint)
          Scroll the viewport of the map to the south-west, i.e.
 void scrollNodeToVisible(NodeView node)
           
 void scrollNodeToVisible(NodeView node, int extraWidth)
           
 void selectAsTheOnlyOneSelected(NodeView newSelected)
          Select the node, resulting in only that one being selected.
 void selectBranch(NodeView newlySelectedNodeView, boolean extend)
          Select the node and his descendants.
 boolean selectContinuous(NodeView newSelected)
           
 void setMoveCursor(boolean isHand)
           
 void setSiblingMaxLevel(int level)
           
 void setZoom(float zoom)
           
 void toggleSelected(NodeView newSelected)
          Add the node to the selection if it is not yet there, remove it otherwise.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapView

public MapView(MindMap model,
               Controller controller)
Method Detail

initRoot

public void initRoot()

getMaxNodeWidth

public int getMaxNodeWidth()

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.


scrollNodeToVisible

public void scrollNodeToVisible(NodeView node)

scrollNodeToVisible

public void scrollNodeToVisible(NodeView node,
                                int extraWidth)

getViewportSize

public java.awt.Dimension getViewportSize()
Returns the size of the visible part of the view in view coordinates.


scrollBy

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


move

public void move(java.awt.event.KeyEvent e)

moveToRoot

public void moveToRoot()

selectAsTheOnlyOneSelected

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


toggleSelected

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


makeTheSelected

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


deselect

public void deselect(NodeView newSelected)

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)

getModel

public MindMap getModel()

setMoveCursor

public void setMoveCursor(boolean isHand)

getSelected

public NodeView getSelected()

getSelecteds

public java.util.LinkedList getSelecteds()

getSelectedsSortedByY

public java.util.ArrayList getSelectedsSortedByY()

getSelectedNodesSortedByY

public java.util.ArrayList getSelectedNodesSortedByY()
Returns:
an ArrayList of MindMapNode objects.

isSelected

public boolean isSelected(NodeView n)

getZoom

public float getZoom()

getZoomed

public int getZoomed(int number)

setZoom

public void setZoom(float zoom)

paintChildren

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


paintClouds

protected void paintClouds(NodeView source,
                           java.awt.Graphics graphics)

collectLabels

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


paintLinks

protected void paintLinks(NodeView source,
                          java.awt.Graphics2D graphics,
                          java.util.HashMap labels,
                          java.util.HashSet LinkAlreadyVisited)

detectCollision

public MindMapArrowLink detectCollision(java.awt.Point p)

preparePrinting

public void preparePrinting()
Call preparePrinting() before printing and endPrinting() after printing to minimize calculation efforts


endPrinting

public void endPrinting()
Call preparePrinting() before printing and endPrinting() after printing to minimize calculation efforts


print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
Specified by:
print in interface java.awt.print.Printable

isCurrentlyPrinting

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


getPreferredSize

public java.awt.Dimension getPreferredSize()

getInnerBounds

public java.awt.Rectangle getInnerBounds(NodeView source)
Return the bounding box of all the descendants of the source view, that without BORDER. Should that be implemented in LayoutManager as minimum size?


getRoot

protected NodeView getRoot()

getController

public Controller getController()

getSiblingMaxLevel

public int getSiblingMaxLevel()

setSiblingMaxLevel

public void setSiblingMaxLevel(int level)

getZoomedFoldingSymbolHalfWidth

public int getZoomedFoldingSymbolHalfWidth()