svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / contextmenu / gui / PropertyLayoutMenuEntry.java @ 670
History | View | Annotate | Download (4.18 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 java.awt.event.ActionEvent; |
25 |
import java.awt.event.ActionListener; |
26 |
|
27 |
import org.gvsig.andami.PluginServices; |
28 |
import org.gvsig.app.project.ProjectManager; |
29 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
30 |
import org.gvsig.app.project.documents.layout.LayoutContext; |
31 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
32 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
33 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
34 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
35 |
import org.gvsig.tools.ToolsLocator; |
36 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
37 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
38 |
|
39 |
/**
|
40 |
* Abre el di?logo de propiedades del FFrame seleccionado.
|
41 |
*
|
42 |
* @author Vicente Caballero Navarro
|
43 |
*/
|
44 |
public class PropertyLayoutMenuEntry extends AbstractLayoutContextMenuAction { |
45 |
|
46 |
private static LayoutManager layoutManager = null; |
47 |
|
48 |
public PropertyLayoutMenuEntry() {
|
49 |
layoutManager = |
50 |
(LayoutManager) ProjectManager.getInstance().getDocumentManager(
|
51 |
DefaultLayoutManager.TYPENAME); |
52 |
} |
53 |
|
54 |
public String getGroup() { |
55 |
return "layout"; |
56 |
} |
57 |
|
58 |
public int getGroupOrder() { |
59 |
return 6; |
60 |
} |
61 |
|
62 |
public int getOrder() { |
63 |
return 1; |
64 |
} |
65 |
|
66 |
public String getText() { |
67 |
return PluginServices.getText(this, "propiedades"); |
68 |
} |
69 |
|
70 |
public boolean isEnabled(LayoutContext layoutContext, |
71 |
IFFrame[] selectedFrames) {
|
72 |
return true; |
73 |
} |
74 |
|
75 |
public boolean isVisible(LayoutContext layoutContext, |
76 |
IFFrame[] selectedFrames) {
|
77 |
if (selectedFrames.length == 1 |
78 |
&& !(getLayout().getLayoutControl().getGeometryAdapter() |
79 |
.getPoints().length > 0))
|
80 |
return true; |
81 |
return false; |
82 |
} |
83 |
|
84 |
public void execute(final LayoutContext layoutContext, IFFrame[] selectedFrames) { |
85 |
IFFrame[] selecList = layoutContext.getSelectedFFrames();
|
86 |
if (selecList.length == 1) { |
87 |
final IFFrame frame = selecList[0]; |
88 |
final IFFrameDialog fframeDialog =
|
89 |
layoutManager.createFFrameDialog(frame, layoutPanel, layoutContext.getAT()); |
90 |
if (fframeDialog != null) { |
91 |
fframeDialog.addActionListener(new ActionListener() { |
92 |
|
93 |
@Override
|
94 |
public void actionPerformed(ActionEvent e) { |
95 |
IFFrame fframeAux = fframeDialog.getFFrame(); |
96 |
|
97 |
if (fframeAux != null) { |
98 |
if (fframeAux instanceof IFFrameUseFMap) |
99 |
((IFFrameUseFMap) fframeAux).refresh(); |
100 |
fframeAux.setLevel(frame.getLevel()); |
101 |
fframeAux.setSelected(frame.getSelected()!=IFFrame.NOSELECT); |
102 |
layoutContext.getFrameCommandsRecord().update(frame, fframeAux); |
103 |
fframeAux.getBoundingBox(layoutContext.getAT()); |
104 |
layoutContext.updateFFrames(); |
105 |
layoutContext.notifAllObservers(); |
106 |
} |
107 |
|
108 |
} |
109 |
}); |
110 |
PluginServices.getMDIManager().addWindow(fframeDialog); |
111 |
} |
112 |
} |
113 |
} |
114 |
} |