KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nightlabs > editor2d > MultiLayerDrawComponent


1 /* *****************************************************************************
2  * NightLabs Editor2D - Graphical editor framework *
3  * Copyright (C) 2004-2005 NightLabs - http://NightLabs.org *
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.1 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 *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin St, Fifth Floor, *
19  * Boston, MA 02110-1301 USA *
20  * *
21  * Or get it online : *
22  * http://www.gnu.org/copyleft/lesser.html *
23  * *
24  * *
25  ******************************************************************************/

26
27 package org.nightlabs.editor2d;
28
29 import java.util.List JavaDoc;
30 import java.util.Map JavaDoc;
31
32 public interface MultiLayerDrawComponent
33 extends DrawComponentContainer
34 {
35   public static final String JavaDoc PROP_CURRENT_LAYER = "currentLayer";
36   public static final String JavaDoc TYPE_ADDED = "New type added!";
37   
38   /**
39    * return the current selected layer to which all new drawComponents will be
40    * added
41    * @return the current selected Layer
42    * @see Layer
43    */

44   Layer getCurrentLayer();
45   
46   /**
47    *
48    * @param value the Layer which should be set as current
49    * @see Layer
50    */

51   void setCurrentLayer(Layer value);
52
53   /**
54    *
55    * @return true if the grid in the editor is enabled
56    */

57   boolean isGridEnabled();
58   
59   /**
60    *
61    * @param value determines if the grid in the editor is enabled or not
62    */

63   void setGridEnabled(boolean value);
64   
65   /**
66    *
67    * @return if the rulers in the editor is enabled
68    */

69   boolean isRulersEnabled();
70   
71   /**
72    *
73    * @param value determines if the rulers in the editor are enabled or not
74    */

75   void setRulersEnabled(boolean value);
76
77   /**
78    *
79    * @return if the SnapToGeometry in the editor is enabled
80    */

81   boolean isSnapToGeometry();
82   
83   /**
84    *
85    * @param value determines if the SnapToGeometry in the editor is enabled or not
86    */

87   void setSnapToGeometry(boolean value);
88
89   /**
90    *
91    * @return the zoomFactor given as double (100% = 1.0d)
92    */

93   double getZoom();
94   
95   /**
96    *
97    * @param value the zoomFactor to set (100% = 1.0d)
98    */

99   void setZoom(double value);
100
101   /**
102    *
103    * @return the left EditorRuler
104    * @see EditorRuler
105    */

106   EditorRuler getLeftRuler();
107   
108   /**
109    *
110    * @param value the left EditorRuler to set
111    */

112   void setLeftRuler(EditorRuler value);
113
114   /**
115    *
116    * @return the top EditorRuler
117    * @see EditorRuler
118    */

119   EditorRuler getTopRuler();
120   
121   /**
122    *
123    * @param value the top EditorRuler to set
124    * @see EditorRuler
125    */

126   void setTopRuler(EditorRuler value);
127
128   /**
129    *
130    * @return the last ID which has been assigned to the last drawComponent
131    * which was added/registered
132    */

133   long getLastID();
134   
135   /**
136    * !WARNING
137    * this Method should never be called,
138    * except for deserialization purposes, otherwise this can lead to
139    * an inconsistant Data-Model
140    *
141    * @param value sets the lastID
142    */

143     void setLastID(long value);
144
145     /**
146      * generates an continous (unique) ID for drawComponents which are added/registered
147      *
148      * @return the next unique ID
149      */

150   long nextID();
151   
152   /**
153    *
154    * @param id the ID of the DrawComponent
155    * @return the drawComponent with the given ID
156    */

157   DrawComponent getDrawComponent(long id);
158
159   /**
160    * registers a DrawComponent in the MultiLayerDrawComponent
161    * This Method assignes the new id, adds the DrawComponent to the
162    * id2DrawComponent-Map as well as in the class2DrawComponents-Map
163    *
164    * This Method must be called from a DrawComponentContainer when
165    * a child is added
166    *
167    * @param drawComponent the drawComponent to register
168    */

169   void registerDrawComponent(DrawComponent drawComponent);
170   
171   /**
172    * unregisters a DrawComponent from the MultiLayerDrawComponent
173    * It removes the DrawComponent from the id2DrawComponent-Map as well
174    * as from the class2DrawComponents-Map.
175    *
176    * @param drawComponent the DrawComponent to unregister
177    */

178   void unregisterDrawComponent(DrawComponent drawComponent);
179   
180   /**
181    * unregisters a DrawComponent from the MultiLayerDrawComponent
182    * It removes the DrawComponent from the id2DrawComponent-Map as well
183    * as from the class2DrawComponents-Map.
184    *
185    * @param id the id of the DrawComponent to unregister
186    */

187   void unregisterDrawComponent(long id);
188
189   /**
190    * This Method returns a List containing all DrawComponents for the given
191    * Class (Type)
192    *
193    * @param type the Class of the DrawComponents
194    * @return a List containing all DrawComponents of the given Class
195    */

196   List JavaDoc getDrawComponents(Class JavaDoc type);
197   
198   /**
199    * @return a Map with the following key and value
200    * key: Class (type) e.g. LineDrawComponentImpl.class
201    * value: a List of DrawComponents of the given class
202    */

203   Map JavaDoc getClass2DrawComponents();
204   
205   /**
206    * !WARNING
207    * This Method should only be called for deserializing purposes,
208    * otherwise this can lead to an inconsitent Data-Model
209    *
210    * @param value the class2DrawComponents-Map to set
211    * @see getClass2DrawComponents()
212    */

213     void setClass2DrawComponents(Map JavaDoc value);
214     
215     /**
216      * @return a Map with the following key and value
217      * key: the ID (Long) of a DrawComponent
218      * value: the DrawComponent with the given ID
219      */

220   Map JavaDoc getId2DrawComponent();
221   
222   /**
223    * !WARNING
224    * This Method should only be called for deserializing purposes,
225    * otherwise this can lead to an inconsitent Data-Model
226    *
227    * @param value the id2DrawComponents-Map to set
228    * @see getId2DrawComponents()
229    */

230     void setId2DrawComponent(Map JavaDoc value);
231
232 } // MultiLayerDrawComponent
233
Popular Tags