TMView

Kind of class:public class
Package:treemap
Inherits from:JPanel
Implements:
  • Observer
Version:2.5
Author:Christophe Bouthier [bouthier@loria.fr]
Package classpath:treemap.TMView
File last modified:Thursday, 13 February 2003, 20:32:50
The TMView class implements a view of the TreeMap.

Summary


Constructors
Class fields
Instance methods

Inner classes

EmptyPaintMethod

 (package private) (inner) class
The EmptyPaintMethod implements a empty paint method.

FullPaintMethod

 (package private) (inner) class
The FullPaintMethod implements a full paint method.

PaintMethod

 (package private) abstract (inner) class
The PaintMethod abstract class implements
a Strategie design pattern for the paintComponent method.

Constructors

TMView

(package private) TMView(

Constructor.
Parameters:
updater:
the updater of TMNodes of the TreeMap
cSize :
the object computing the size;
cDraw :
the object computing the drawing;

Class fields

CLASSIC

public static final String CLASSIC = "CLASSIC"

SQUARIFIED

public static final String SQUARIFIED = "SQUARIFIED"

Instance fields

action

private TMAction action = null

drawer

private TMAlgorithm drawer = null

initView

private JComponent initView = null

paintMethod

private PaintMethod paintMethod = null

root

private TMNodeModelRoot root = null

statusView

private TMStatusView statusView = null

store

private Hashtable store = null

Instance methods

addAlgorithm

public void addAlgorithm(
TMAlgorithm algorithm, String name)

Adds a treemap algorithm to this view.
The algorithm is a subclass of TMAlgorithm,
and is caracterized by a name.
It is this name that should be passed as parameter
to setAlgorithm().
If there were already an algorithm registered under
this name, the old algorithm is lost.
Parameters:
algorithm:
the algorithm
name :
the name of the algorithm

changeTMComputeDraw

public void changeTMComputeDraw(

Changes the TMComputeDraw object used to compute
the drawings of TMNodes.
Parameters:
cDraw:
the new TMComputeDraw

changeTMComputeSize

public void changeTMComputeSize(

Changes the TMComputeSize object used to compute
the sizings of TMNodes.
Parameters:
cSize:
the new TMComputeSize

DrawTitles

public void DrawTitles(
boolean bool)

Sets the drawing or not of the nodes titles.
Parameters:
bool:
the boolean deciding if yes or no we
draws the nodes titles

getAlgorithm

public TMAlgorithm getAlgorithm(
)

Returns the current algorithm of this view.
Returns:
  • the current algorithm

getAlgorithmsNames

public Enumeration getAlgorithmsNames(
)

Returns the set of registered names of algorithms.
Returns:
  • an Enumeration of registered names

getNodeUnderTheMouse

public Object getNodeUnderTheMouse(
MouseEvent event)

Returns the node containing the mouse event.

If using TMNode, this will be a TMNode.
Else, if using TMModelNode, this is an
Object.

Parameters:
event:
the mouse event on a node
Returns:
  • the node containing this event;
    could be null if no node was found

getStatusView

public JComponent getStatusView(
)

Gets the status view.
Returns:
  • the status view

getToolTipText

public String getToolTipText(
MouseEvent event)

Returns the tooltip to be displayed.
Parameters:
event:
the event triggering the tooltip
Returns:
  • the String to be displayed

Initialized

(package private) void Initialized(
)

Sets this view as initialized.

isDrawingTitle

public boolean isDrawingTitle(
)

paintComponent

public void paintComponent(
Graphics g)

Paint the component.
Parameters:
g:
the graphic context

setAlgorithm

public void setAlgorithm(
String algoName)

Sets the algorithm of the treemap.
The name given should be one of the TMView constant
or a name already registered with addAlgorithm().
Does nothing if the parameter is not a
reckognized string.
Parameters:
algoName:
the name of the algorithm

unzoom

public void unzoom(
)

Unzooms.
Does nothing if already at the root.

update

public void update(
Observable o, Object arg)

Called when a TMUpdater has its data changed.
Parameters:
o :
the Observable object that has its data changed
arg:
the Object describing the change

zoom

public void zoom(
int x, int y)

Zooms the treemap of one level in the direction of the node
at the given coordinates.
Parameters:
x:
the x coord
y:
the y coord