KickJava   Java API By Example, From Geeks To Geeks.

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


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
29 import java.awt.Rectangle JavaDoc;
30
31 /**
32  * A component part.
33  */

34
35 public class ComponentPart {
36
37   /**
38    * Header part of a component representation.
39    */

40
41   public final static int HEADER = 0;
42
43   /**
44    * Top left corner of a component representation.
45    */

46
47   public final static int TOP_LEFT_CORNER = 1;
48
49   /**
50    * Top right corner of a component representation.
51    */

52
53   public final static int TOP_RIGHT_CORNER = 2;
54
55   /**
56    * Bottom left corner of a component representation.
57    */

58
59   public final static int BOTTOM_LEFT_CORNER = 3;
60
61   /**
62    * Bottom right corner of a component representation.
63    */

64
65   public final static int BOTTOM_RIGHT_CORNER = 4;
66
67   /**
68    * Left border of a component representation.
69    */

70
71   public final static int LEFT_BORDER = 5;
72
73   /**
74    * Top border of a component representation.
75    */

76
77   public final static int TOP_BORDER = 6;
78
79   /**
80    * Right border of a component representation.
81    */

82
83   public final static int RIGHT_BORDER = 7;
84
85   /**
86    * Bottom border of a component representation.
87    */

88
89   public final static int BOTTOM_BORDER = 8;
90
91   /**
92    * Content part of a component representation.
93    */

94
95   public final static int CONTENT = 9;
96
97   /**
98    * Interface part of a component representation.
99    */

100
101   public final static int INTERFACE = 9;
102
103   /**
104    * The component designated by this component part.
105    */

106
107   private final Component component;
108
109   /**
110    * The component interface designated by this component part.
111    * May be <tt>null</tt>.
112    */

113
114   private final Interface itf;
115
116   /**
117    * The type of this component part. This type must be one of the constants
118    * defined in this class.
119    */

120
121   private final int part;
122
123   /**
124    * The position of the component designated by this component part.
125    */

126
127   private final Rectangle JavaDoc position;
128
129   /**
130    * Constructs a new {@link ComponentPart} object.
131    *
132    * @param component the component designated by this component part.
133    * @param itf the interface of this component designated by this component
134    * part. May be <tt>null</tt>.
135    * @param part the type of this component part.
136    * @param position the position of the component designated by this component
137    * part.
138    */

139
140   public ComponentPart (
141     final Component component,
142     final Interface itf,
143     final int part,
144     final Rectangle JavaDoc position)
145   {
146     this.component = component;
147     this.itf = itf;
148     this.part = part;
149     this.position = position;
150   }
151
152   /**
153    * Returns the component designated by this component part.
154    *
155    * @return the component designated by this component part.
156    */

157
158   public Component getComponent () {
159     return component;
160   }
161
162   /**
163    * Returns the precise interface designated by this component part.
164    *
165    * @return the precise interface designated by this component part, or
166    * <tt>null</tt> if this component part does not designate an interface,
167    * i.e., if {@link #getPart getPart} is not equal to {@link #INTERFACE}.
168    */

169
170   public Interface getInterface () {
171     return itf;
172   }
173
174   /**
175    * Returns the type of this component part.
176    *
177    * @return the type of this component part, as one the constants defined in
178    * this class.
179    */

180
181   public int getPart () {
182     return part;
183   }
184
185   /**
186    * Returns the position of the component designated by this component part.
187    *
188    * @return the position of the component designated by this component part.
189    */

190
191   public Rectangle JavaDoc getPosition () {
192     return position;
193   }
194 }
195
Popular Tags