root / branches / v10 / frameworks / _fwAndami / src / com / iver / andami / plugins / IExtension.java @ 13656
History | View | Annotate | Download (5.83 KB)
1 | 5005 | jorpiell | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | 12581 | 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 | package com.iver.andami.plugins; |
||
42 | |||
43 | 12574 | cesar | import com.iver.andami.plugins.status.IExtensionStatus; |
44 | |||
45 | 5005 | jorpiell | /**
|
46 | * <p>
|
||
47 | 11908 | 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 | 11907 | cesar | * 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 | 11907 | 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 | 11907 | 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 | 11907 | 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 | 13656 | caballero | * <p>
|
76 | 11907 | 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 | 13656 | caballero | * but they should extend the <code>Extension</code> abstract class.
|
84 | 11907 | cesar | * </p>
|
85 | 13656 | caballero | *
|
86 | 11907 | cesar | * @see Extension
|
87 | 5005 | jorpiell | */
|
88 | public interface IExtension { |
||
89 | /**
|
||
90 | 11907 | cesar | * Extension's initialization code should be here.
|
91 | * This method is called for all the extensions during
|
||
92 | * Andami's initialization.
|
||
93 | 5005 | jorpiell | */
|
94 | public void initialize(); |
||
95 | |||
96 | /**
|
||
97 | 11907 | cesar | * Extension's post-initialization code should be here.
|
98 | * This method is called for all the extensions during
|
||
99 | * Andami's initialization, after <code>initialize()</code>
|
||
100 | * has been called for ALL the extensions.
|
||
101 | 8765 | jjdelcerro | */
|
102 | public void postInitialize(); |
||
103 | /**
|
||
104 | 11907 | 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 | 8765 | jjdelcerro | |
110 | 5005 | jorpiell | /**
|
111 | 11907 | 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 | 11907 | 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 | 11907 | 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 | 11907 | cesar | * @return true if the extension should be enabled, false otherwise
|
127 | 5005 | jorpiell | */
|
128 | public boolean isEnabled(); |
||
129 | |||
130 | /**
|
||
131 | 11907 | 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 | 11907 | cesar | * @return true if the extension should be visible, false otherwise
|
135 | 5005 | jorpiell | */
|
136 | public boolean isVisible(); |
||
137 | 13656 | caballero | |
138 | 9321 | jmvivo | /**
|
139 | 11907 | cesar | * This method is used when this extension is installed as
|
140 | * ExclusiveUIExtension. This extension will be asked for
|
||
141 | * each installed extension to determine which of them
|
||
142 | * should be enabled.
|
||
143 | 13656 | caballero | *
|
144 | 11907 | cesar | * @return true if the provided extension should be enabled,
|
145 | * false if it should be disabled.
|
||
146 | 9321 | jmvivo | */
|
147 | public boolean isEnabled(IExtension extension); |
||
148 | |||
149 | /**
|
||
150 | 11907 | cesar | * This method is used when this extension is installed as
|
151 | * ExclusiveUIExtension. This extension will be asked for
|
||
152 | * each installed extension to determine which of them
|
||
153 | * should be visible.
|
||
154 | 13656 | caballero | *
|
155 | 11907 | cesar | * @return true if the provided extension should be visible,
|
156 | * false if it should be hidden.
|
||
157 | 11909 | cesar | */
|
158 | public boolean isVisible(IExtension extension); |
||
159 | 13656 | caballero | |
160 | 12581 | cesar | /**
|
161 | * Gets the status of the extension, which may be queried to check
|
||
162 | * if the extension has some unsaved data or some associated background
|
||
163 | * tasks.
|
||
164 | 13656 | caballero | *
|
165 | 12581 | cesar | * @see IExtensionStatus
|
166 | * @return An IExtensionStatus object, containing the status of this
|
||
167 | * extension.
|
||
168 | */
|
||
169 | 12574 | cesar | public IExtensionStatus getStatus();
|
170 | 13656 | caballero | public IExtensionStatus getStatus(IExtension extension);
|
171 | 5005 | jorpiell | } |