svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / contextmenu / gui / PropertyLayoutMenuEntry.java @ 36648
History | View | Annotate | Download (3.46 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.app.project.documents.layout.contextmenu.gui; |
23 |
|
24 |
import org.gvsig.andami.PluginServices; |
25 |
import org.gvsig.app.project.ProjectManager; |
26 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
27 |
import org.gvsig.app.project.documents.layout.LayoutContext; |
28 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
29 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
30 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
31 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
32 |
|
33 |
/**
|
34 |
* Abre el di?logo de propiedades del FFrame seleccionado.
|
35 |
*
|
36 |
* @author Vicente Caballero Navarro
|
37 |
*/
|
38 |
public class PropertyLayoutMenuEntry extends AbstractLayoutContextMenuAction { |
39 |
|
40 |
private static LayoutManager layoutManager = null; |
41 |
|
42 |
public PropertyLayoutMenuEntry() {
|
43 |
layoutManager = |
44 |
(LayoutManager) ProjectManager.getInstance().getDocumentManager(
|
45 |
DefaultLayoutManager.TYPENAME); |
46 |
} |
47 |
|
48 |
public String getGroup() { |
49 |
return "layout"; |
50 |
} |
51 |
|
52 |
public int getGroupOrder() { |
53 |
return 6; |
54 |
} |
55 |
|
56 |
public int getOrder() { |
57 |
return 1; |
58 |
} |
59 |
|
60 |
public String getText() { |
61 |
return PluginServices.getText(this, "propiedades"); |
62 |
} |
63 |
|
64 |
public boolean isEnabled(LayoutContext layoutContext, |
65 |
IFFrame[] selectedFrames) {
|
66 |
return true; |
67 |
} |
68 |
|
69 |
public boolean isVisible(LayoutContext layoutContext, |
70 |
IFFrame[] selectedFrames) {
|
71 |
if (selectedFrames.length == 1 |
72 |
&& !(getLayout().getLayoutControl().getGeometryAdapter() |
73 |
.getPoints().length > 0))
|
74 |
return true; |
75 |
return false; |
76 |
} |
77 |
|
78 |
public void execute(LayoutContext layoutContext, IFFrame[] selectedFrames) { |
79 |
IFFrame[] selecList = layoutContext.getFFrameSelected();
|
80 |
if (selecList.length == 1) { |
81 |
IFFrame frame = selecList[0];
|
82 |
IFFrameDialog fframeDialog = |
83 |
layoutManager.createFFrameDialog(frame, null,
|
84 |
layoutContext.getAT()); |
85 |
if (fframeDialog != null) { |
86 |
PluginServices.getMDIManager().addWindow(fframeDialog); |
87 |
IFFrame fframeAux = fframeDialog.getFFrame(); |
88 |
if (fframeAux instanceof IFFrameUseFMap) |
89 |
((IFFrameUseFMap) fframeAux).refresh(); |
90 |
layoutContext.getFrameCommandsRecord().update(frame, fframeAux); |
91 |
fframeAux.getBoundingBox(layoutContext.getAT()); |
92 |
layoutContext.updateFFrames(); |
93 |
layoutContext.callLayoutDrawListeners(); |
94 |
} |
95 |
} |
96 |
} |
97 |
} |