KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > gui > graph > view > ComponentRenderer


1 /***
2  * FractalGUI: a graphical tool to edit Fractal component configurations.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: fractal@objectweb.org
20  *
21  * Authors: Eric Bruneton, Patrice Fauvel
22  */

23
24 package org.objectweb.fractal.gui.graph.view;
25
26 import org.objectweb.fractal.gui.model.Component;
27 import org.objectweb.fractal.gui.model.Interface;
28 import org.objectweb.fractal.gui.selection.model.Selection;
29
30 import java.awt.Graphics JavaDoc;
31 import java.awt.Point JavaDoc;
32 import java.awt.Rectangle JavaDoc;
33 import java.awt.Color JavaDoc;
34
35 /**
36  * A component that draws components. This component only draws single
37  * components, i.e. does not draw the sub components of a component, nor the
38  * internal or external bingings of components.
39  */

40
41 public interface ComponentRenderer {
42
43   /**
44    * The flags corresponding to a component whitout instances.
45    */

46
47   int NO_INSTANCE = 0;
48
49   /**
50    * The flags corresponding to a component whit instances no started
51    */

52
53   int INSTANCE = 1;
54
55   /**
56    * The flags corresponding to a component whit instances started
57    */

58
59   int STARTED = 2;
60
61   /**
62    * The flags corresponding to a component whit instances started then stopped
63    */

64
65   int STOPPED = 3;
66
67   /**
68    * Draws the given component in the given rectangle.
69    *
70    * @param g the graphics to be used to draw the component.
71    * @param c the component to be drawn.
72    * @param s the selected component.
73    * @param r where the component must be drawn.
74    * @param color the component color.
75    * @param expanded if the component is exanded or not, i.e., if its sub
76    * components will be drawn (with other calls to this method) also or
77    * not.
78    * @param m the displaying mode for interface name.
79    * @param state the status for component (either STARTED or STOPPED).
80    */

81
82   void drawComponent (
83     Graphics JavaDoc g,
84     Component c,
85     Selection s,
86     Rectangle JavaDoc r,
87     Color JavaDoc color,
88     boolean expanded,
89     int m,
90     int state);
91
92   /**
93    * Returns the part of the given component that corresponds to the given
94    * point.
95    *
96    * @param c a component.
97    * @param r where the component is drawn.
98    * @param expanded if the component is exanded or not, i.e., if its sub
99    * components will be drawn also or not.
100    * @param x the x coordinate of the point of interest.
101    * @param y the y coordinate of the point of interest.
102    * @return the part of the given component that corresponds to the given
103    * point, or <tt>null</tt> if the given point does not correspond to any
104    * part of the given component.
105    */

106
107   ComponentPart getComponentPart (
108     Component c,
109     Rectangle JavaDoc r,
110     boolean expanded,
111     int x,
112     int y);
113
114   /**
115    * Returns the position of the given interface.
116    *
117    * @param c a component.
118    * @param r where the component is drawn.
119    * @param i the interface whose position must be returned.
120    * @return the position of the given interface.
121    */

122
123   Point JavaDoc getInterfacePosition (Component c, Rectangle JavaDoc r, Interface i);
124
125   /**
126    * Returns the area of the given component into which its sub components must
127    * be drawn.
128    *
129    * @param c a component.
130    * @param r where the component is drawn.
131    * @return the area of the given component into which its sub components must
132    * be drawn.
133    */

134
135   Rectangle JavaDoc getSubComponentArea (Component c, Rectangle JavaDoc r);
136 }
137
Popular Tags