001 /*--------------------------------------------------------------------------+ 002 $Id: ITreeMapNode.java 28095 2010-06-09 13:10:26Z hummelb $ 003 | | 004 | Copyright 2005-2010 Technische Universitaet Muenchen | 005 | | 006 | Licensed under the Apache License, Version 2.0 (the "License"); | 007 | you may not use this file except in compliance with the License. | 008 | You may obtain a copy of the License at | 009 | | 010 | http://www.apache.org/licenses/LICENSE-2.0 | 011 | | 012 | Unless required by applicable law or agreed to in writing, software | 013 | distributed under the License is distributed on an "AS IS" BASIS, | 014 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 015 | See the License for the specific language governing permissions and | 016 | limitations under the License. | 017 +--------------------------------------------------------------------------*/ 018 package edu.tum.cs.commons.treemap; 019 020 import java.awt.Color; 021 import java.awt.geom.Rectangle2D; 022 import java.util.List; 023 024 /** 025 * Interface for nodes used for building the tree map node hierarchy which is 026 * then rendered as a tree map. 027 * 028 * @author Benjamin Hummel 029 * @author $Author: hummelb $ 030 * @version $Rev: 28095 $ 031 * @levd.rating GREEN Hash: 6A2576C914919BB550F99037D71626EA 032 * 033 * @param <T> 034 * the type the user data has. 035 */ 036 public interface ITreeMapNode<T> { 037 038 /** Returns the text of the tree map node */ 039 public String getText(); 040 041 /** 042 * Returns the list of children of this node. This usually is a readonly 043 * list. 044 */ 045 public List<ITreeMapNode<T>> getChildren(); 046 047 /** Returns the area of this node including all subnodes. */ 048 public double getArea(); 049 050 /** Returns the base color used for drawing this node. */ 051 public Color getColor(); 052 053 /** Returns the color used for drawing the pattern (if any) of this node. */ 054 public Color getPatternColor(); 055 056 /** 057 * Returns the pattern used for drawing the node (may be <code>null</code> 058 * to use no pattern). 059 */ 060 public IDrawingPattern getDrawingPattern(); 061 062 /** Returns some user defined data which can be useful for some callbacks. */ 063 public T getUserDatum(); 064 065 /** 066 * Returns the rectangle this node was layouted into. If the tree was not 067 * yet layouted, this may be null, otherwise it should be the value set by 068 * {@link #setLayoutRectangle(Rectangle2D)}. 069 */ 070 public Rectangle2D getLayoutRectangle(); 071 072 /** Sets the rectangle this node should be layouted into. */ 073 public void setLayoutRectangle(Rectangle2D rect); 074 075 /** Get displayable name of the node. */ 076 public String getTooltipId(); 077 078 /** Returns keys for structured displayable data. */ 079 public List<String> getTooltipKeys(); 080 081 /** Returns the value to be displayed for a single key. */ 082 public Object getTooltipValue(String key); 083 084 }