package render;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;

import prefuse.util.ColorLib;
import prefuse.visual.VisualItem;

/**
 * 
 * 
 * <p>
 * Added:          / TL<br>
 * Modifications: 
 * </p>
 * 
 * @author Tim Lammarsch
 *
 */
public class CascadedLabelRenderer implements prefuse.render.Renderer {
	public void render(Graphics2D g, VisualItem item) {
		g.setColor(Color.BLACK);
		g.drawString(item.getString("label"),(int)item.getX(),(int)item.getY());
	}

	/**
	 * Checks whether a point is inside the bounds of the item.
	 * @see prefuse.render.Renderer#locatePoint(java.awt.geom.Point2D, prefuse.visual.VisualItem)
	 */
	public boolean locatePoint(Point2D p, VisualItem item) {
        return item.getBounds().contains(p);
	}

	/**
	 * Sets the bounds of the item to the bounds of the rectangle.
	 * @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
	 */
	public void setBounds(VisualItem item) {
		item.setBounds(item.getStartX(), item.getStartY(), item.getEndX()-item.getStartX()+1, item.getEndY()-item.getStartY()+1);
	}
}

@@ -442,16 +442,85 @@
 LACK);%0D%0A
+%09%09System.out.println(%22render %22 + item.getString(VisualItem.LABEL));%0D%0A
 %09%09g.draw
@@ -545,15 +545,24 @@
 ing(
-%22label%22
+VisualItem.LABEL
 ),(i
@@ -1074,16 +1074,27 @@
 tem) %7B%0D%0A
+%09%09// TODO%0D%0A
 %09%09item.s
@@ -1110,24 +1110,22 @@
 item.get
-Start
 X()
+-10
 , item.g
@@ -1130,76 +1130,93 @@
 .get
-StartY(), item.getEndX()-item.getStartX()+1, item.getEndY()-
+Y()-10, 20, 20);%0D%0A        System.out.println(%22bounds %22 + item.getX() + %22 %22 + 
 item.get
 Star
@@ -1215,18 +1215,11 @@
 .get
-Start
 Y()
-+1
 );%0D%0A

use label constant; bounds from X / Y