KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > gui > GuiConf


1 /*
2   Copyright (C) 2001-2003 Renaud Pawlak <renaud@aopsys.com>,
3                           Laurent Martelli <laurent@aopsys.com>
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU Lesser General Public License as
7   published by the Free Software Foundation; either version 2 of the
8   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 Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser 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 package org.objectweb.jac.aspects.gui;
20
21 import org.objectweb.jac.core.rtti.*;
22
23 /**
24  * This is the configuration interface of the Gui aspect.
25  *
26  * @see GuiAC
27  * @see View
28  *
29  * @author <a HREF="mailto:renaud@cnam.fr">Renaud Pawlak</a>
30  * @author <a HREF="mailto:laurent@aopsys.com">Laurent Martelli</a>
31  */

32
33 public interface GuiConf
34     extends ClassAppearenceGuiConf, FieldAppearenceGuiConf,
35 MethodAppearenceGuiConf, BehaviorGuiConf {
36
37     /**
38      * Essential method for GUI, which weaves
39      * <code>InputWrapper.askForParameters</code> on all methods with
40      * parameters.
41      *
42      * <p>It permits to dynamically call methods, and so display
43      * something when user clicks on buttons.</p>
44      *
45      * @param classExpr the classes
46      */

47     void askForParameters(String JavaDoc classExpr);
48
49     /**
50      * This configuration method allows the user to create and register
51      * a new customized GUI.
52      *
53      * <p>A configuration file should first use this method, then
54      * configure the customized GUI, and then call the
55      * <code>showCustomized</code> method when the GUI configuration is
56      * finished.
57      *
58      * @param name the new customized GUI name
59      */

60     void registerCustomized(String JavaDoc name);
61
62     /**
63      * Sets the icon of the window
64      * @param gui the gui ID
65      * @param icon the name of the icon
66      */

67     void setCustomizedIcon(String JavaDoc gui, String JavaDoc icon);
68
69     /**
70      * Set an event handler which is called when the window is closed.
71      * @param gui the customized gui ID
72      * @param eventHandler the event handler
73      */

74     void setOnCloseHandler(String JavaDoc gui, AbstractMethodItem eventHandler);
75
76     /**
77      * Sets a welcome message (in a popup) when a customized GUI is
78      * started.
79      *
80      * @param gui the gui ID
81      * @param title the popup's title
82      * @param message the welcome message
83      * @param icon an icon (defined as a resource) placed before the
84      * message (can be null) */

85
86     void setWelcomeMessage(String JavaDoc gui,String JavaDoc title,
87                            String JavaDoc message,String JavaDoc icon);
88
89     /**
90      * This configuration method allows the programmer to actually show
91      * a status bar in a declared personal UI.
92      *
93      * @param gui the name of the customized GUI
94      * @param method the method that returns the text
95      * @param position UP||BOTTOM */

96
97     void addStatusBar( String JavaDoc gui, MethodItem method, String JavaDoc position );
98
99     /**
100      * This configuration method allows the programmer to actually show
101      * an empty status bar in a declared personal UI. The text should
102      * be set with the <code>showStatus</code> method.
103      *
104      * @param gui the name of the customized GUI
105      * @param position UP||BOTTOM
106      *
107      * @see #addStatusBar(String,MethodItem,String)
108      */

109     void addStatusBar( String JavaDoc gui, String JavaDoc position );
110
111     /**
112      * This configuration method delegates to
113      * <code>setSubPanesGeometry(int,int,String[])</code> with all the
114      * panes scrollable.
115      *
116      * <p>The GUI must have been declared.
117      *
118      * @param gui the GUI name
119      * @param subPanesCount the number of subpanes in the window
120      * @param geometry the geometry = <code>VERTICAL || HORIZONTAL ||
121      * VERTICAL_LEFT || VERTICAL_RIGHT || HORIZONTAL_UP ||
122      * HORIZONTAL_DOWN || NONE</code>
123      *
124      * @see #registerCustomized(String)
125      * @see #setSubPanesGeometry(String,int,String,boolean[])
126      * @see #setPaneContent(String,String,String,String[])
127      */

128     void setSubPanesGeometry(String JavaDoc gui, int subPanesCount, String JavaDoc geometry);
129
130     /**
131      * This configuration method delegates to the corresponding
132      * customized GUI.
133      *
134      * <p>The GUI must have been declared.
135      *
136      * @param gui the GUI name
137      * @param subPanesCount the number of subpanes in the window
138      * @param geometry the geometry = <code>VERTICAL || HORIZONTAL ||
139      * VERTICAL_LEFT || VERTICAL_RIGHT || HORIZONTAL_UP ||
140      * HORIZONTAL_DOWN</code>
141      * @param scrollings a set of string that tells if the sub-panes
142      * must be srollable or not (use setSubPanesGeometry(String,int,String) to
143      * make all the sub-panes scrollable
144      *
145      * @see #registerCustomized(String)
146      * @see #setSubPanesGeometry(String,int,String)
147      * @see #setPaneContent(String,String,String,String[])
148      */

149     void setSubPanesGeometry(String JavaDoc gui, int subPanesCount,
150                              String JavaDoc geometry,
151                              boolean[] scrollings);
152
153     /**
154      * Defines the initial content of a pane.
155      *
156      * <p>The GUI must have been declared.
157      *
158      * @param gui the GUI name
159      * @param paneId the panel id (see the geometry to know its placement)
160      * @param type the type of the view
161      * @param args arguments to pass to the constructor of the view
162      *
163      * @see #registerCustomized(String)
164      * @see #setViewConstructor(String,String,AbstractMethodItem)
165      * @see #setSubPanesGeometry(String,int,String)
166      * @see #setSubPanesGeometry(String,int,String,boolean[])
167      */

168     void setPaneContent(String JavaDoc gui, String JavaDoc paneId, String JavaDoc type, String JavaDoc[] args);
169
170     /**
171      * Set the container type to use for a pane. The default is
172      * "SingleSlotContainer".
173      *
174      * @param gui the GUI name
175      * @param paneId the panel id (see the geometry to know its
176      * placement)
177      * @param type the type of the container
178      *
179      * @see #registerCustomized(String)
180      * @see #setViewConstructor(String,String,AbstractMethodItem)
181      */

182     void setPaneContainer(String JavaDoc gui, String JavaDoc paneId, String JavaDoc type);
183
184     /**
185      * Set a pane to be invalidated (reload) when a given pane content
186      * changes.
187      *
188      * @param gui the GUI name
189      * @param changedPane the pane to watch
190      * @param invalidPane the pane to invalidate when the watched
191      * pane's content changes */

192
193     void setInvalidPane(String JavaDoc gui, String JavaDoc changedPane, String JavaDoc invalidPane);
194
195     /**
196      * Specify in which pane to open the view of a reference,
197      * collection, or a method's result. The default view for an object
198      * will be used.
199      *
200      * <p>Note that, for a method member, a displayabe object should be
201      * returned by the method. Otherwise, a runtime error will happen.
202      *
203      * @param gui the GUI name
204      * @param member the member (reference, collection, or method)
205      * @param paneId the ID of the pane where the view must be opened
206      *
207      * @see #registerCustomized(String)
208      * @see #addReferenceToPane(String,MemberItem,,String,String[],Boolean,String)
209      */

210     void addReferenceToPane(String JavaDoc gui,
211                             MemberItem member,
212                             String JavaDoc paneId);
213
214     /**
215      * This configuration method delegates to the corresponding
216      * customized GUI.
217      *
218      * <p>The GUI must have been declared.
219      *
220      * @param gui the GUI name
221      * @param field the field (reference of collection)
222      * @param viewType the type of the view to open
223      * @param small tell if the viewed object in this pane should be
224      * small
225      * @param panePath the path of the panel where the view must be
226      * opened (<customizedID>/<paneID>)
227      *
228      * @see #registerCustomized(String)
229      * @see #addReferenceToPane(String,MemberItem,String)
230      * @see CustomizedGUI#addReferenceToPane(MemberItem,String,String[],String)
231      */

232     void addReferenceToPane(String JavaDoc gui,
233                             MemberItem field,
234                             String JavaDoc viewType, String JavaDoc[] viewParams,
235                             Boolean JavaDoc small,
236                             String JavaDoc panePath);
237
238     /**
239      * This configuration method delegates to the corresponding
240      * customized GUI.
241      *
242      * <p>The GUI must have been declared.
243      *
244      * @param gui the GUI name
245      * @param left left-border pixel
246      * @param up upper-border pixel
247      * @param width in percentage regarding the screen
248      * @param height in percentage regarding the screen
249      *
250      * @see #registerCustomized(String)
251      * @see CustomizedGUI#setPosition(int,int,int,int) */

252
253     void setPosition(String JavaDoc gui, int left, int up,
254                      int width, int height);
255
256     /**
257      * Sets the position of a menu
258      * @param gui the customized GUI
259      * @param menu the menu name
260      * @param position the position of the menu (TOP, BOTTOM, LEFT or RIGHT)
261      */

262     void setMenuPosition(String JavaDoc gui, String JavaDoc menu, String JavaDoc position);
263
264     /**
265      * Add a menu item to a menu bar.
266      *
267      * @param gui the GUI name
268      * @param menu the menu name
269      * @param menuPath the path of the menu item.
270      * @param method the callback method for that menu item. It must be
271      * a static method with no arguments.
272      *
273      * @see #registerCustomized(String)
274      * @see #addMenuItem(String,String,String[],String,AbstractMethodItem)
275      * @see #addMenuItem(String,String,String[],String,AbstractMethodItem,String[])
276      */

277     void addMenuItem(String JavaDoc gui, String JavaDoc menu, String JavaDoc[] menuPath,
278                      AbstractMethodItem method);
279
280     /**
281      * Add a menu item to a menu bar.
282      *
283      * @param gui the GUI name
284      * @param menu the menu name
285      * @param menuPath the path of the menu item.
286      * @param objectName the name of the object on which to invoke the method
287      * @param method the callback method for that menu item. It must be
288      * an instance method with no arguments.
289      *
290      * @see #registerCustomized(String)
291      * @see #addMenuItem(String,String,String[],AbstractMethodItem)
292      * @see #addMenuItem(String,String,String[],AbstractMethodItem,String[])
293      */

294     void addMenuItem(String JavaDoc gui, String JavaDoc menu, String JavaDoc[] menuPath,
295                      String JavaDoc objectName, AbstractMethodItem method);
296
297     /**
298      * Add a menu item to a menu bar.
299      *
300      * @param gui the GUI name
301      * @param menu the menu name
302      * @param menuPath the path of the menu item.
303      * @param method the callback method for that menu item. It must be
304      * a static method.
305      * @param parameters the arguments to pass to the callback method
306      * when it is called
307      *
308      * @see #registerCustomized(String)
309      * @see #addMenuItem(String,String,String[],AbstractMethodItem)
310      * @see #addMenuItem(String,String,String[],String,AbstractMethodItem)
311      * @see #addMenuItem(String,String,String[],String,AbstractMethodItem,String[])
312      */

313     void addMenuItem(String JavaDoc gui, String JavaDoc menu, String JavaDoc[] menuPath,
314                      AbstractMethodItem method, String JavaDoc[] parameters);
315
316     /**
317      * Add a menu item to a menu bar.
318      *
319      * @param gui the GUI name
320      * @param menu the menu name
321      * @param menuPath the path of the menu item.
322      * @param objectName the name of the object on which to invoke the method
323      * @param method the callback method for that menu item. It must be
324      * an instance method.
325      * @param parameters the arguments to pass to the callback method
326      * when it is called
327      *
328      * @see #registerCustomized(String)
329      * @see #addMenuItem(String,String,String[],AbstractMethodItem)
330      * @see #addMenuItem(String,String,String[],AbstractMethodItem,String[])
331      * @see #addMenuItem(String,String,String[],String,AbstractMethodItem)
332      */

333     void addMenuItem(String JavaDoc gui, String JavaDoc menu, String JavaDoc[] menuPath,
334                      String JavaDoc objectName, AbstractMethodItem method,
335                      String JavaDoc[] parameters);
336
337     /**
338      * Add a separator in a menu.
339      *
340      * @param gui the GUI name
341      * @param menuPath the path of the menu item separator.
342      *
343      * @see #registerCustomized(String)
344      */

345     void addMenuSeparator(String JavaDoc gui, String JavaDoc menu, String JavaDoc[] menuPath);
346
347     /**
348      * Set the icon for a menu.
349      * @param gui the GUI name
350      * @param menuPath the path of the menu
351      * @param icon the name of the icon
352      *
353      * @see #registerCustomized(String)
354      */

355     void setMenuIcon(String JavaDoc gui, String JavaDoc menu, String JavaDoc[] menuPath, String JavaDoc icon);
356
357     /**
358      * Add a button in the toolbar
359      *
360      * @param gui the GUI name
361      * @param method the callback method for that button. It must be a
362      * static method with no arguments.
363      *
364      * @see #addToolbarAction(String,String,AbstractMethodItem)
365      * @see #addToolbarAction(String,AbstractMethodItem,String[])
366      * @see #registerCustomized(String)
367      */

368     void addToolbarAction(String JavaDoc gui, AbstractMethodItem method);
369
370     /**
371      * Add a button in the toolbar
372      *
373      * @param gui the GUI name
374      * @param objectName name of the object on which to invoke the method
375      * @param method the callback method for that button. It must be a
376      * static method with no arguments.
377      *
378      * @see #addToolbarAction(String,AbstractMethodItem)
379      * @see #addToolbarAction(String,AbstractMethodItem,String[])
380      * @see #registerCustomized(String)
381      */

382     void addToolbarAction(String JavaDoc gui,String JavaDoc objectName,AbstractMethodItem method);
383
384     /**
385      * Add a button in the toolbar
386      *
387      * @param gui the GUI name
388      * @param method a static method to invoke when the button is clicked
389      * @param params some parameters to pass the method
390      *
391      * @see #addToolbarAction(String,String,AbstractMethodItem)
392      * @see #addToolbarAction(String,AbstractMethodItem)
393      * @see #registerCustomized(String)
394      */

395     void addToolbarAction(String JavaDoc gui,
396                           AbstractMethodItem method,
397                           String JavaDoc[] params);
398
399     /**
400      * Add a separator in the toolbar
401      *
402      * @param gui the GUI name
403      *
404      * @see #registerCustomized(String)
405      */

406     void addToolbarSeparator(String JavaDoc gui);
407
408     /**
409      * This configuration method delegates to the corresponding
410      * customized GUI.
411      *
412      * <p>The GUI must have been declared.
413      *
414      * @param gui the GUI name
415      * @param splitterId the splitter's index
416      * @param location the position as a percentage between 0 and 1,
417      * regarding to the top/left component, a negative value means that
418      * the splitter should be set at the preferred sized of the inner
419      * components
420      * @see #registerCustomized(String)
421      * @see CustomizedGUI#setSplitterLocation(int,float)
422      */

423     void setSplitterLocation( String JavaDoc gui, int splitterId, float location );
424
425     /**
426      * This configuration method sets the title of the GUI main window.
427      *
428      * <p>The GUI must have been declared.
429      *
430      * @param gui the GUI name
431      * @param title the window title
432      * @see #registerCustomized(String)
433      */

434     void setTitle(String JavaDoc gui, String JavaDoc title);
435
436     /**
437      * Sets the given methods to be logging.
438      *
439      * <p>When it is called, the argument --- that must be a string ---
440      * is written into a text area added at the end of a subpanel
441      * defined by a customized GUI.
442      *
443      * @param gui the customized gui (must be registered and
444      * configured with at least <code>setSubPanesGeometry</code>)
445      * @param objects the objects that contain the method (pointcut expression)
446      * @param classes the class the contains the method (pointcut expression)
447      * @param methods the method item names (pointcut expression)
448      * @param paneId the subpanel id
449      * @see #registerCustomized(String)
450      * @see #setSubPanesGeometry(String,int,String)
451      */

452     void setLoggingMethod(String JavaDoc gui,
453                           String JavaDoc objects, String JavaDoc classes, String JavaDoc methods,
454                           int paneId);
455
456     /**
457      * This configuration method allows the user to define new
458      * resources that can be used by the GUI later-on.
459      *
460      * @param type the resource type (ICON) -- other types should be
461      * supported soon
462      * @param name the identifier of the resource (should be unique)
463      * @param path the path where the resource is located (can be
464      * classpath relative)
465      * @see #setIcon(ClassItem,String)
466      */

467     void defineResource(String JavaDoc type, String JavaDoc name, String JavaDoc path );
468    
469     /**
470      * This configuration method allows the programmer to define
471      * attributes for the default font. It currently is only used by
472      * the swing display.
473      *
474      * <p>The specified font will be used by all the UI components.
475      *
476      * <p>Note: this method sets a global font that will be active for
477      * all the configured GUIs. It is not possible to have different
478      * font configurations when running several GUIs on the same
479      * container.
480      *
481      * <p>Configurable font attributes are:</p>
482      * <dl>
483      * <dt>family</dt><dd>serif,sans-serif or monospace</dd>
484      * <dt>weight</dt><dd>normal or bold</dd>
485      * <dt>style</dt><dd>normal or italic</dd>
486      * <dt>size</dt><dd>the size of the font</dd>
487      * </dl>
488      *
489      * @param attribute the name of the attribute
490      * @param value the value for the attribute
491      */

492     void setFontAttribute( String JavaDoc attribute, String JavaDoc value );
493
494     /**
495      * Adds a style-sheet URL for the generated html pages (for WEB
496      * GUIs).
497      *
498      * <p>By default, the style-sheets are the one defined in the
499      * org/objectweb/jac/aspects/gui/web directory but the user can override some of
500      * their characteristics by adding customized ones (last added
501      * overrides)
502      *
503      * @param gui the customized GUI the style sheets applies to
504      * @param url the URL string
505      * @see #addStyleSheetURL(String)
506      */

507     void addStyleSheetURL(String JavaDoc gui, String JavaDoc url);
508    
509     /**
510      * Adds a style-sheet URL for the generated html pages (for WEB
511      * GUIs).
512      *
513      * @param url the URL string
514      * @see #addStyleSheetURL(String,String)
515      */

516     void addStyleSheetURL(String JavaDoc url);
517
518     /**
519      * Sets the delay before a dialog times out. Dialogs only time out
520      * on the web GUI, to avoid locking threads on the server for ever.
521      * @param timeout the timeout delay in milliseconds
522      */

523     void setDialogTimeout(long timeout);
524
525     /**
526      * Set the default currency
527      *
528      * @param currencyName the name of the default currency
529      * @param precision number of decimals to display
530      */

531     void setDefaultCurrency(String JavaDoc currencyName, int precision);
532
533     /**
534      * Declare a currency and it's change rate with the default currency
535      *
536      * @param currencyName the name of currency
537      * @param precision number of decimals to display for the currency
538      * @param rate the change rate for the currency
539      */

540     void declareCurrency( String JavaDoc currencyName, int precision, double rate);
541
542
543     /**
544      * Set the view constructor for a given gui type.
545      * @param guiType the type of the gui ("swing","web",...)
546      * @param viewType the type of the view
547      * @param constructor the view constructor for this gui type and view type
548      */

549     void setViewConstructor(String JavaDoc guiType,
550                             String JavaDoc viewType,
551                             AbstractMethodItem constructor);
552    
553
554     /**
555      * Set the default date format used by date components. It must be
556      * a valid format as defined by java.text.SimpleDateFormat
557      *
558      * @param dateFormat the date format
559      * @see java.text.SimpleDateFormat
560      */

561     void setDateFormat(String JavaDoc dateFormat);
562
563     /**
564      * Define an enumeration. It associates integer values with strings.
565      *
566      * @param name the name of enumeration to define
567      * @param values the labels of the values
568      * @param start the integer value of the first item.
569      * @param step
570      *
571      * @see FieldAppearenceGuiConf#setFieldEnum(FieldItem,String)
572      * @see FieldAppearenceGuiConf#setFieldChoice(FieldItem,Boolean,String[])
573      */

574     void defineEnum(String JavaDoc name, String JavaDoc[] values, int start, int step);
575
576     /**
577      * Enables navigation bar for a collection. <p> Navigation bar is a
578      * set of buttons (previous element, next element, remove element)
579      * used to navigate in a collection
580      *
581      * @param gui the gui
582      * @param collection the collection
583      */

584     void setNavBar(String JavaDoc gui, CollectionItem collection);
585
586     void setLabelOK(String JavaDoc label);
587     void setLabelCancel(String JavaDoc label);
588     void setLabelNew(String JavaDoc label);
589     void setLabelAdd(String JavaDoc label);
590     void setLabelNone(String JavaDoc label);
591     void setLabelAll(String JavaDoc label);
592
593     /**
594      * Sets the default charset encoding to use when interaction with
595      * the user's terminal. Defaults to "UTF-8". Used by the WEB
596      * diplay.
597      *
598      * @param encoding the charset encoding
599      *
600      * @see java.nio.charset.Charset
601      */

602     void setEncoding(String JavaDoc encoding);
603 }
604
605
Popular Tags