Revision 41248 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewPropertiesExtension.java
ViewPropertiesExtension.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 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.
|
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
|
9 |
* version. |
|
10 | 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.
|
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14 |
* details. |
|
15 | 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. |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 |
|
|
25 | 23 |
package org.gvsig.app.extension; |
26 | 24 |
|
27 | 25 |
import org.gvsig.andami.IconThemeHelper; |
28 |
import org.gvsig.andami.PluginServices; |
|
29 | 26 |
import org.gvsig.andami.plugins.Extension; |
30 | 27 |
import org.gvsig.andami.preferences.IPreference; |
31 | 28 |
import org.gvsig.andami.preferences.IPreferenceExtension; |
29 |
import org.gvsig.app.ApplicationLocator; |
|
30 |
import org.gvsig.app.ApplicationManager; |
|
32 | 31 |
import org.gvsig.app.gui.preferencespage.LayerOrderPage; |
33 | 32 |
import org.gvsig.app.gui.preferencespage.ViewBehaviorPage; |
34 | 33 |
import org.gvsig.app.project.documents.view.ViewDocument; |
35 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
36 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
37 | 34 |
import org.gvsig.app.project.documents.view.gui.ViewProperties; |
38 | 35 |
|
39 | 36 |
public class ViewPropertiesExtension extends Extension implements IPreferenceExtension { |
40 |
|
|
41 |
private ViewBehaviorPage vb = new ViewBehaviorPage();
|
|
42 |
private LayerOrderPage lo_page = new LayerOrderPage();
|
|
43 |
|
|
37 |
|
|
38 |
private ViewBehaviorPage vb = new ViewBehaviorPage();
|
|
39 |
private LayerOrderPage lo_page = new LayerOrderPage();
|
|
40 |
|
|
44 | 41 |
public void initialize() { |
45 |
IconThemeHelper.registerIcon("preferences", "grid-preferences", this);
|
|
46 |
IconThemeHelper.registerIcon("preferences", "layer-order-preferences", this);
|
|
42 |
IconThemeHelper.registerIcon("preferences", "grid-preferences", this);
|
|
43 |
IconThemeHelper.registerIcon("preferences", "layer-order-preferences", this);
|
|
47 | 44 |
} |
48 | 45 |
|
49 | 46 |
public void execute(String s) { |
50 |
DefaultViewPanel vista = (DefaultViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
51 |
ViewDocument model = vista.getModel(); |
|
47 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
52 | 48 |
|
53 |
if (s.equalsIgnoreCase("view-properties") ) { |
|
54 |
DefaultViewDocument viewModel = (DefaultViewDocument)model; |
|
55 |
if (viewModel != null) { |
|
56 |
ViewProperties viewProperties = new ViewProperties(viewModel); |
|
57 |
PluginServices.getMDIManager().addWindow(viewProperties); |
|
58 |
if (viewProperties.isAcceppted()) { |
|
59 |
viewModel.setModified(true); |
|
60 |
} |
|
61 |
} |
|
49 |
ViewDocument document = (ViewDocument) application.getActiveDocument(ViewDocument.class); |
|
50 |
if (document == null) { |
|
51 |
return; |
|
62 | 52 |
} |
53 |
if (s.equalsIgnoreCase("view-properties")) { |
|
54 |
ViewProperties viewProperties = new ViewProperties(document); |
|
55 |
application.getUIManager().addWindow(viewProperties); |
|
56 |
if (viewProperties.isAcceppted()) { |
|
57 |
document.setModified(true); |
|
58 |
} |
|
59 |
} |
|
63 | 60 |
} |
64 | 61 |
|
65 |
public boolean isEnabled() {
|
|
62 |
public boolean isEnabled() { |
|
66 | 63 |
return true; |
67 | 64 |
} |
68 | 65 |
|
69 |
/** |
|
70 |
* DOCUMENT ME! |
|
71 |
* |
|
72 |
* @return DOCUMENT ME! |
|
73 |
*/ |
|
74 | 66 |
public boolean isVisible() { |
75 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
|
|
76 |
.getActiveWindow(); |
|
77 |
return (f!=null && f instanceof DefaultViewPanel);
|
|
67 |
ApplicationManager application = ApplicationLocator.getManager();
|
|
68 |
|
|
69 |
return application.getActiveDocument(ViewDocument.class) != null;
|
|
78 | 70 |
} |
79 | 71 |
|
80 | 72 |
public IPreference[] getPreferencesPages() { |
81 |
return new IPreference[] {vb, lo_page};
|
|
73 |
return new IPreference[]{vb, lo_page};
|
|
82 | 74 |
} |
83 | 75 |
} |
Also available in: Unified diff