Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IViewManager |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.view.able; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque 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 JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import org.jtheque.core.managers.error.JThequeError; | |
20 | import org.jtheque.core.managers.view.ViewComponent; | |
21 | import org.jtheque.core.managers.view.Views; | |
22 | import org.jtheque.core.managers.view.able.components.StateBarComponent; | |
23 | import org.jtheque.core.managers.view.able.components.TabComponent; | |
24 | import org.jtheque.core.managers.view.edt.SimpleTask; | |
25 | import org.jtheque.core.managers.view.edt.Task; | |
26 | import org.jtheque.core.managers.view.impl.WindowsConfiguration; | |
27 | import org.jtheque.core.managers.view.impl.components.config.ConfigTabComponent; | |
28 | import org.jtheque.core.managers.view.listeners.ConfigTabListener; | |
29 | import org.jtheque.core.managers.view.listeners.StateBarListener; | |
30 | import org.jtheque.core.managers.view.listeners.TabListener; | |
31 | import org.jtheque.utils.io.SimpleFilter; | |
32 | ||
33 | import java.util.Collection; | |
34 | ||
35 | /** | |
36 | * A view manager. | |
37 | * | |
38 | * @author Baptiste Wicht | |
39 | */ | |
40 | public interface IViewManager { | |
41 | /** | |
42 | * Return the manager responsible of the splash screen. | |
43 | * | |
44 | * @return The manager responsible of the splash screen. | |
45 | */ | |
46 | ISplashManager getSplashManager(); | |
47 | ||
48 | /** | |
49 | * Add a state bar component. | |
50 | * | |
51 | * @param component The component to add to the state bar. | |
52 | */ | |
53 | void addStateBarComponent(StateBarComponent component); | |
54 | ||
55 | /** | |
56 | * Remove the specified state bar component. | |
57 | * | |
58 | * @param component The component to remove of to the state bar. | |
59 | */ | |
60 | void removeStateBarComponent(StateBarComponent component); | |
61 | ||
62 | /** | |
63 | * Add a state bar listener. | |
64 | * | |
65 | * @param listener The listener to add. | |
66 | */ | |
67 | void addStateBarListener(StateBarListener listener); | |
68 | ||
69 | /** | |
70 | * Remove a state bar listener. | |
71 | * | |
72 | * @param listener The listener to remove. | |
73 | */ | |
74 | void removeStateBarListener(StateBarListener listener); | |
75 | ||
76 | /** | |
77 | * Return all the state bar components. | |
78 | * | |
79 | * @return A List containing all the state bar components. | |
80 | */ | |
81 | Collection<StateBarComponent> getStateBarComponents(); | |
82 | ||
83 | /** | |
84 | * Return all the tab components. | |
85 | * | |
86 | * @return A List containing all the tab components. | |
87 | */ | |
88 | Collection<TabComponent> getTabComponents(); | |
89 | ||
90 | /** | |
91 | * Add a tab component. | |
92 | * | |
93 | * @param component The tab to add. | |
94 | */ | |
95 | void addTabComponent(TabComponent component); | |
96 | ||
97 | /** | |
98 | * Remove a tab component. | |
99 | * | |
100 | * @param component The tab to remove. | |
101 | */ | |
102 | void removeTabComponent(TabComponent component); | |
103 | ||
104 | /** | |
105 | * Ask user for confirmation. | |
106 | * | |
107 | * @param text The question. | |
108 | * @param title The title. | |
109 | * @return true if the user has accepted else false. | |
110 | */ | |
111 | boolean askUserForConfirmation(String text, String title); | |
112 | ||
113 | /** | |
114 | * Ask the user for confirmation with internationalized message. | |
115 | * | |
116 | * @param textKey The question key. | |
117 | * @param titleKey The title key. | |
118 | * @return true if the user has accepted else false. | |
119 | */ | |
120 | boolean askI18nUserForConfirmation(String textKey, String titleKey); | |
121 | ||
122 | /** | |
123 | * Ask the user for a text. | |
124 | * | |
125 | * @param text The text prompt. | |
126 | * @return The text of the user. | |
127 | */ | |
128 | String askUserForText(String text); | |
129 | ||
130 | /** | |
131 | * Display a text. | |
132 | * | |
133 | * @param text The text to display. | |
134 | */ | |
135 | void displayText(String text); | |
136 | ||
137 | /** | |
138 | * Display an error. | |
139 | * | |
140 | * @param error The error to display. | |
141 | */ | |
142 | void displayError(JThequeError error); | |
143 | ||
144 | /** | |
145 | * Display a internationalized. | |
146 | * | |
147 | * @param key The internationalization key. | |
148 | */ | |
149 | void displayI18nText(String key); | |
150 | ||
151 | /** | |
152 | * Choose a file. | |
153 | * | |
154 | * @param filter A file filter. | |
155 | * @return The path to the selected file. | |
156 | */ | |
157 | String chooseFile(SimpleFilter filter); | |
158 | ||
159 | /** | |
160 | * Choose a directory. | |
161 | * | |
162 | * @return The path to the selected directory. | |
163 | */ | |
164 | String chooseDirectory(); | |
165 | ||
166 | /** | |
167 | * Add config tab component. | |
168 | * | |
169 | * @param component The config tab component to add. | |
170 | */ | |
171 | void addConfigTabComponent(ConfigTabComponent component); | |
172 | ||
173 | /** | |
174 | * Remove the specified config tab component. | |
175 | * | |
176 | * @param component The config tab component to remove. | |
177 | */ | |
178 | void removeConfigTabComponent(ConfigTabComponent component); | |
179 | ||
180 | /** | |
181 | * Add a ConfigTabListener. | |
182 | * | |
183 | * @param listener The listener to add. | |
184 | */ | |
185 | void addConfigTabListener(ConfigTabListener listener); | |
186 | ||
187 | /** | |
188 | * Remove the specified ConfigTabListener. | |
189 | * | |
190 | * @param listener The listener to remove. | |
191 | */ | |
192 | void removeConfigTabListener(ConfigTabListener listener); | |
193 | ||
194 | /** | |
195 | * Add a TabListener. | |
196 | * | |
197 | * @param listener The listener to add. | |
198 | */ | |
199 | void addTabListener(TabListener listener); | |
200 | ||
201 | /** | |
202 | * Remove the specified TabListener. | |
203 | * | |
204 | * @param listener The listener to remove. | |
205 | */ | |
206 | void removeTabListener(TabListener listener); | |
207 | ||
208 | /** | |
209 | * Return all the config tab components. | |
210 | * | |
211 | * @return A List containing all the config tab components. | |
212 | */ | |
213 | Collection<ConfigTabComponent> getConfigTabComponents(); | |
214 | ||
215 | /** | |
216 | * Return the Views. It seems the class responsible for managing the different views. | |
217 | * | |
218 | * @return The Views object. | |
219 | */ | |
220 | Views getViews(); | |
221 | ||
222 | /** | |
223 | * Return all window configuration. | |
224 | * | |
225 | * @return A configuration who encapsulate the configuration of different views. | |
226 | */ | |
227 | WindowsConfiguration getConfigurations(); | |
228 | ||
229 | /** | |
230 | * Execute a task in the EDT. | |
231 | * | |
232 | * @param task The task to execute. | |
233 | */ | |
234 | void execute(SimpleTask task); | |
235 | ||
236 | /** | |
237 | * Execute a task in the EDT. | |
238 | * | |
239 | * @param <T> The type of return. | |
240 | * @param task The task to execute. | |
241 | * @return The result of the task. | |
242 | */ | |
243 | <T> T execute(Task<T> task); | |
244 | ||
245 | /** | |
246 | * Refresh the component. | |
247 | * | |
248 | * @param c The component to refresh. | |
249 | */ | |
250 | void refresh(Object c); | |
251 | ||
252 | /** | |
253 | * Set the main component of the main view. | |
254 | * | |
255 | * @param component The main component of the main view. | |
256 | */ | |
257 | void setMainComponent(ViewComponent component); | |
258 | ||
259 | /** | |
260 | * Remove the main component of the main view. | |
261 | * | |
262 | * @param component The main component to remove. | |
263 | */ | |
264 | void removeMainComponent(ViewComponent component); | |
265 | ||
266 | /** | |
267 | * Indicate if the tab is the main component or not. | |
268 | * | |
269 | * @return true if the tab is the main component else false. | |
270 | */ | |
271 | boolean isTabMainComponent(); | |
272 | ||
273 | /** | |
274 | * Return the main component. | |
275 | * | |
276 | * @return The main component. | |
277 | */ | |
278 | ViewComponent getMainComponent(); | |
279 | ||
280 | /** | |
281 | * Display the about view. | |
282 | */ | |
283 | void displayAboutView(); | |
284 | ||
285 | /** | |
286 | * Display the choose collection view. | |
287 | */ | |
288 | void displayCollectionView(); | |
289 | ||
290 | /** | |
291 | * Return the collection view. | |
292 | * | |
293 | * @return The collection view. | |
294 | */ | |
295 | ICollectionView getCollectionView(); | |
296 | ||
297 | /** | |
298 | * Return the view defaults. | |
299 | * | |
300 | * @return The view defaults. | |
301 | */ | |
302 | ViewDefaults getViewDefaults(); | |
303 | ||
304 | /** | |
305 | * Save the current state of the window. | |
306 | * | |
307 | * @param window The window. | |
308 | * @param name The name of the view. | |
309 | */ | |
310 | void saveState(IView window, String name); | |
311 | ||
312 | /** | |
313 | * Configure a view. It seems sets the size and location of the view. | |
314 | * | |
315 | * @param window The window to configure. | |
316 | * @param name The name of the view. | |
317 | * @param defaultWidth The default width of the view. | |
318 | * @param defaultHeight The default height of the view. | |
319 | */ | |
320 | void configureView(IView window, String name, int defaultWidth, int defaultHeight); | |
321 | ||
322 | /** | |
323 | * Return the delegate view manager. | |
324 | * | |
325 | * @return The delegate view manager. | |
326 | */ | |
327 | ViewDelegate getViewDelegate(); | |
328 | } |