01: /*
02: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/scenegrapheditor/treeview/TVLeaf.java,v 1.1 2005/04/20 22:21:28 paulby Exp $
03: *
04: * Sun Public License Notice
05: *
06: * The contents of this file are subject to the Sun Public License Version
07: * 1.0 (the "License"). You may not use this file except in compliance with
08: * the License. A copy of the License is available at http://www.sun.com/
09: *
10: * The Original Code is the Java 3D(tm) Scene Graph Editor.
11: * The Initial Developer of the Original Code is Paul Byrne.
12: * Portions created by Paul Byrne are Copyright (C) 2002.
13: * All Rights Reserved.
14: *
15: * Contributor(s): Paul Byrne.
16: *
17: **/
18: package org.jdesktop.j3dedit.scenegrapheditor.treeview;
19:
20: import java.awt.Graphics2D;
21: import java.awt.Graphics;
22: import java.awt.Polygon;
23: import java.awt.Point;
24: import java.awt.Dimension;
25: import org.jdesktop.j3dedit.scenegraph.SGObject;
26:
27: public class TVLeaf extends TVObject {
28:
29: /** Creates new leafTreeNode */
30: public TVLeaf(SGObject sgObject) {
31: super (29, 29, 29, sgObject);
32: }
33:
34: public Point getBehaviorLinkEntry(Point behaviorLocation) {
35: return new Point(computedPosition.x + nodeSize.width / 2,
36: computedPosition.y + nodeSize.height / 2);
37: }
38:
39: public void drawNode(Graphics2D g) {
40: super .drawNode(g);
41: Point computedPosition = getComputedPosition();
42: if (icon != null && drawAsIcon) {
43: g.drawImage(icon, computedPosition.x, computedPosition.y,
44: null);
45: } else {
46: Dimension nodeSize = getNodeSize();
47: g.setColor(java.awt.Color.white);
48: g.fillRect(computedPosition.x, computedPosition.y,
49: nodeSize.width, nodeSize.height);
50: g.setColor(java.awt.Color.black);
51: g.drawRect(computedPosition.x, computedPosition.y,
52: nodeSize.width, nodeSize.height);
53: }
54: drawNameLabel(g);
55: }
56: }
|