Statistics
| Revision:

root / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / plugins / Extension.java @ 38564

History | View | Annotate | Download (4.4 KB)

1 29593 jpiera
package org.gvsig.andami.plugins;
2 12697 cesar
3 36709 jjdelcerro
import org.gvsig.andami.PluginServices;
4 34818 nfrancisco
import org.gvsig.andami.PluginsLocator;
5 29593 jpiera
import org.gvsig.andami.plugins.status.IExtensionStatus;
6 38564 jjdelcerro
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
8 12697 cesar
9 1104 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11 11909 cesar
 * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
12 1104 fjp
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49 5005 jorpiell
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53 13713 caballero
 * Revision 1.12  2007-09-17 06:33:34  caballero
54
 * unsaveddata
55
 *
56
 * Revision 1.11  2007/07/19 12:01:06  cesar
57 12697 cesar
 * Add support for the new Andami termination process (and the unsaved data dialog)
58
 *
59
 * Revision 1.10  2007/05/31 07:42:17  cesar
60 11910 cesar
 * Add ExclusiveUIExtension interface and clean the IExtension interface; update Extension, ExtensionDecorator and Launcher to reflect this change; add missing comments, translate existing ones to english
61
 *
62
 * Revision 1.9  2007/05/31 07:00:47  cesar
63 11909 cesar
 * Add missing comments, translate existing ones to english
64
 *
65
 * Revision 1.8  2006/11/27 11:33:05  jmvivo
66 8991 jmvivo
 * Soporte para que una clase tenga el control de la visibilidad y estado de las acciones del resto de extensiones.
67
 *
68
 * Revision 1.7  2006/09/15 10:39:18  caballero
69 7303 caballero
 * multisplah y postInitialize
70
 *
71
 * Revision 1.6  2006/07/31 18:22:13  cesar
72 6586 cesar
 * Rename finalize method to terminate method
73
 *
74
 * Revision 1.5  2006/05/02 15:53:06  jorpiell
75 5005 jorpiell
 * Se ha cambiado la interfaz Extension por dos clases: una interfaz (IExtension) y una clase abstract(Extension). A partir de ahora todas las extensiones deben heredar de Extension
76
 *
77
 *
78
 */
79 598 fernando
/**
80 11909 cesar
 * Extensions are the way in which plugins extend Andami. Extensions
81
 * can add controls to user interface (GUI) and execute some code
82
 * when controls are activated. Every class implementing
83
 * {@link IExtension} is an extension, but directly implementing
84
 * that interface is discouraged. The preferred way to create
85
 * an extension is extending this absctract class.
86 13713 caballero
 *
87 11909 cesar
 * @see IExtension
88 7303 caballero
 *
89 5005 jorpiell
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
90 598 fernando
 */
91 38564 jjdelcerro
public abstract class Extension implements IExtension, IExtensionQueryByAction, IExtensionExecuteWithArgs  {
92 7303 caballero
93 38564 jjdelcerro
        private static Logger logger = LoggerFactory.getLogger(Extension.class);
94 5005 jorpiell
        /*
95
         *  (non-Javadoc)
96 11909 cesar
         * @see com.iver.andami.plugins.IExtension#terminate()
97 5005 jorpiell
         */
98 6586 cesar
        public void terminate(){
99 7303 caballero
100 5005 jorpiell
        }
101 7303 caballero
        /*
102
         *  (non-Javadoc)
103 11909 cesar
         * @see com.iver.andami.plugins.IExtension#postInitialize()
104 7303 caballero
         */
105
        public void postInitialize(){
106 598 fernando
107 7303 caballero
        }
108 13713 caballero
109 12697 cesar
    /*
110
         *  (non-Javadoc)
111
         * @see com.iver.andami.plugins.IExtension#getStatus()
112
         */
113
    public IExtensionStatus getStatus() {
114
            return null;
115
    }
116 13713 caballero
117
        /*
118
         *  (non-Javadoc)
119
         * @see com.iver.andami.plugins.IExtension#getStatus(IExtension extension)
120
         */
121
        public IExtensionStatus getStatus(IExtension extension) {
122
                return extension.getStatus();
123
        }
124 34818 nfrancisco
125
        public String getText(String msg) {
126
            return PluginsLocator.getManager().getText(this, msg);
127
        }
128 36709 jjdelcerro
129
        public PluginServices  getPlugin() {
130
                return PluginsLocator.getManager().getPlugin(this.getClass());
131
        }
132
133 38564 jjdelcerro
        public boolean isEnabled(String action) {
134
                return isEnabled();
135
        }
136
137
        public boolean isVisible(String action) {
138
                return isVisible();
139
        }
140
141
        public boolean canQueryByAction() {
142
                return false;
143
        }
144
145
        public void execute(String command, Object[] args) {
146
                if( args!= null && args.length>0 ) {
147
                        logger.info("callong execute with args in a extension that not support ("+this.getClass().getSimpleName()+").");
148
                }
149
                execute(command);
150
        }
151 598 fernando
}