svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / layout / mapbox / MapBoxUtils.java @ 1757
History | View | Annotate | Download (4.9 KB)
1 |
/*
|
---|---|
2 |
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
3 |
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
4 |
*/
|
5 |
package org.gvsig.layout.mapbox; |
6 |
|
7 |
import org.gvsig.andami.IconThemeHelper; |
8 |
import org.gvsig.app.project.ProjectManager; |
9 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
10 |
import org.gvsig.app.project.documents.layout.LayoutControl; |
11 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
12 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
13 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutRectangleByTwoPointsBehavior; |
14 |
import org.gvsig.layout.mapbox.fframe.FFrameMapBox; |
15 |
import org.gvsig.layout.mapbox.fframe.FFrameMapBoxFactory; |
16 |
import org.gvsig.layout.mapbox.model.CellImpl; |
17 |
import org.gvsig.layout.mapbox.model.MapBoxModel; |
18 |
import org.gvsig.layout.mapbox.model.SelectionCellImpl; |
19 |
import org.gvsig.layout.mapbox.panel.FFrameMapBoxPanel; |
20 |
import org.gvsig.layout.mapbox.panel.menu.AddColumnMapBoxMenuEntry; |
21 |
import org.gvsig.layout.mapbox.panel.menu.AddRowMapBoxMenuEntry; |
22 |
import org.gvsig.layout.mapbox.panel.menu.CombineCellsMapBoxMenuEntry; |
23 |
import org.gvsig.layout.mapbox.panel.menu.EditMapBoxMenuEntry; |
24 |
import org.gvsig.layout.mapbox.panel.menu.InsertColumnMapBoxMenuEntry; |
25 |
import org.gvsig.layout.mapbox.panel.menu.InsertRowMapBoxMenuEntry; |
26 |
import org.gvsig.layout.mapbox.panel.menu.RemoveCellsMapBoxMenuEntry; |
27 |
import org.gvsig.layout.mapbox.panel.menu.RemoveColumnMapBoxMenuEntry; |
28 |
import org.gvsig.layout.mapbox.panel.menu.RemoveRowMapBoxMenuEntry; |
29 |
import org.gvsig.layout.mapbox.panel.menu.SplitCellsHorizontallyMapBoxMenuEntry; |
30 |
import org.gvsig.layout.mapbox.panel.menu.SplitCellsVerticallyMapBoxMenuEntry; |
31 |
import org.gvsig.layout.mapbox.tools.LayoutAddMapBoxListenerImpl; |
32 |
import org.gvsig.layout.mapbox.tools.LayoutEditMapBoxBehavior; |
33 |
import org.gvsig.layout.mapbox.tools.LayoutEditMapBoxListenerImpl; |
34 |
|
35 |
/**
|
36 |
*
|
37 |
* @author fdiaz
|
38 |
*/
|
39 |
public class MapBoxUtils { |
40 |
|
41 |
/*friend*/ static void register(DefaultLayoutManager layoutManager) { |
42 |
layoutManager.registerFrameFactory(new FFrameMapBoxFactory());
|
43 |
layoutManager.registerFFrameDialog( |
44 |
FFrameMapBox.PERSISTENCE_DEFINITION_NAME, FFrameMapBoxPanel.class); |
45 |
IconThemeHelper.registerIcon("action", "layout-insert-mapbox", MapBoxUtils.class); |
46 |
} |
47 |
|
48 |
/*friend*/ static void addLayoutAddMapBoxTool(LayoutPanel layoutPanel, LayoutControl control) { |
49 |
if(control.getLayoutTool("layoutaddmapbox") != null) { |
50 |
return;
|
51 |
} |
52 |
LayoutAddMapBoxListenerImpl labl = new LayoutAddMapBoxListenerImpl(layoutPanel);
|
53 |
control.addLayoutTool("layoutaddmapbox", new LayoutRectangleByTwoPointsBehavior(labl)); |
54 |
} |
55 |
|
56 |
public static void addLayoutEditMapBoxTool(LayoutPanel layoutPanel, LayoutControl control) { |
57 |
if(control.getLayoutTool("layouteditmapbox") != null) { |
58 |
return;
|
59 |
} |
60 |
LayoutEditMapBoxListenerImpl leditMapBoxListener = new LayoutEditMapBoxListenerImpl(layoutPanel);
|
61 |
control.addLayoutTool("layouteditmapbox", new LayoutEditMapBoxBehavior(leditMapBoxListener)); |
62 |
} |
63 |
|
64 |
/*friend*/ static void registerPersistence() { |
65 |
FFrameMapBox.registerPersistent(); |
66 |
MapBoxModel.registerPersistent(); |
67 |
SelectionCellImpl.registerPersistent(); |
68 |
CellImpl.registerPersistent(); |
69 |
} |
70 |
|
71 |
/*friend*/ static void registerContextMenuOptions() { |
72 |
LayoutManager layoutManager = (LayoutManager) ProjectManager |
73 |
.getInstance().getDocumentManager("project.document.layout");
|
74 |
|
75 |
layoutManager.registerLayoutMenuAction("CombineCells",
|
76 |
CombineCellsMapBoxMenuEntry.class); |
77 |
layoutManager.registerLayoutMenuAction("SplitCellsVertically",
|
78 |
SplitCellsVerticallyMapBoxMenuEntry.class); |
79 |
layoutManager.registerLayoutMenuAction("SplitCellsHorizontally",
|
80 |
SplitCellsHorizontallyMapBoxMenuEntry.class); |
81 |
layoutManager.registerLayoutMenuAction("InsertColumnMapBoxMenuEntry",
|
82 |
InsertColumnMapBoxMenuEntry.class); |
83 |
layoutManager.registerLayoutMenuAction("AddColumnMapBoxMenuEntry",
|
84 |
AddColumnMapBoxMenuEntry.class); |
85 |
layoutManager.registerLayoutMenuAction("InsertRowMapBoxMenuEntry",
|
86 |
InsertRowMapBoxMenuEntry.class); |
87 |
layoutManager.registerLayoutMenuAction("AddRowMapBoxMenuEntry",
|
88 |
AddRowMapBoxMenuEntry.class); |
89 |
layoutManager.registerLayoutMenuAction("RemoveColumnMapBoxMenuEntry",
|
90 |
RemoveColumnMapBoxMenuEntry.class); |
91 |
layoutManager.registerLayoutMenuAction("RemoveRowMapBoxMenuEntry",
|
92 |
RemoveRowMapBoxMenuEntry.class); |
93 |
layoutManager.registerLayoutMenuAction("RemoveCellsMapBoxMenuEntry",
|
94 |
RemoveCellsMapBoxMenuEntry.class); |
95 |
layoutManager.registerLayoutMenuAction("EditMapBoxMenuEntry",
|
96 |
EditMapBoxMenuEntry.class); |
97 |
|
98 |
} |
99 |
|
100 |
} |