Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / ViewPropertiesExtension.java @ 28407

History | View | Annotate | Download (4.23 KB)

1 2523 caballero
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
42
 *
43
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
44
 *
45
 * This program is free software; you can redistribute it and/or
46
 * modify it under the terms of the GNU General Public License
47
 * as published by the Free Software Foundation; either version 2
48
 * of the License, or (at your option) any later version.
49
 *
50
 * This program is distributed in the hope that it will be useful,
51
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
52
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
53
 * GNU General Public License for more details.
54
 *
55
 * You should have received a copy of the GNU General Public License
56
 * along with this program; if not, write to the Free Software
57
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
58
 *
59
 * For more information, contact:
60
 *
61
 *  Generalitat Valenciana
62
 *   Conselleria d'Infraestructures i Transport
63
 *   Av. Blasco Ib??ez, 50
64
 *   46010 VALENCIA
65
 *   SPAIN
66
 *
67
 *      +34 963862235
68
 *   gvsig@gva.es
69
 *      www.gvsig.gva.es
70
 *
71
 *    or
72
 *
73
 *   IVER T.I. S.A
74
 *   Salamanca 50
75
 *   46005 Valencia
76
 *   Spain
77
 *
78
 *   +34 963163400
79
 *   dac@iver.es
80
 */
81
package com.iver.cit.gvsig;
82
83
import com.iver.andami.PluginServices;
84
import com.iver.andami.plugins.Extension;
85 13727 jaume
import com.iver.andami.preferences.IPreference;
86
import com.iver.andami.preferences.IPreferenceExtension;
87
import com.iver.cit.gvsig.gui.preferencespage.ViewBehaviorPage;
88 7392 sbayarri
import com.iver.cit.gvsig.project.documents.view.IProjectView;
89 7304 caballero
import com.iver.cit.gvsig.project.documents.view.ProjectView;
90
import com.iver.cit.gvsig.project.documents.view.gui.View;
91
import com.iver.cit.gvsig.project.documents.view.gui.ViewProperties;
92 2523 caballero
93
94
/**
95
 * DOCUMENT ME!
96
 *
97
 * @author Vicente Caballero Navarro
98
 */
99 13727 jaume
public class ViewPropertiesExtension extends Extension implements IPreferenceExtension {
100
        private ViewBehaviorPage vb = new ViewBehaviorPage();
101 5005 jorpiell
    public void initialize() {
102 2523 caballero
    }
103
104
    public void execute(String s) {
105 6880 cesar
        View vista = (View) PluginServices.getMDIManager().getActiveWindow();
106 7392 sbayarri
        IProjectView model = vista.getModel();
107 2523 caballero
108
        if (s.compareTo("PROPERTIES") == 0) {
109 7392 sbayarri
                ProjectView viewModel = (ProjectView)model;
110
                if (viewModel != null) {
111
              ViewProperties viewProperties = new ViewProperties(viewModel);
112
              PluginServices.getMDIManager().addWindow(viewProperties);
113 9532 caballero
              if (viewProperties.isAcceppted()) {
114
                      viewModel.setModified(true);
115
              }
116 7392 sbayarri
                }
117 2523 caballero
        }
118
    }
119
120 13727 jaume
     public boolean isEnabled() {
121 2523 caballero
        return true;
122
    }
123
124
    /**
125
     * DOCUMENT ME!
126
     *
127
     * @return DOCUMENT ME!
128
     */
129
    public boolean isVisible() {
130 6877 cesar
        com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
131 6880 cesar
                                                             .getActiveWindow();
132 2523 caballero
        if (f == null) {
133
            return false;
134
        }
135 5900 jorpiell
        return (f instanceof View);
136 2523 caballero
    }
137 13727 jaume
138
    public IPreference[] getPreferencesPages() {
139
            return new IPreference[] {vb};
140
    }
141 2523 caballero
}