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 | 1714 | fdiaz | /*
|
---|---|---|---|
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 | 1757 | fdiaz | import org.gvsig.app.project.ProjectManager; |
9 | 1714 | fdiaz | import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
10 | import org.gvsig.app.project.documents.layout.LayoutControl; |
||
11 | 1757 | fdiaz | import org.gvsig.app.project.documents.layout.LayoutManager; |
12 | 1714 | fdiaz | import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
13 | 1738 | fdiaz | import org.gvsig.app.project.documents.layout.tools.behavior.LayoutRectangleByTwoPointsBehavior; |
14 | 1714 | fdiaz | 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 | 1757 | fdiaz | 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 | 1714 | fdiaz | 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 | 1757 | fdiaz | /*friend*/ static void register(DefaultLayoutManager layoutManager) { |
42 | 1714 | fdiaz | 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 | 1757 | fdiaz | /*friend*/ static void addLayoutAddMapBoxTool(LayoutPanel layoutPanel, LayoutControl control) { |
49 | if(control.getLayoutTool("layoutaddmapbox") != null) { |
||
50 | return;
|
||
51 | } |
||
52 | 1714 | fdiaz | LayoutAddMapBoxListenerImpl labl = new LayoutAddMapBoxListenerImpl(layoutPanel);
|
53 | 1738 | fdiaz | control.addLayoutTool("layoutaddmapbox", new LayoutRectangleByTwoPointsBehavior(labl)); |
54 | 1757 | fdiaz | } |
55 | |||
56 | public static void addLayoutEditMapBoxTool(LayoutPanel layoutPanel, LayoutControl control) { |
||
57 | if(control.getLayoutTool("layouteditmapbox") != null) { |
||
58 | return;
|
||
59 | } |
||
60 | 1714 | fdiaz | LayoutEditMapBoxListenerImpl leditMapBoxListener = new LayoutEditMapBoxListenerImpl(layoutPanel);
|
61 | control.addLayoutTool("layouteditmapbox", new LayoutEditMapBoxBehavior(leditMapBoxListener)); |
||
62 | } |
||
63 | |||
64 | 1757 | fdiaz | /*friend*/ static void registerPersistence() { |
65 | 1714 | fdiaz | FFrameMapBox.registerPersistent(); |
66 | MapBoxModel.registerPersistent(); |
||
67 | SelectionCellImpl.registerPersistent(); |
||
68 | CellImpl.registerPersistent(); |
||
69 | } |
||
70 | |||
71 | 1757 | fdiaz | /*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 | 1714 | fdiaz | } |