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
package org.gvsig.andami.plugins;
2

    
3
import org.gvsig.andami.PluginServices;
4
import org.gvsig.andami.PluginsLocator;
5
import org.gvsig.andami.plugins.status.IExtensionStatus;
6
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
8

    
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
12
 *
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
/* CVS MESSAGES:
50
 *
51
 * $Id: Extension.java 38564 2012-07-16 11:19:13Z jjdelcerro $
52
 * $Log$
53
 * 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
 * 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
 * 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
 * Add missing comments, translate existing ones to english
64
 *
65
 * Revision 1.8  2006/11/27 11:33:05  jmvivo
66
 * 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
 * multisplah y postInitialize
70
 *
71
 * Revision 1.6  2006/07/31 18:22:13  cesar
72
 * Rename finalize method to terminate method
73
 *
74
 * Revision 1.5  2006/05/02 15:53:06  jorpiell
75
 * 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
/**
80
 * 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
 *
87
 * @see IExtension
88
 *
89
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
90
 */
91
public abstract class Extension implements IExtension, IExtensionQueryByAction, IExtensionExecuteWithArgs  {
92

    
93
        private static Logger logger = LoggerFactory.getLogger(Extension.class);
94
        /*
95
         *  (non-Javadoc)
96
         * @see com.iver.andami.plugins.IExtension#terminate()
97
         */
98
        public void terminate(){
99

    
100
        }
101
        /*
102
         *  (non-Javadoc)
103
         * @see com.iver.andami.plugins.IExtension#postInitialize()
104
         */
105
        public void postInitialize(){
106

    
107
        }
108

    
109
    /*
110
         *  (non-Javadoc)
111
         * @see com.iver.andami.plugins.IExtension#getStatus()
112
         */
113
    public IExtensionStatus getStatus() {
114
            return null;
115
    }
116

    
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
        
125
        public String getText(String msg) {
126
            return PluginsLocator.getManager().getText(this, msg);
127
        }
128
        
129
        public PluginServices  getPlugin() {
130
                return PluginsLocator.getManager().getPlugin(this.getClass());
131
        }
132

    
133
        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
}
152