root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / layout / LayoutManager.java @ 33659
History | View | Annotate | Download (25.1 KB)
1 |
package org.gvsig.app.project.documents.layout; |
---|---|
2 |
|
3 |
import java.awt.geom.AffineTransform; |
4 |
import java.util.Iterator; |
5 |
|
6 |
import javax.swing.ImageIcon; |
7 |
|
8 |
import org.slf4j.Logger; |
9 |
import org.slf4j.LoggerFactory; |
10 |
|
11 |
import org.gvsig.andami.PluginServices; |
12 |
import org.gvsig.andami.messages.NotificationManager; |
13 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
14 |
import org.gvsig.app.extension.AddLayer; |
15 |
import org.gvsig.app.project.ProjectManager; |
16 |
import org.gvsig.app.project.documents.AbstractDocument; |
17 |
import org.gvsig.app.project.documents.AbstractDocumentManager; |
18 |
import org.gvsig.app.project.documents.Document; |
19 |
import org.gvsig.app.project.documents.gui.WindowLayout; |
20 |
import org.gvsig.app.project.documents.layout.fframes.FFrame; |
21 |
import org.gvsig.app.project.documents.layout.fframes.FFrameBasicFactory; |
22 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGraphics; |
23 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGraphicsFactory; |
24 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGridFactory; |
25 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGroup; |
26 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGroupFactory; |
27 |
import org.gvsig.app.project.documents.layout.fframes.FFrameLegend; |
28 |
import org.gvsig.app.project.documents.layout.fframes.FFrameLegendFactory; |
29 |
import org.gvsig.app.project.documents.layout.fframes.FFrameNorth; |
30 |
import org.gvsig.app.project.documents.layout.fframes.FFrameNorthFactory; |
31 |
import org.gvsig.app.project.documents.layout.fframes.FFrameOverView; |
32 |
import org.gvsig.app.project.documents.layout.fframes.FFrameOverViewFactory; |
33 |
import org.gvsig.app.project.documents.layout.fframes.FFramePicture; |
34 |
import org.gvsig.app.project.documents.layout.fframes.FFramePictureFactory; |
35 |
import org.gvsig.app.project.documents.layout.fframes.FFrameScaleBar; |
36 |
import org.gvsig.app.project.documents.layout.fframes.FFrameScaleBarFactory; |
37 |
import org.gvsig.app.project.documents.layout.fframes.FFrameSymbol; |
38 |
import org.gvsig.app.project.documents.layout.fframes.FFrameSymbolFactory; |
39 |
import org.gvsig.app.project.documents.layout.fframes.FFrameTable; |
40 |
import org.gvsig.app.project.documents.layout.fframes.FFrameTableFactory; |
41 |
import org.gvsig.app.project.documents.layout.fframes.FFrameText; |
42 |
import org.gvsig.app.project.documents.layout.fframes.FFrameTextFactory; |
43 |
import org.gvsig.app.project.documents.layout.fframes.FFrameView; |
44 |
import org.gvsig.app.project.documents.layout.fframes.FFrameViewFactory; |
45 |
import org.gvsig.app.project.documents.layout.fframes.FrameFactory; |
46 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
47 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameBoxDialog; |
48 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameGraphicsDialog; |
49 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameGroupDialog; |
50 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameLegendDialog; |
51 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameNorthDialog; |
52 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameOverViewDialog; |
53 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFramePictureDialog; |
54 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameScaleBarDialog; |
55 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameTextDialog; |
56 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.FFrameViewDialog; |
57 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
58 |
import org.gvsig.app.project.documents.layout.gui.DefaultLayoutPanel; |
59 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
60 |
import org.gvsig.app.project.documents.layout.gui.MapProperties; |
61 |
import org.gvsig.app.project.documents.table.TableDocument; |
62 |
import org.gvsig.app.project.documents.table.TableDocument.TableLink; |
63 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
64 |
import org.gvsig.fmap.dal.feature.FeatureQueryOrder; |
65 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
66 |
import org.gvsig.fmap.mapcontrol.MapControl; |
67 |
import org.gvsig.tools.ToolsLocator; |
68 |
import org.gvsig.tools.dynobject.DynStruct; |
69 |
import org.gvsig.tools.evaluator.Evaluator; |
70 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
71 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
72 |
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension; |
73 |
import org.gvsig.tools.persistence.PersistenceManager; |
74 |
import org.gvsig.utils.XMLEntity; |
75 |
|
76 |
|
77 |
|
78 |
/**
|
79 |
* Factory of maps.
|
80 |
*
|
81 |
* @author Vicente Caballero Navarro
|
82 |
*/
|
83 |
public class LayoutManager extends AbstractDocumentManager { |
84 |
public static String TYPENAME = "project.document.layout"; |
85 |
|
86 |
private static final Logger LOG = LoggerFactory.getLogger(LayoutManager.class); |
87 |
|
88 |
private static final String KEY_LAYOUT_FFRAMEDIALOG = "app.project.documents.layout.fframes.gui"; |
89 |
private static final String KEY_LAYOUT_FFRAME = "app.project.documents.layout.fframes"; |
90 |
|
91 |
private static final String PERSISTENCE_LAYOUT_DOCUMENT_DEFINITION_NAME = "LayoutDocument"; |
92 |
|
93 |
private ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
|
94 |
|
95 |
private Boolean defaultShowGrid = null; |
96 |
private Boolean defaultAdjustToGrid = null; |
97 |
private Boolean defaultShowRulers = null; |
98 |
|
99 |
private DynStruct persistenceDefinition;
|
100 |
|
101 |
|
102 |
/**
|
103 |
* Returns image of button.
|
104 |
*
|
105 |
* @return Image button.
|
106 |
*/
|
107 |
public ImageIcon getIcon() { |
108 |
return PluginServices.getIconTheme().get("document-map-icon"); |
109 |
} |
110 |
|
111 |
/**
|
112 |
* Returns image of selected button.
|
113 |
*
|
114 |
* @return Image button.
|
115 |
*/
|
116 |
public ImageIcon getIconSelected() { |
117 |
return PluginServices.getIconTheme().get("document-map-icon-sel"); |
118 |
} |
119 |
|
120 |
/**
|
121 |
* Returns the name of registration in the point of extension.
|
122 |
*
|
123 |
* @return Name of registration
|
124 |
*/
|
125 |
public String getTypeName() { |
126 |
return TYPENAME;
|
127 |
} |
128 |
|
129 |
/**
|
130 |
* Returns the name of ProjectDocument.
|
131 |
*
|
132 |
* @return Name of ProjectDocument.
|
133 |
*/
|
134 |
public String getTitle() { |
135 |
return PluginServices.getText(this, "Mapa"); |
136 |
} |
137 |
|
138 |
public AbstractDocument createDocument() { |
139 |
return new DefaultLayoutDocument(this); |
140 |
} |
141 |
|
142 |
public IWindow getMainWindow(Document doc, WindowLayout layout) { |
143 |
LayoutPanel layoutPanel = new DefaultLayoutPanel();
|
144 |
if ( layout != null) { |
145 |
layoutPanel.setWindowLayout(layout); |
146 |
} |
147 |
layoutPanel.setLayoutManager(this);
|
148 |
layoutPanel.setDocument(doc); |
149 |
layoutPanel.getLayoutControl().fullRect(); |
150 |
layoutPanel.getWindowInfo().setTitle(PluginServices.getText(this, "Mapa") + " : " + layoutPanel.getName()); |
151 |
((AbstractDocument) doc).raiseEventCreateWindow(layoutPanel);
|
152 |
return layoutPanel;
|
153 |
} |
154 |
|
155 |
public IFFrameDialog createFFrameDialog(IFFrame fframe, LayoutPanel layoutPanel, AffineTransform affineTransform) { |
156 |
ExtensionPoint ep = extensionPoints.add(KEY_LAYOUT_FFRAMEDIALOG); |
157 |
|
158 |
try {
|
159 |
Object[] args = new Object[2]; |
160 |
args[0] = layoutPanel;
|
161 |
args[1] = fframe;
|
162 |
Object obj = ep.create(fframe.getName(), args);
|
163 |
if (obj != null){ |
164 |
IFFrameDialog fframedialog = (IFFrameDialog)obj; |
165 |
fframedialog.setRectangle(fframe.getBoundingBox(affineTransform)); |
166 |
return fframedialog;
|
167 |
} |
168 |
} |
169 |
catch (Exception e) { |
170 |
LOG.error("Error creating a FFrameDialog");
|
171 |
} |
172 |
return null; |
173 |
} |
174 |
|
175 |
public IFFrameDialog createFFrameDialog(IFFrame fframe, LayoutPanel layoutPanel) {
|
176 |
return createFFrameDialog(fframe, layoutPanel, layoutPanel.getLayoutControl().getAT());
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* Registers in the points of extension the Factory with alias.
|
181 |
*
|
182 |
* @param frameFactory
|
183 |
* FrameFactory to register.
|
184 |
* @param alias
|
185 |
* Alias.
|
186 |
*/
|
187 |
public void registerFrameFactory(FrameFactory frameFactory, |
188 |
String alias) {
|
189 |
ExtensionPoint ep = ToolsLocator.getExtensionPointManager().add(KEY_LAYOUT_FFRAME); |
190 |
ep.append(frameFactory.getRegisterName(), "", frameFactory);
|
191 |
if (alias != null){ |
192 |
ep.addAlias(frameFactory.getRegisterName(), alias); |
193 |
} |
194 |
} |
195 |
|
196 |
/**
|
197 |
* Registers in the points of extension the Factory
|
198 |
*
|
199 |
* @param frameFactory
|
200 |
* FrameFactory to register.
|
201 |
*/
|
202 |
public void registerFrameFactory(FrameFactory frameFactory) { |
203 |
registerFrameFactory(frameFactory, null);
|
204 |
} |
205 |
|
206 |
public IFFrame createFrame(String frameName) { |
207 |
|
208 |
Iterator<Extension> iterator = ToolsLocator.getExtensionPointManager()
|
209 |
.get(KEY_LAYOUT_FFRAME).iterator(); |
210 |
while (iterator.hasNext()) {
|
211 |
try {
|
212 |
FrameFactory frameFactory = (FrameFactory) iterator.next() |
213 |
.create(); |
214 |
if (frameFactory.getRegisterName().equals(frameName)) {
|
215 |
IFFrame frame = frameFactory.createFrame(); |
216 |
if (frame == null) { |
217 |
return null; |
218 |
} |
219 |
frame.setFrameFactory(frameFactory); |
220 |
return frame;
|
221 |
} |
222 |
} catch (Exception e) { |
223 |
NotificationManager.addError(e); |
224 |
} |
225 |
} |
226 |
return null; |
227 |
} |
228 |
|
229 |
@SuppressWarnings("rawtypes") |
230 |
public void registerFFrameDialog(String name, Class clazz){ |
231 |
if (!IFFrameDialog.class.isAssignableFrom(clazz)){
|
232 |
throw new IllegalArgumentException(clazz.getName() |
233 |
+ " must implement the IFFrameDialog interface");
|
234 |
} |
235 |
ExtensionPoint extensionPoint = extensionPoints.add(KEY_LAYOUT_FFRAMEDIALOG, "");
|
236 |
extensionPoint.append(name, name, clazz); |
237 |
} |
238 |
|
239 |
public IWindow getPropertiesWindow(Document doc) { |
240 |
return new MapProperties((LayoutDocument) doc); |
241 |
} |
242 |
|
243 |
/**
|
244 |
* Registers in the points of extension the Factory with alias.
|
245 |
*
|
246 |
*/
|
247 |
public static void register() { |
248 |
LayoutManager factory = new LayoutManager(); |
249 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
250 |
manager.registerFactory(factory); |
251 |
|
252 |
ProjectManager.getInstance().registerDocumentFactory(factory); |
253 |
|
254 |
LayoutManager layoutManager = (LayoutManager)ProjectManager.getInstance().getDocumentManagers(LayoutManager.TYPENAME); |
255 |
|
256 |
//Register Frames
|
257 |
layoutManager.registerFrameFactory(new FFrameBasicFactory());
|
258 |
layoutManager.registerFrameFactory(new FFrameGraphicsFactory());
|
259 |
layoutManager.registerFrameFactory(new FFrameGroupFactory());
|
260 |
layoutManager.registerFrameFactory(new FFrameLegendFactory());
|
261 |
layoutManager.registerFrameFactory(new FFrameNorthFactory());
|
262 |
layoutManager.registerFrameFactory(new FFrameOverViewFactory());
|
263 |
layoutManager.registerFrameFactory(new FFramePictureFactory());
|
264 |
layoutManager.registerFrameFactory(new FFrameScaleBarFactory());
|
265 |
layoutManager.registerFrameFactory(new FFrameSymbolFactory());
|
266 |
layoutManager.registerFrameFactory(new FFrameTableFactory());
|
267 |
layoutManager.registerFrameFactory(new FFrameTextFactory());
|
268 |
layoutManager.registerFrameFactory(new FFrameViewFactory());
|
269 |
layoutManager.registerFrameFactory(new FFrameGridFactory());
|
270 |
|
271 |
//Register FFrameDialogs forms
|
272 |
layoutManager.registerFFrameDialog(FFrameGraphics.PERSISTENCE_DEFINITION_NAME, FFrameGraphicsDialog.class); |
273 |
layoutManager.registerFFrameDialog(FFrameSymbol.PERSISTENCE_DEFINITION_NAME, FFrameGraphicsDialog.class); |
274 |
layoutManager.registerFFrameDialog(FFrameGroup.PERSISTENCE_DEFINITION_NAME, FFrameGroupDialog.class); |
275 |
layoutManager.registerFFrameDialog(FFrameTable.PERSISTENCE_DEFINITION_NAME, FFrameBoxDialog.class); |
276 |
layoutManager.registerFFrameDialog(FFrameLegend.PERSISTENCE_DEFINITION_NAME, FFrameLegendDialog.class); |
277 |
layoutManager.registerFFrameDialog(FFramePicture.PERSISTENCE_DEFINITION_NAME, FFramePictureDialog.class); |
278 |
layoutManager.registerFFrameDialog(FFrameNorth.PERSISTENCE_DEFINITION_NAME, FFrameNorthDialog.class); |
279 |
layoutManager.registerFFrameDialog(FFrameScaleBar.PERSISTENCE_DEFINITION_NAME, FFrameScaleBarDialog.class); |
280 |
layoutManager.registerFFrameDialog(FFrameText.PERSISTENCE_DEFINITION_NAME, FFrameTextDialog.class); |
281 |
layoutManager.registerFFrameDialog(FFrameView.PERSISTENCE_DEFINITION_NAME, FFrameViewDialog.class); |
282 |
layoutManager.registerFFrameDialog(FFrameOverView.PERSISTENCE_DEFINITION_NAME, FFrameOverViewDialog.class); |
283 |
|
284 |
|
285 |
// ProjectFactory.getInstance().registerDocumentAction(TYPENAME,"copy",new CopyDocumentContextMenuAction());
|
286 |
// ProjectFactory.getInstance().registerDocumentAction(TYPENAME,"cut",new CutDocumentContextMenuAction());
|
287 |
// ProjectFactory.getInstance().registerDocumentAction(TYPENAME,"paste",new PasteDocumentContextMenuAction());
|
288 |
|
289 |
PluginServices.getIconTheme().registerDefault( |
290 |
"document-map-icon",
|
291 |
AddLayer.class.getClassLoader().getResource("images/mapas.png")
|
292 |
); |
293 |
PluginServices.getIconTheme().registerDefault( |
294 |
"document-map-icon-sel",
|
295 |
AddLayer.class.getClassLoader().getResource("images/mapas_sel.png")
|
296 |
); |
297 |
PluginServices.getIconTheme().registerDefault( |
298 |
"neresize-icon",
|
299 |
AddLayer.class.getClassLoader().getResource("images/NEResize.png")
|
300 |
); |
301 |
PluginServices.getIconTheme().registerDefault( |
302 |
"eresize-icon",
|
303 |
AddLayer.class.getClassLoader().getResource("images/EResize.png")
|
304 |
); |
305 |
PluginServices.getIconTheme().registerDefault( |
306 |
"nresize-icon",
|
307 |
AddLayer.class.getClassLoader().getResource("images/NResize.png")
|
308 |
); |
309 |
PluginServices.getIconTheme().registerDefault( |
310 |
"move-icon",
|
311 |
AddLayer.class.getClassLoader().getResource("images/Move.png")
|
312 |
); |
313 |
PluginServices.getIconTheme().registerDefault( |
314 |
"sereresize-icon",
|
315 |
AddLayer.class.getClassLoader().getResource("images/SEResize.png")
|
316 |
); |
317 |
PluginServices.getIconTheme().registerDefault( |
318 |
"symboltag-icon",
|
319 |
AddLayer.class.getClassLoader().getResource("images/symbolTag.gif")
|
320 |
); |
321 |
PluginServices.getIconTheme().registerDefault( |
322 |
"move-icon",
|
323 |
AddLayer.class.getClassLoader().getResource("images/Move.png")
|
324 |
); |
325 |
PluginServices.getIconTheme().registerDefault( |
326 |
"numero-icon",
|
327 |
AddLayer.class.getClassLoader().getResource("images/numero.png")
|
328 |
); |
329 |
PluginServices.getIconTheme().registerDefault( |
330 |
"barra1-icon",
|
331 |
AddLayer.class.getClassLoader().getResource("images/barra1.png")
|
332 |
); |
333 |
PluginServices.getIconTheme().registerDefault( |
334 |
"barra2-icon",
|
335 |
AddLayer.class.getClassLoader().getResource("images/barra2.png")
|
336 |
); |
337 |
PluginServices.getIconTheme().registerDefault( |
338 |
"barra3-icon",
|
339 |
AddLayer.class.getClassLoader().getResource("images/barra3.png")
|
340 |
); |
341 |
PluginServices.getIconTheme().registerDefault( |
342 |
"text-left-icon",
|
343 |
AddLayer.class.getClassLoader().getResource("images/left.PNG")
|
344 |
); |
345 |
PluginServices.getIconTheme().registerDefault( |
346 |
"text-center-v-icon",
|
347 |
AddLayer.class.getClassLoader().getResource("images/centerV.PNG")
|
348 |
); |
349 |
PluginServices.getIconTheme().registerDefault( |
350 |
"text-right-icon",
|
351 |
AddLayer.class.getClassLoader().getResource("images/right.PNG")
|
352 |
); |
353 |
PluginServices.getIconTheme().registerDefault( |
354 |
"left-rotation-icon",
|
355 |
AddLayer.class.getClassLoader().getResource("images/leftrotation.png")
|
356 |
); |
357 |
PluginServices.getIconTheme().registerDefault( |
358 |
"text-up-icon",
|
359 |
AddLayer.class.getClassLoader().getResource("images/up.PNG")
|
360 |
); |
361 |
PluginServices.getIconTheme().registerDefault( |
362 |
"text-center-h-icon",
|
363 |
AddLayer.class.getClassLoader().getResource("images/centerH.PNG")
|
364 |
); |
365 |
PluginServices.getIconTheme().registerDefault( |
366 |
"text-down-icon",
|
367 |
AddLayer.class.getClassLoader().getResource("images/down.PNG")
|
368 |
); |
369 |
PluginServices.getIconTheme().registerDefault( |
370 |
"text-distup-icon",
|
371 |
AddLayer.class.getClassLoader().getResource("images/distUp.PNG")
|
372 |
); |
373 |
PluginServices.getIconTheme().registerDefault( |
374 |
"text-distcenterh-icon",
|
375 |
AddLayer.class.getClassLoader().getResource("images/distCenterH.PNG")
|
376 |
); |
377 |
PluginServices.getIconTheme().registerDefault( |
378 |
"text-distdown-icon",
|
379 |
AddLayer.class.getClassLoader().getResource("images/distDown.PNG")
|
380 |
); |
381 |
PluginServices.getIconTheme().registerDefault( |
382 |
"text-distleft-icon",
|
383 |
AddLayer.class.getClassLoader().getResource("images/distLeft.PNG")
|
384 |
); |
385 |
PluginServices.getIconTheme().registerDefault( |
386 |
"text-distcenterv-icon",
|
387 |
AddLayer.class.getClassLoader().getResource("images/distCenterV.PNG")
|
388 |
); |
389 |
PluginServices.getIconTheme().registerDefault( |
390 |
"text-distright-icon",
|
391 |
AddLayer.class.getClassLoader().getResource("images/distRight.PNG")
|
392 |
); |
393 |
PluginServices.getIconTheme().registerDefault( |
394 |
"text-size-width-icon",
|
395 |
AddLayer.class.getClassLoader().getResource("images/sizeWidth.PNG")
|
396 |
); |
397 |
PluginServices.getIconTheme().registerDefault( |
398 |
"text-size-height-icon",
|
399 |
AddLayer.class.getClassLoader().getResource("images/sizeHeight.PNG")
|
400 |
); |
401 |
PluginServices.getIconTheme().registerDefault( |
402 |
"text-size-other-icon",
|
403 |
AddLayer.class.getClassLoader().getResource("images/sizeOther.PNG")
|
404 |
); |
405 |
PluginServices.getIconTheme().registerDefault( |
406 |
"text-space-right-icon",
|
407 |
AddLayer.class.getClassLoader().getResource("images/spaceRight.PNG")
|
408 |
); |
409 |
PluginServices.getIconTheme().registerDefault( |
410 |
"text-inlayout-icon",
|
411 |
AddLayer.class.getClassLoader().getResource("images/inLayout.PNG")
|
412 |
); |
413 |
|
414 |
//Tools
|
415 |
PluginServices.getIconTheme().registerDefault( |
416 |
"rect-select-cursor",
|
417 |
MapControl.class.getResource("images/RectSelectCursor.gif")
|
418 |
); |
419 |
|
420 |
PluginServices.getIconTheme().registerDefault( |
421 |
"circle-cursor",
|
422 |
AddLayer.class.getClassLoader().getResource("images/CircleCursor.png")
|
423 |
); |
424 |
PluginServices.getIconTheme().registerDefault( |
425 |
"line-cursor",
|
426 |
AddLayer.class.getClassLoader().getResource("images/LineCursor.png")
|
427 |
); |
428 |
PluginServices.getIconTheme().registerDefault( |
429 |
"point-cursor",
|
430 |
AddLayer.class.getClassLoader().getResource("images/PointCursor.png")
|
431 |
); |
432 |
PluginServices.getIconTheme().registerDefault( |
433 |
"poligon-cursor",
|
434 |
AddLayer.class.getClassLoader().getResource("images/PoligonCursor.png")
|
435 |
); |
436 |
PluginServices.getIconTheme().registerDefault( |
437 |
"rectangle-cursor",
|
438 |
AddLayer.class.getClassLoader().getResource("images/RectangleCursor.png")
|
439 |
); |
440 |
PluginServices.getIconTheme().registerDefault( |
441 |
"crux-cursor",
|
442 |
AddLayer.class.getClassLoader().getResource("images/CruxCursor.png")
|
443 |
); |
444 |
PluginServices.getIconTheme().registerDefault( |
445 |
"layout-hand-icon",
|
446 |
AddLayer.class.getClassLoader().getResource("images/LayoutHand.gif")
|
447 |
); |
448 |
PluginServices.getIconTheme().registerDefault( |
449 |
"zoom-in-cursor",
|
450 |
AddLayer.class.getClassLoader().getResource("images/ZoomInCursor.gif")
|
451 |
); |
452 |
PluginServices.getIconTheme().registerDefault( |
453 |
"hand-icon",
|
454 |
AddLayer.class.getClassLoader().getResource("images/Hand.gif")
|
455 |
); |
456 |
PluginServices.getIconTheme().registerDefault( |
457 |
"zoom-out-cursor",
|
458 |
AddLayer.class.getClassLoader().getResource("images/ZoomOutCursor.gif")
|
459 |
); |
460 |
PluginServices.getIconTheme().registerDefault( |
461 |
"layout-zoom-in-cursor",
|
462 |
AddLayer.class.getClassLoader().getResource("images/LayoutZoomInCursor.gif")
|
463 |
); |
464 |
PluginServices.getIconTheme().registerDefault( |
465 |
"layout-zoom-out-cursor",
|
466 |
AddLayer.class.getClassLoader().getResource("images/LayoutZoomOutCursor.gif")
|
467 |
); |
468 |
PluginServices.getIconTheme().registerDefault( |
469 |
"right-rotation-icon",
|
470 |
AddLayer.class.getClassLoader().getResource("images/rightrotation.png")
|
471 |
); |
472 |
PluginServices.getIconTheme().registerDefault( |
473 |
"point-select-cursor",
|
474 |
MapControl.class.getResource("images/PointSelectCursor.gif")
|
475 |
); |
476 |
|
477 |
FFrame.initializeIcons(); |
478 |
FFrameTable.initializeIcons(); |
479 |
|
480 |
if (factory.persistenceDefinition == null){ |
481 |
factory.persistenceDefinition = manager.addDefinition( |
482 |
LayoutDocument.class, |
483 |
PERSISTENCE_LAYOUT_DOCUMENT_DEFINITION_NAME, |
484 |
"Table document Persistence definition",
|
485 |
null,
|
486 |
null
|
487 |
); |
488 |
factory.persistenceDefinition.extend(manager.getDefinition(AbstractDocument.PERSISTENCE_DEFINITION_NAME));
|
489 |
|
490 |
factory.persistenceDefinition.addDynFieldObject(DefaultLayoutDocument.LAYOUTCONTEXT_OBJECT).setClassOfValue(LayoutContext.class).setMandatory(false);
|
491 |
|
492 |
DefaultLayoutPanel.registerPersistent(); |
493 |
DefaultLayoutContext.registerPersistent(); |
494 |
|
495 |
} |
496 |
|
497 |
} |
498 |
|
499 |
/**
|
500 |
* Returns the priority of de ProjectDocument.
|
501 |
*
|
502 |
* @return Priority.
|
503 |
*/
|
504 |
public int getPriority() { |
505 |
return 2; |
506 |
} |
507 |
|
508 |
/**
|
509 |
* Inserts if the grid sould be show.
|
510 |
* @param showGrid
|
511 |
*/
|
512 |
public void setDefaultShowGrid(boolean showGrid) { |
513 |
defaultShowGrid = new Boolean(showGrid); |
514 |
} |
515 |
/**
|
516 |
* Inserts if the adjust togrid sould be actived.
|
517 |
* @param gridEnable
|
518 |
*/
|
519 |
public void setDefaultAdjustToGrid(boolean gridEnabled) { |
520 |
defaultAdjustToGrid = new Boolean(gridEnabled); |
521 |
} |
522 |
|
523 |
/**
|
524 |
* Inserts if the ruler sould be show.
|
525 |
* @param showRuler
|
526 |
*/
|
527 |
public void setDefaultShowRulers(boolean showRules) { |
528 |
defaultShowRulers = new Boolean(showRules); |
529 |
} |
530 |
|
531 |
/**
|
532 |
* Returns if the grid sould be show.
|
533 |
* @return True if the grid sould be show.
|
534 |
*/
|
535 |
public boolean getDefaultShowGrid() { |
536 |
if (defaultShowGrid == null) { |
537 |
XMLEntity xml = PluginServices.getPluginServices("org.gvsig.app").getPersistentXML();
|
538 |
if (xml.contains("DefaultShowLayoutGrid")) { |
539 |
defaultShowGrid = new Boolean(xml.getBooleanProperty("DefaultShowLayoutGrid")); |
540 |
} |
541 |
else {
|
542 |
// factory default is true
|
543 |
defaultShowGrid = new Boolean(true); |
544 |
} |
545 |
} |
546 |
return defaultShowGrid.booleanValue();
|
547 |
} |
548 |
|
549 |
/**
|
550 |
* Returns if the adjust to grid sould be actived.
|
551 |
* @return True if the adjust to grid sould be actived.
|
552 |
*/
|
553 |
public boolean getDefaultAdjustToGrid() { |
554 |
if (defaultAdjustToGrid == null) { |
555 |
XMLEntity xml = PluginServices.getPluginServices("org.gvsig.app").getPersistentXML();
|
556 |
if (xml.contains("DefaultEnableLayoutGrid")) { |
557 |
defaultAdjustToGrid = new Boolean(xml.getBooleanProperty("DefaultEnableLayoutGrid")); |
558 |
} |
559 |
else {
|
560 |
// factory default is false
|
561 |
defaultAdjustToGrid = new Boolean(false); |
562 |
} |
563 |
} |
564 |
return defaultAdjustToGrid.booleanValue();
|
565 |
} |
566 |
/**
|
567 |
* Returns if the ruler sould be show.
|
568 |
* @return True if the ruler sould be show.
|
569 |
*/
|
570 |
public boolean getDefaultShowRulers() { |
571 |
if (defaultShowRulers == null){ |
572 |
XMLEntity xml = PluginServices.getPluginServices("org.gvsig.app").getPersistentXML();
|
573 |
if (xml.contains("DefaultShowLayoutRules")) { |
574 |
defaultShowRulers = new Boolean(xml.getBooleanProperty("DefaultShowLayoutRules")); |
575 |
} |
576 |
else {
|
577 |
// factory default is true
|
578 |
defaultShowRulers = new Boolean(true); |
579 |
} |
580 |
} |
581 |
return defaultShowRulers.booleanValue();
|
582 |
} |
583 |
|
584 |
@SuppressWarnings("rawtypes") |
585 |
public DynStruct getDefinition(String className) { |
586 |
|
587 |
if( this.persistenceDefinition.getName().equalsIgnoreCase(className)) { |
588 |
return this.persistenceDefinition; |
589 |
} |
590 |
if( this.persistenceDefinition.getFullName().equalsIgnoreCase(className)) { |
591 |
return this.persistenceDefinition; |
592 |
} |
593 |
if( this.getDocumentClass().getName().equals(className) ) { |
594 |
return this.persistenceDefinition; |
595 |
} |
596 |
|
597 |
// Class theClass;
|
598 |
// try {
|
599 |
// theClass = (Class) Class.forName(className);
|
600 |
// } catch (ClassNotFoundException e) {
|
601 |
// return null;
|
602 |
// }
|
603 |
// if ( this.manages(theClass)){
|
604 |
// return this.persistenceDefinition;
|
605 |
// }
|
606 |
return null; |
607 |
} |
608 |
|
609 |
@Override
|
610 |
protected Class getDocumentClass() { |
611 |
return DefaultLayoutDocument.class;
|
612 |
} |
613 |
} |