KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > application > ThickClientGui


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: ThickClientGui.java,v 1.6 2007/01/07 06:14:39 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.application;
23
24 import java.util.Map JavaDoc;
25
26 import org.opensubsystems.core.error.OSSException;
27
28 /**
29  * Interface specifying methods that needs to be implemented by specific gui
30  * technology such as SWT or AWT for the thick client to function.
31  *
32  * @version $Id: ThickClientGui.java,v 1.6 2007/01/07 06:14:39 bastafidli Exp $
33  * @author Miro Halas
34  * @code.reviewer Miro Halas
35  * @code.reviewed 1.4 2006/02/04 04:48:52 bastafidli
36  */

37 public interface ThickClientGui
38 {
39    // Constants ////////////////////////////////////////////////////////////////
40

41    /**
42     * Display the GUI stretched to the whole screen (the default behavior).
43     */

44    int GUI_FULLSCREEN = 0;
45    
46    /**
47     * Display the GUI on the left screen (or left half of the whole screen).
48     */

49    int GUI_LEFTSCREEN = 1;
50    
51    /**
52     * Display the GUI on the right screen (or right half of the whole screen).
53     */

54    int GUI_RIGHTSCREEN = 2;
55
56    /**
57     * The GUI can be displayed anywhere on the screen.
58     */

59    int GUI_ANYWHERE = 3;
60       
61    /**
62     * Flags required to display message with yes/no question.
63     */

64    String JavaDoc MESSAGE_STYLE_YES_NO_QUESTION = "YesNoMessage";
65    
66    /**
67     * Flags required to display error message.
68     */

69    String JavaDoc MESSAGE_STYLE_ERROR = "ErrorMessage";
70
71    /**
72     * Flags required to display information message.
73     */

74    String JavaDoc MESSAGE_STYLE_INFO = "InfoMessage";
75
76    /**
77     * Answer for the MESSAGE_STYLE_YES_NO_QUESTION dialog
78     */

79    String JavaDoc MESSAGE_ANSWER_YES = "Yes";
80    
81    /**
82     * Title to use for question messages.
83     */

84    String JavaDoc MESSAGE_TITLE_QUESTION = "Question";
85    
86    /**
87     * Title to use for question messages.
88     */

89    String JavaDoc MESSAGE_TITLE_ERROR = "Error";
90
91    /**
92     * Title to use for information messages.
93     */

94    String JavaDoc MESSAGE_TITLE_INFO = "Information";
95
96    // Public methods ///////////////////////////////////////////////////////////
97

98    /**
99     * Initialize the gui for a give client
100     *
101     * @param client - client to initialize the gui for
102     */

103    void init(
104       ThickClient client
105    );
106    
107    /**
108     * Initialize any resources which are required by gui. These resources
109     * are usually required to be created only once and then can be reused
110     * over and over. This method doesn't do any cleanup in case of problems.
111     * Regardless if this method suceeds or fails, caller is responsible for
112     * calling destroyDisplayResources in finally clause.
113     *
114     * @param bHideCursor - hide cursor since it might be distracting
115     */

116    void createDisplayResources(
117       boolean bHideCursor
118    );
119
120    /**
121     * Release resources allocated by GUI. This releases resources allocated
122     * in createDisplayResources and any global resources.
123     */

124    void destroyDisplayResources(
125    );
126
127    /**
128     * Create the main window of the application with all the default elements,
129     * such as toolbar and main client area.
130     */

131    void createMainWindow(
132    );
133
134    /**
135     * Destroy all resources allocated when main window was created. This
136     * must be called in finally clause of try block where createMainWindow
137     * was called.
138     */

139    void destroyMainWindow(
140    );
141
142    /**
143     * Create client area of the application.
144     */

145    void createClientArea(
146    );
147
148    /**
149     * Release and destroy resources allocated for the client area. This
150     * must be called in finally clause of try block where createMainArea
151     * was called.
152     */

153    void destroyClientArea(
154    );
155
156    /**
157     * Display the main application window. This method should be called when
158     * the application is ready to be displayed on the screen and interact with
159     * the user.
160     *
161     * @param iScreenPosition - screen position where to display the gui
162     * @param bFixedSize - should the gui be fixed size
163     */

164    void displayMainWindow(
165       int iScreenPosition,
166       boolean bFixedSize
167    );
168
169    /**
170     * Main message loop which processes messages for the application caused by
171     * user actions such as typing or mouse clicks.
172     */

173    void interactWithUser(
174    );
175    
176    /**
177     * Return String identifier for the GUI technology used by the instance of
178     * thick client.
179     *
180     * @return String - name of the GUI technology used for the thick client
181     */

182    String JavaDoc getGuiTechnology(
183    );
184    
185    /**
186     * Display message to user.
187     *
188     * @param strTitle - title of the message, look at constants in this interface
189     * @param strMessage - message to display
190     * @param additionalInfo - additional information to pass in, this may be
191     * implementation specific, look at constants in this
192     * interface
193     * @return Object - result of the message, this may be implementation
194     * specific
195     */

196    Object JavaDoc displayMessage(
197       String JavaDoc strTitle,
198       String JavaDoc strMessage,
199       Object JavaDoc additionalInfo
200    );
201
202    /**
203     * Create graphical representation of specified modules
204     *
205     * @param mapModules - key is module identification and value is the module
206     * itself (ThickClientModule).
207     * @throws OSSException - an error has occured
208     */

209    void createModules(
210       Map JavaDoc mapModules
211    ) throws OSSException;
212
213    /**
214     * Destroy graphical representation of specified modules
215     *
216     * @param mapModules - key is module identification and value is the module
217     * itself (ThickClientModule).
218     */

219    void destroyModules(
220       Map JavaDoc mapModules
221    );
222
223    /**
224     * Pasivate the specified module so that it is not available for user
225     * interaction anymore.
226     *
227     * @param module - module to pasivate
228     */

229    void pasivateModule(
230       ThickClientModule module
231    );
232
233    /**
234     * Activate specified module so that it is available for user interaction.
235     *
236     * @param module - module to activate
237     */

238    void activateModule(
239       ThickClientModule module
240    );
241 }
242
Popular Tags