KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > agent > client > AgentClientGUI


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
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
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.agent.client;
21
22 import com.maverick.http.AuthenticationPrompt;
23 import com.maverick.http.HttpAuthenticator;
24
25 /**
26  * In order to be able to control the <i>Agent</i>, a <i>GUI</i> must be
27  * available. The actual implementation of the GUI may vary from platform to
28  * platform. For example, on Windows the <i>SystemTrayGUI</i> is used which
29  * adds new actions to the tray area. Currently, all ofther platforms use the
30  * <i>BasicFrameGUI</i>
31  *
32  * @author Lee David Painter <a HREF="mailto: lee@3sp.com">&lt;lee@3sp.com&gt;</a>
33  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
34  */

35 public interface AgentClientGUI extends AuthenticationPrompt {
36
37     /**
38      * Dialog type of information
39      */

40     public static final int INFORMATION = 0;
41
42     /**
43      * Dialog type of question
44      */

45     public static final int QUESTION = 1;
46
47     /**
48      * Dialog type of warning
49      */

50     public static final int WARNING = 2;
51
52     /**
53      * Dialog type of error
54      */

55     public static final int ERROR = 3;
56
57     /**
58      * Initialise the GUI. The provided listener should have
59      * its methods invoked to control the client.
60      *
61      * @param agent agent
62      */

63     public void init(Agent agent);
64
65     /**
66      * The client is now idle, update the GUI component to
67      * reflect this.
68      */

69     public void showIdle();
70
71     /**
72      * The client is now disconnected, update the GUI component to
73      * reflect this.
74      */

75     public void showDisconnected();
76
77
78     /**
79      * The client is now transmitting data, update the GUI component to
80      * reflect this.
81      */

82     public void showTx();
83
84
85     /**
86      * The client is now receiving data, update the GUI component to
87      * reflect this.
88      */

89     public void showRx();
90
91
92     /**
93      * The client is now transmitting and receving, update the GUI component to
94      * reflect this.
95      */

96     public void showTxRx();
97
98
99     /**
100      * Set the information text
101      *
102      * @param info information text
103      */

104     public void setInfo(String JavaDoc info);
105
106     /**
107      * Display a confirmation dialog.
108      *
109      * @param dialogType (see {@link #INFORMATION}, {@link #ERROR}, {@link #QUESTION} and {@link #WARNING} constants
110      * @param okText text for OK button
111      * @param cancelText text for Cancel button or <code>null</code> to omit the cancel button
112      * @param title title
113      * @param message message
114      * @return ok pressed
115      */

116     public boolean confirm(int dialogType, String JavaDoc okText, String JavaDoc cancelText, String JavaDoc title, String JavaDoc message);
117     
118
119     /**
120      * Display an error dialog
121      *
122      * @param okText text for OK button
123      * @param cancelText text for Cancel button or <code>null</code> to omit the cancel button
124      * @param title title
125      * @param message message
126      * @param ex exception
127      * @return ok pressed
128      */

129     public boolean error(String JavaDoc okText, String JavaDoc cancelText, String JavaDoc title, String JavaDoc message, Throwable JavaDoc ex);
130
131     /**
132      * Popup a new message.
133      *
134      * @param callback callback invoked if message is click
135      * @param message message text
136      * @param title message title
137      * @param image message image
138      * @param timeout time for message to stay visible
139      */

140     public void popup(ActionCallback callback, String JavaDoc message, String JavaDoc title, String JavaDoc imageName, int timeout);
141     
142     /**
143      * Create and display new task progress monitor
144      */

145     public TaskProgress createTaskProgress(String JavaDoc message, String JavaDoc note, long maxValue, boolean allowCancel);
146     
147     /**
148      * Get the port monitor
149      *
150      * @return port monitor
151      */

152     public PortMonitor getPortMonitor();
153     
154     /**
155      * Get the debug console
156      *
157      * @return console
158      */

159     public Console getConsole();
160
161     /**
162      * Prompt for HTTP credentials.
163      *
164      * @param proxy authentication is for proxy
165      * @param authenticator authenticator
166      * @return ok
167      */

168     public boolean promptForCredentials(boolean proxy, HttpAuthenticator authenticator);
169     
170     /**
171      * Dispose of the GUI
172      */

173     public void dispose();
174
175     /**
176      * Add a new submenu to the root menu.
177      *
178      * @param name name
179      */

180     public void addMenu(final String JavaDoc name);
181
182     /**
183      * Remove a submenu from the root menu.
184      *
185      * @param name name
186      */

187     public void removeMenu(String JavaDoc name);
188
189     /**
190      * Clear all items from a menu
191      *
192      * @param name name
193      */

194     public void clearMenu(String JavaDoc name);
195
196     /**
197      * Get if a root menu exists
198      *
199      * @param name name
200      * @return menu exists
201      */

202     public boolean isMenuExists(String JavaDoc name);
203
204     /**
205      * Add a new action to the GUI's menu. The action text may be
206      * retrieved from {@link AgentAction#getAction()},
207      * {@link AgentAction#actionPerformed()} must be
208      * invoked to perform the action. The item may be added to
209      * add sub-menu (see {@link #addMenu(String)} if the parentName
210      * argument is not null.
211      *
212      * @param parentName sub-menu to add to or <code>null</code> to add to parent
213      * @param action action to add
214      */

215     public void addMenuItem(final String JavaDoc parentName, final AgentAction action);
216
217     /**
218      * Add a separator the GUI's menu. The item may be added to
219      * add sub-menu (see {@link #addMenu(String)} if the parentName
220      * argument is not null.
221      *
222      * @param parentName sub-menu to add to or <code>null</code> to add to parent
223      */

224     public void addMenuSeperator(final String JavaDoc parentName);
225     
226     /**
227      * Open the system browser, optionally to the specified path. The
228      * protocol, host and port elements of the URL will automatically
229      * be created and prepend to any supplied path. If path is <code>null</code>
230      * then the browser will just be opened and pointed to the SSL-Explorer
231      * index page.
232      *
233      * @param path path
234      */

235     public void openBrowser(String JavaDoc path);
236     
237     
238 }
Popular Tags