svn-gvsig-desktop / branches / v2_0_0_prep / frameworks / _fwAndami / src / org / gvsig / andami / plugins / IExtension.java @ 38094
History | View | Annotate | Download (5.07 KB)
1 | 5005 | jorpiell | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | 11909 | cesar | * Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
|
4 | 5005 | jorpiell | *
|
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 | 29593 | jpiera | package org.gvsig.andami.plugins; |
42 | 5005 | jorpiell | |
43 | 29593 | jpiera | import org.gvsig.andami.plugins.status.IExtensionStatus; |
44 | 12697 | cesar | |
45 | 5005 | jorpiell | /**
|
46 | * <p>
|
||
47 | 11909 | cesar | * Extensions are the way in which plugins extend Andami. Every class
|
48 | * implementing this interface is an extension (although this class
|
||
49 | * should not be directly implemented, extending the {@link Extension}
|
||
50 | * abstract class is the preferred way). During startup,
|
||
51 | * Andami creates an instance from each extension. Extensions are able
|
||
52 | * to add controls (tools, toolbars and menus)
|
||
53 | * to the user interface (GUI); when these controls
|
||
54 | * are clicked or modified, Andami will call the <code>execute()</code>
|
||
55 | * method from the associated extension. Extensions will also control
|
||
56 | * whether their associated controls are enabled or not, and whether
|
||
57 | * they are visible or hidden.
|
||
58 | 5005 | jorpiell | * </p>
|
59 | * <p>
|
||
60 | 11909 | cesar | * Besides implementing this interface, extensions are required to have
|
61 | * an empty constructor, because it will be invoked to create the
|
||
62 | * extension's instance.
|
||
63 | 5005 | jorpiell | * </p>
|
64 | * <p>
|
||
65 | 11909 | cesar | * On correctly installed plugins, an instance of every plugin's
|
66 | * extension will be created. Then, the <code>initialize()</code>
|
||
67 | * method will be executed for each extension.
|
||
68 | 5005 | jorpiell | * </p>
|
69 | 11909 | cesar | * <p>
|
70 | * Each time the active window is switched and every time the execute
|
||
71 | * method is called, Andami checks the <code>isEnabled()</code> and
|
||
72 | * <code>isVisible()</code> for each extension, to decide whether
|
||
73 | * they will be enabled and visible.
|
||
74 | * </p>
|
||
75 | 13713 | caballero | * <p>
|
76 | 11909 | cesar | * The <code>execute()</code> method will be called from the GUI
|
77 | * thread, so it will block the GUI until it finishes. Therefore,
|
||
78 | * execution must be fast. If long process must be started from
|
||
79 | * the <code>execute</code> method, a new thread must be created.
|
||
80 | * </p>
|
||
81 | * <p>
|
||
82 | * Normally, extensions should not directly implement this interface,
|
||
83 | 13713 | caballero | * but they should extend the <code>Extension</code> abstract class.
|
84 | 11909 | cesar | * </p>
|
85 | 13713 | caballero | *
|
86 | 11909 | cesar | * @see Extension
|
87 | */public interface IExtension { |
||
88 | /**
|
||
89 | * Extension's initialization code should be here.
|
||
90 | * This method is called for all the extensions during
|
||
91 | * Andami's initialization.
|
||
92 | */
|
||
93 | public void initialize(); |
||
94 | 5005 | jorpiell | |
95 | 11909 | cesar | /**
|
96 | * Extension's post-initialization code should be here.
|
||
97 | * This method is called for all the extensions during
|
||
98 | * Andami's initialization, after <code>initialize()</code>
|
||
99 | * has been called for ALL the extensions.
|
||
100 | */
|
||
101 | 7303 | caballero | public void postInitialize(); |
102 | 13713 | caballero | |
103 | 7303 | caballero | /**
|
104 | 11909 | cesar | * Extension's termination code should be here.
|
105 | * This method is called for all the extensions during
|
||
106 | * Andami's termination.
|
||
107 | 5005 | jorpiell | */
|
108 | 6586 | cesar | public void terminate(); |
109 | 7303 | caballero | |
110 | 5005 | jorpiell | /**
|
111 | 11909 | cesar | * This method is executed when the user clicks on any of the
|
112 | * controls associated with this extension (menus, tools, etc).
|
||
113 | 5005 | jorpiell | *
|
114 | 11909 | cesar | * @param actionCommand An String specifying the action to
|
115 | * execute. This is useful when there are different
|
||
116 | * controls associated with the same extension.
|
||
117 | 5005 | jorpiell | */
|
118 | public void execute(String actionCommand); |
||
119 | |||
120 | /**
|
||
121 | 11909 | cesar | * This method is invoked by Andami to check whether the extension
|
122 | * (and its associated controls) is enabled or disabled.
|
||
123 | * Disabled controls (menus and buttons) are shown in light grey
|
||
124 | * colour, and it is not possible to click on them.
|
||
125 | 5005 | jorpiell | *
|
126 | 11909 | cesar | * @return true if the extension should be enabled, false otherwise
|
127 | 5005 | jorpiell | */
|
128 | public boolean isEnabled(); |
||
129 | |||
130 | /**
|
||
131 | 11909 | cesar | * This method is invoked by Andami to check whether the extension
|
132 | * (and its associated controls) is visible or hidden.
|
||
133 | 5005 | jorpiell | *
|
134 | 11909 | cesar | * @return true if the extension should be visible, false otherwise
|
135 | 5005 | jorpiell | */
|
136 | public boolean isVisible(); |
||
137 | 13713 | caballero | |
138 | 12697 | cesar | /**
|
139 | * Gets the status of the extension, which may be queried to check
|
||
140 | * if the extension has some unsaved data or some associated background
|
||
141 | * tasks.
|
||
142 | 13713 | caballero | *
|
143 | 12697 | cesar | * @see IExtensionStatus
|
144 | * @return An IExtensionStatus object, containing the status of this
|
||
145 | * extension.
|
||
146 | */
|
||
147 | public IExtensionStatus getStatus();
|
||
148 | 13713 | caballero | public IExtensionStatus getStatus(IExtension extension);
|
149 | 5005 | jorpiell | } |