TreeMap Java Library

treemap.demo
Class TMFileDraw

java.lang.Object
  extended by treemap.demo.TMFileDraw
All Implemented Interfaces:
TMComputeDraw
Direct Known Subclasses:
TMFileDrawPattern

public class TMFileDraw
extends java.lang.Object
implements TMComputeDraw

The TMFileDraw class implements an example of a TMComputeDraw for a TMFileNode. It use the date of last modification as color, and the name of the file as tooltip.

The color legend is :

Version:
2.5
Author:
Christophe Bouthier [bouthier@loria.fr]

Constructor Summary
TMFileDraw()
           
 
Method Summary
 java.awt.Paint getFilling(TMNodeAdapter nodeAdapter)
          Returns the filling of the node.
 java.lang.String getTitle(TMNodeAdapter nodeAdapter)
          Returns the title of the node.
 java.awt.Paint getTitleColor(TMNodeAdapter nodeAdapter)
          Returns the color of the title of the node.
 java.lang.String getTooltip(TMNodeAdapter nodeAdapter)
          Returns the tooltip of the node.
 boolean isCompatibleWith(TMNode node)
          Test if this TMComputeDraw could be used with the kind of TMNode passed in parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TMFileDraw

public TMFileDraw()
Method Detail

isCompatibleWith

public boolean isCompatibleWith(TMNode node)
Test if this TMComputeDraw could be used with the kind of TMNode passed in parameter.

Specified by:
isCompatibleWith in interface TMComputeDraw
Parameters:
node - the TMNode to test the compatibility with
Returns:
true if this kind of node is compatible; false otherwise

getFilling

public java.awt.Paint getFilling(TMNodeAdapter nodeAdapter)
                          throws TMExceptionBadTMNodeKind
Returns the filling of the node. The nodeAdapter should return an instance of TMFileNode.

Specified by:
getFilling in interface TMComputeDraw
Parameters:
nodeAdapter - we compute the filling of this node; should return an instance of TMFileNode
Returns:
the filling of the node
Throws:
TMExceptionBadTMNodeKind - If the node does not return an instance of TMFileNode

getTooltip

public java.lang.String getTooltip(TMNodeAdapter nodeAdapter)
                            throws TMExceptionBadTMNodeKind
Returns the tooltip of the node. The nodeAdapter should return an instance of TMFileNode.

Specified by:
getTooltip in interface TMComputeDraw
Parameters:
nodeAdapter - we compute the tooltip of this node; should return an instance of TMFileNode
Returns:
the tooltip of the node
Throws:
TMExceptionBadTMNodeKind - If the node does not return an instance of TMFileNode

getTitleColor

public java.awt.Paint getTitleColor(TMNodeAdapter nodeAdapter)
                             throws TMExceptionBadTMNodeKind
Returns the color of the title of the node.

Specified by:
getTitleColor in interface TMComputeDraw
Parameters:
nodeAdapter - the node for which we want the title
Returns:
the title of the node
Throws:
TMExceptionBadTMNodeKind - if the kind of TMNode returned is incompatible with this TMComputeDraw.

getTitle

public java.lang.String getTitle(TMNodeAdapter nodeAdapter)
                          throws TMExceptionBadTMNodeKind
Returns the title of the node.

Specified by:
getTitle in interface TMComputeDraw
Parameters:
nodeAdapter - the node for which we want the title
Returns:
the title of the node
Throws:
TMExceptionBadTMNodeKind - if the kind of TMNode returned is incompatible with this TMComputeDraw.

TreeMap Java Library

TreeMap Java Library - www.bouthier.net - treemap.sf.net - 2001