svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / extension / ViewPropertiesExtension.java @ 40596
History | View | Annotate | Download (2.77 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.app.extension; |
26 |
|
27 |
import org.gvsig.andami.IconThemeHelper; |
28 |
import org.gvsig.andami.PluginServices; |
29 |
import org.gvsig.andami.plugins.Extension; |
30 |
import org.gvsig.andami.preferences.IPreference; |
31 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
32 |
import org.gvsig.app.gui.preferencespage.ViewBehaviorPage; |
33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
34 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
35 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
36 |
import org.gvsig.app.project.documents.view.gui.ViewProperties; |
37 |
|
38 |
public class ViewPropertiesExtension extends Extension implements IPreferenceExtension { |
39 |
private ViewBehaviorPage vb = new ViewBehaviorPage(); |
40 |
public void initialize() { |
41 |
} |
42 |
|
43 |
public void execute(String s) { |
44 |
DefaultViewPanel vista = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
45 |
ViewDocument model = vista.getModel(); |
46 |
|
47 |
if (s.equalsIgnoreCase("view-properties") ) { |
48 |
DefaultViewDocument viewModel = (DefaultViewDocument)model; |
49 |
if (viewModel != null) { |
50 |
ViewProperties viewProperties = new ViewProperties(viewModel);
|
51 |
PluginServices.getMDIManager().addWindow(viewProperties); |
52 |
if (viewProperties.isAcceppted()) {
|
53 |
viewModel.setModified(true);
|
54 |
} |
55 |
} |
56 |
} |
57 |
} |
58 |
|
59 |
public boolean isEnabled() { |
60 |
return true; |
61 |
} |
62 |
|
63 |
/**
|
64 |
* DOCUMENT ME!
|
65 |
*
|
66 |
* @return DOCUMENT ME!
|
67 |
*/
|
68 |
public boolean isVisible() { |
69 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
70 |
.getActiveWindow(); |
71 |
return (f!=null && f instanceof DefaultViewPanel); |
72 |
} |
73 |
|
74 |
public IPreference[] getPreferencesPages() { |
75 |
return new IPreference[] {vb}; |
76 |
} |
77 |
} |