KickJava   Java API By Example, From Geeks To Geeks.

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


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 configuration interface of the Gui aspect defines all the
25  * methods that handle the appearence of the methods in views.
26  *
27  * @see GuiAC
28  * @see View
29  *
30  * @author <a HREF="mailto:renaud@cnam.fr">Renaud Pawlak</a>
31  * @author <a HREF="mailto:laurent@aopsys.com">Laurent Martelli</a> */

32
33 public interface MethodAppearenceGuiConf {
34
35     /**
36      * Same as <code>setDynamicFieldChoice</code> but for method parameters
37      *
38      * <p>The values are dynamically defined at runtime by the
39      * invocation of a static target method. This target method must
40      * return an array of objects that contains the possible new values
41      * for the fields.
42      *
43      * @param method the method
44      * @param targetClasses the array of classes that contains the
45      * target method for each parameter (elements of this array may be null)
46      * @param targetMethods the static methods within the target
47      * classes that returns the values to choose from (elements of this
48      * array may be null). The prototype is
49      * <code>callback(Object)</code> where the given object is the
50      * substance.
51      * @param editable tells if the values can be edited (new values
52      * can be manually entered)
53      *
54      * @see #setMethodDynamicParameterChoice(MethodItem,MethodItem[],boolean[])
55      */

56     void setMethodDynamicParameterChoice(MethodItem method,
57                                          ClassItem[] targetClasses,
58                                          String JavaDoc[] targetMethods,
59                                          boolean[] editable);
60
61     /**
62      * Same as <code>setDynamicFieldChoice</code> but for method parameters
63      *
64      * <p>The values are dynamically defined at runtime by the
65      * invocation of a static target method. This target method must
66      * return an array of objects that contains the possible new values
67      * for the fields.
68      *
69      * @param method the method
70      * @param targetMethods the static methods
71      * that returns the values to choose from (elements of this
72      * array may be null). The prototype is
73      * <code>callback(Object)</code> where the given object is the
74      * substance.
75      * @param editable tells if the values can be edited (new values
76      * can be manually entered)
77      *
78      * @see #setMethodDynamicParameterChoice(MethodItem,ClassItem[],String[],boolean[])
79      */

80     void setMethodDynamicParameterChoice(MethodItem method,
81                                          MethodItem[] targetMethods,
82                                          boolean[] editable);
83
84     /**
85      * Sets the argument names of a given method item so that they can
86      * be used by GUI aspect components.
87      *
88      * <p>The GUI aspect can automatically fill some default parameter
89      * names for all the setters to lighten the GUI aspect programmer
90      * work (however, these automatically generated names can be
91      * overloaded if needed).
92      *
93      * @param method the method item. It can be of the form
94      * "methodName" or "methodName(<types>)". The first syntax will use
95      * the method with that name. The second syntax allow you to
96      * specify parameter types (separated by commas, with no spaces).
97      * @param parameterNames the parameter names
98      */

99     void setParameterNames(AbstractMethodItem method,
100                            String JavaDoc[] parameterNames);
101
102     /**
103      * Declares some parameters of method as enums.
104      * @param method the method
105      * @param enumNames the name of enums, for each parameter of the
106      * method. Use null to leave a parameter unaffected.
107      */

108     void setParameterEnums(AbstractMethodItem method,
109                            String JavaDoc[] enumNames) throws Exception JavaDoc;
110
111     /**
112      * Declares some reference parameters (non-primitive object-typed
113      * parameters) of the method to be linked with a collection that
114      * gives the choices of the object in the GUI combobox.
115      * @param method the method
116      * @param collections the entire names of the collections that
117      * should be linked to the corresponding parameters (empty string
118      * if unlinked) */

119     void setLinkedParameters(AbstractMethodItem method,
120                              String JavaDoc[] collections) throws Exception JavaDoc;
121
122     /**
123      * Tells if JAC object-typed (references) arguments of a method can be
124      * created while the method's invocation or if they should be
125      * choosen in existing instances list.
126      *
127      * @param method the method item. It can be of the form
128      * "methodName" or "methodName(<types>)". The first syntax will use
129      * the method with that name. The second syntax allow you to
130      * specify parameter types (separated by commas, with no spaces).
131      * @param create a flags arrays that tells for each parameters
132      * whether it can be created (true) or not (false). It has no
133      * effect if the parameter is not a JAC object (a reference)
134      *
135      * @see #setCreationAllowed(FieldItem,boolean)
136      */

137     void setCreationAllowedParameters(AbstractMethodItem method,
138                                       boolean[] create);
139
140     /**
141      * Tells wether should be allowed to create a new instance when
142      * editing the value of a field.
143      *
144      * @param field the field
145      * @param allow wether to allow or not
146      *
147      * @see #setCreationAllowedParameters(AbstractMethodItem,boolean[])
148      */

149     void setCreationAllowed(FieldItem field, boolean allow);
150
151     /**
152      * Specify that a parameter of a method corresponds to a field
153      * within the invoked object.
154      *
155      * @param method the method
156      * @param parameterFields an array that contains the corresponding
157      * field for each parameter of the method
158      */

159     void setParameterFields(AbstractMethodItem method,
160                             String JavaDoc[] parameterFields);
161    
162     /**
163      * Sets the width for all parameters of one method.
164      *
165      * @param method the method
166      * @param width width of all parameters
167      *
168      * @see #setMethodParametersHeight(AbstractMethodItem,Length[])
169      */

170     void setMethodParametersWidth(AbstractMethodItem method, Length[] width)
171         throws Exception JavaDoc;
172
173     /**
174      * Sets the height for all parameters of one method.
175      *
176      * @param method the method
177      * @param height height of all parameters
178      *
179      * @see #setMethodParametersWidth(AbstractMethodItem,Length[])
180      */

181     void setMethodParametersHeight(AbstractMethodItem method, Length[] height)
182         throws Exception JavaDoc;
183
184     /**
185      * Specify that a parameter of a method is a pasword method.
186      *
187      * <p>A password parameter will be rendered with stars instead of
188      * the actual characters.
189      *
190      * @param method the method
191      * @param parameterFields an array that must contains "true" items
192      * if the corresponding parameter is a password, "false" or ""
193      * otherwhise.
194      */

195     void setPasswordParameters(AbstractMethodItem method, String JavaDoc[] parameterFields);
196
197     /**
198      * This configuration method allows the programmer to tell the GUI
199      * to add some buttons to the collection that will invoke the
200      * corresponding methods on the currently selected collection
201      * element.
202      *
203      * @param collection the collection
204      * @param methods the names of the methods that can be invoked on
205      * the selected element
206      */

207     void setDirectCollectionMethods(CollectionItem collection,
208                                     String JavaDoc[] methods);
209
210     /**
211      * Sets the default value for argument names of a given method item
212      * so that they can be used by GUI aspect components.
213      *
214      * @param method the method item. It can be of the form
215      * "methodName" or "methodName(<types>)". The first syntax will use
216      * the method with that name. The second syntax allow you to
217      * specify parameter types (separated by commas, with no spaces).
218      * @param values the default parameter values */

219
220     void setDefaultValues(AbstractMethodItem method, Object JavaDoc[] values);
221
222     /**
223      * Sets a condition on a method. If the condition evaluates to
224      * false, the method is diabled in the GUI.
225      *
226      * @param method the method to put a condition on
227      * @param condition the condition. It must be the name of method of
228      * the same class as method which returns a boolean.
229      */

230     void setCondition(AbstractMethodItem method, String JavaDoc condition);
231
232     /**
233      * If an operation is expected to take a long time to complete,
234      * use this method to tell the GUI that it should display a
235      * message asking the user to wait for a while.
236      *
237      * @param method the method
238      * @param isSlow wether the method is slow or not
239      */

240     void setSlowOperation(AbstractMethodItem method, boolean isSlow);
241
242     /**
243      * <p>Sets the mime-type of the file written to an OutputStream or
244      * Writer.</p>
245      *
246      * <p>If a method takes an OutputStream or Writer as a parameter,
247      * a display (such as the web display or instance) may redirect
248      * the stream, to the browser. So that the browser can correctly
249      * interpret the data, it may be necessary to specify its
250      * mime-type.</p>
251      *
252      * @param method
253      * @param type the mime-type (such as "application/pdf")
254      */

255     void setMimeType(AbstractMethodItem method, String JavaDoc type);
256
257     /**
258      * Defines a method to dynamically compute the icon for a menu's
259      * method.
260      *
261      * @param method method
262      * @param iconMethod a static method which must take 3 parameters
263      * (a MethodItem, an Object and an array of objects) and return a
264      * String or null. It will be invoked with the parameters array
265      * given to <code>addMenuItem</code>
266      *
267      * @see GuiConf#addMenuItem(String,String,String[],String,AbstractMethodItem,String[])
268      * @see FieldAppearenceGuiConf#setIcon(MemberItem,String)
269      */

270     void setDynamicIcon(MethodItem method, MethodItem iconMethod);
271
272     /**
273      * Specifies a method to be invoked after a method is invoked from
274      * the GUI.
275      *
276      * @param method
277      * @param hook the method to be invoked after "method" is
278      * invoked. It must be static and take an InvokeEvent parameter
279      * @see InvokeEvent
280      */

281     void addPostInvoke(AbstractMethodItem method, AbstractMethodItem hook);
282 }
283
Popular Tags