Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / extension / ViewPropertiesExtension.java @ 29596

History | View | Annotate | Download (4.16 KB)

1
/* 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 org.gvsig.app.extension;
82

    
83
import org.gvsig.andami.PluginServices;
84
import org.gvsig.andami.plugins.Extension;
85
import org.gvsig.andami.preferences.IPreference;
86
import org.gvsig.andami.preferences.IPreferenceExtension;
87
import org.gvsig.app.gui.preferencespage.ViewBehaviorPage;
88
import org.gvsig.app.project.documents.view.IProjectView;
89
import org.gvsig.app.project.documents.view.ProjectView;
90
import org.gvsig.app.project.documents.view.gui.View;
91
import org.gvsig.app.project.documents.view.gui.ViewProperties;
92

    
93

    
94

    
95
/**
96
 * DOCUMENT ME!
97
 *
98
 * @author Vicente Caballero Navarro
99
 */
100
public class ViewPropertiesExtension extends Extension implements IPreferenceExtension {
101
        private ViewBehaviorPage vb = new ViewBehaviorPage();
102
    public void initialize() {
103
    }
104

    
105
    public void execute(String s) {
106
        View vista = (View) PluginServices.getMDIManager().getActiveWindow();
107
        IProjectView model = vista.getModel();
108

    
109
        if (s.compareTo("PROPERTIES") == 0) {
110
                ProjectView viewModel = (ProjectView)model;
111
                if (viewModel != null) {
112
              ViewProperties viewProperties = new ViewProperties(viewModel);
113
              PluginServices.getMDIManager().addWindow(viewProperties);
114
              if (viewProperties.isAcceppted()) {
115
                      viewModel.setModified(true);
116
              }
117
                }
118
        }
119
    }
120

    
121
     public boolean isEnabled() {
122
        return true;
123
    }
124

    
125
    /**
126
     * DOCUMENT ME!
127
     *
128
     * @return DOCUMENT ME!
129
     */
130
    public boolean isVisible() {
131
        org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
132
                                                             .getActiveWindow();
133
        return (f!=null && f instanceof View);
134
    }
135

    
136
    public IPreference[] getPreferencesPages() {
137
            return new IPreference[] {vb};
138
    }
139
}