org.objectweb.jac.aspects.gui
Interface MethodAppearenceGuiConf

All Known Subinterfaces:
GuiConf
All Known Implementing Classes:
GuiAC

public interface MethodAppearenceGuiConf

This configuration interface of the Gui aspect defines all the methods that handle the appearence of the methods in views.

Author:
Renaud Pawlak, Laurent Martelli
See Also:
GuiAC, View

Method Summary
 void addPostInvoke(AbstractMethodItem method, AbstractMethodItem hook)
          Specifies a method to be invoked after a method is invoked from the GUI.
 void setCondition(AbstractMethodItem method, String condition)
          Sets a condition on a method.
 void setCreationAllowed(FieldItem field, boolean allow)
          Tells wether should be allowed to create a new instance when editing the value of a field.
 void setCreationAllowedParameters(AbstractMethodItem method, boolean[] create)
          Tells if JAC object-typed (references) arguments of a method can be created while the method's invocation or if they should be choosen in existing instances list.
 void setDefaultValues(AbstractMethodItem method, Object[] values)
          Sets the default value for argument names of a given method item so that they can be used by GUI aspect components.
 void setDirectCollectionMethods(CollectionItem collection, String[] methods)
          This configuration method allows the programmer to tell the GUI to add some buttons to the collection that will invoke the corresponding methods on the currently selected collection element.
 void setDynamicIcon(MethodItem method, MethodItem iconMethod)
          Defines a method to dynamically compute the icon for a menu's method.
 void setLinkedParameters(AbstractMethodItem method, String[] collections)
          Declares some reference parameters (non-primitive object-typed parameters) of the method to be linked with a collection that gives the choices of the object in the GUI combobox.
 void setMethodDynamicParameterChoice(MethodItem method, ClassItem[] targetClasses, String[] targetMethods, boolean[] editable)
          Same as setDynamicFieldChoice but for method parameters The values are dynamically defined at runtime by the invocation of a static target method.
 void setMethodDynamicParameterChoice(MethodItem method, MethodItem[] targetMethods, boolean[] editable)
          Same as setDynamicFieldChoice but for method parameters The values are dynamically defined at runtime by the invocation of a static target method.
 void setMethodParametersHeight(AbstractMethodItem method, Length[] height)
          Sets the height for all parameters of one method.
 void setMethodParametersWidth(AbstractMethodItem method, Length[] width)
          Sets the width for all parameters of one method.
 void setMimeType(AbstractMethodItem method, String type)
          Sets the mime-type of the file written to an OutputStream or Writer.
 void setParameterEnums(AbstractMethodItem method, String[] enumNames)
          Declares some parameters of method as enums.
 void setParameterFields(AbstractMethodItem method, String[] parameterFields)
          Specify that a parameter of a method corresponds to a field within the invoked object.
 void setParameterNames(AbstractMethodItem method, String[] parameterNames)
          Sets the argument names of a given method item so that they can be used by GUI aspect components.
 void setPasswordParameters(AbstractMethodItem method, String[] parameterFields)
          Specify that a parameter of a method is a pasword method.
 void setSlowOperation(AbstractMethodItem method, boolean isSlow)
          If an operation is expected to take a long time to complete, use this method to tell the GUI that it should display a message asking the user to wait for a while.
 

Method Detail

setMethodDynamicParameterChoice

public void setMethodDynamicParameterChoice(MethodItem method,
                                            ClassItem[] targetClasses,
                                            String[] targetMethods,
                                            boolean[] editable)
Same as setDynamicFieldChoice but for method parameters

The values are dynamically defined at runtime by the invocation of a static target method. This target method must return an array of objects that contains the possible new values for the fields.

Parameters:
method - the method
targetClasses - the array of classes that contains the target method for each parameter (elements of this array may be null)
targetMethods - the static methods within the target classes that returns the values to choose from (elements of this array may be null). The prototype is callback(Object) where the given object is the substance.
editable - tells if the values can be edited (new values can be manually entered)
See Also:
setMethodDynamicParameterChoice(MethodItem,MethodItem[],boolean[])

setMethodDynamicParameterChoice

public void setMethodDynamicParameterChoice(MethodItem method,
                                            MethodItem[] targetMethods,
                                            boolean[] editable)
Same as setDynamicFieldChoice but for method parameters

The values are dynamically defined at runtime by the invocation of a static target method. This target method must return an array of objects that contains the possible new values for the fields.

Parameters:
method - the method
targetMethods - the static methods that returns the values to choose from (elements of this array may be null). The prototype is callback(Object) where the given object is the substance.
editable - tells if the values can be edited (new values can be manually entered)
See Also:
setMethodDynamicParameterChoice(MethodItem,ClassItem[],String[],boolean[])

setParameterNames

public void setParameterNames(AbstractMethodItem method,
                              String[] parameterNames)
Sets the argument names of a given method item so that they can be used by GUI aspect components.

The GUI aspect can automatically fill some default parameter names for all the setters to lighten the GUI aspect programmer work (however, these automatically generated names can be overloaded if needed).

Parameters:
method - the method item. It can be of the form "methodName" or "methodName()". The first syntax will use the method with that name. The second syntax allow you to specify parameter types (separated by commas, with no spaces).
parameterNames - the parameter names

setParameterEnums

public void setParameterEnums(AbstractMethodItem method,
                              String[] enumNames)
                       throws Exception
Declares some parameters of method as enums.

Parameters:
method - the method
enumNames - the name of enums, for each parameter of the method. Use null to leave a parameter unaffected.
Throws:
Exception

setLinkedParameters

public void setLinkedParameters(AbstractMethodItem method,
                                String[] collections)
                         throws Exception
Declares some reference parameters (non-primitive object-typed parameters) of the method to be linked with a collection that gives the choices of the object in the GUI combobox.

Parameters:
method - the method
collections - the entire names of the collections that should be linked to the corresponding parameters (empty string if unlinked)
Throws:
Exception

setCreationAllowedParameters

public void setCreationAllowedParameters(AbstractMethodItem method,
                                         boolean[] create)
Tells if JAC object-typed (references) arguments of a method can be created while the method's invocation or if they should be choosen in existing instances list.

Parameters:
method - the method item. It can be of the form "methodName" or "methodName()". The first syntax will use the method with that name. The second syntax allow you to specify parameter types (separated by commas, with no spaces).
create - a flags arrays that tells for each parameters whether it can be created (true) or not (false). It has no effect if the parameter is not a JAC object (a reference)
See Also:
setCreationAllowed(FieldItem,boolean)

setCreationAllowed

public void setCreationAllowed(FieldItem field,
                               boolean allow)
Tells wether should be allowed to create a new instance when editing the value of a field.

Parameters:
field - the field
allow - wether to allow or not
See Also:
setCreationAllowedParameters(AbstractMethodItem,boolean[])

setParameterFields

public void setParameterFields(AbstractMethodItem method,
                               String[] parameterFields)
Specify that a parameter of a method corresponds to a field within the invoked object.

Parameters:
method - the method
parameterFields - an array that contains the corresponding field for each parameter of the method

setMethodParametersWidth

public void setMethodParametersWidth(AbstractMethodItem method,
                                     Length[] width)
                              throws Exception
Sets the width for all parameters of one method.

Parameters:
method - the method
width - width of all parameters
Throws:
Exception
See Also:
setMethodParametersHeight(AbstractMethodItem,Length[])

setMethodParametersHeight

public void setMethodParametersHeight(AbstractMethodItem method,
                                      Length[] height)
                               throws Exception
Sets the height for all parameters of one method.

Parameters:
method - the method
height - height of all parameters
Throws:
Exception
See Also:
setMethodParametersWidth(AbstractMethodItem,Length[])

setPasswordParameters

public void setPasswordParameters(AbstractMethodItem method,
                                  String[] parameterFields)
Specify that a parameter of a method is a pasword method.

A password parameter will be rendered with stars instead of the actual characters.

Parameters:
method - the method
parameterFields - an array that must contains "true" items if the corresponding parameter is a password, "false" or "" otherwhise.

setDirectCollectionMethods

public void setDirectCollectionMethods(CollectionItem collection,
                                       String[] methods)
This configuration method allows the programmer to tell the GUI to add some buttons to the collection that will invoke the corresponding methods on the currently selected collection element.

Parameters:
collection - the collection
methods - the names of the methods that can be invoked on the selected element

setDefaultValues

public void setDefaultValues(AbstractMethodItem method,
                             Object[] values)
Sets the default value for argument names of a given method item so that they can be used by GUI aspect components.

Parameters:
method - the method item. It can be of the form "methodName" or "methodName()". The first syntax will use the method with that name. The second syntax allow you to specify parameter types (separated by commas, with no spaces).
values - the default parameter values

setCondition

public void setCondition(AbstractMethodItem method,
                         String condition)
Sets a condition on a method. If the condition evaluates to false, the method is diabled in the GUI.

Parameters:
method - the method to put a condition on
condition - the condition. It must be the name of method of the same class as method which returns a boolean.

setSlowOperation

public void setSlowOperation(AbstractMethodItem method,
                             boolean isSlow)
If an operation is expected to take a long time to complete, use this method to tell the GUI that it should display a message asking the user to wait for a while.

Parameters:
method - the method
isSlow - wether the method is slow or not

setMimeType

public void setMimeType(AbstractMethodItem method,
                        String type)

Sets the mime-type of the file written to an OutputStream or Writer.

If a method takes an OutputStream or Writer as a parameter, a display (such as the web display or instance) may redirect the stream, to the browser. So that the browser can correctly interpret the data, it may be necessary to specify its mime-type.

Parameters:
method -
type - the mime-type (such as "application/pdf")

setDynamicIcon

public void setDynamicIcon(MethodItem method,
                           MethodItem iconMethod)
Defines a method to dynamically compute the icon for a menu's method.

Parameters:
method - method
iconMethod - a static method which must take 3 parameters (a MethodItem, an Object and an array of objects) and return a String or null. It will be invoked with the parameters array given to addMenuItem
See Also:
GuiConf.addMenuItem(String,String,String[],String,AbstractMethodItem,String[]), FieldAppearenceGuiConf.setIcon(MemberItem,String)

addPostInvoke

public void addPostInvoke(AbstractMethodItem method,
                          AbstractMethodItem hook)
Specifies a method to be invoked after a method is invoked from the GUI.

Parameters:
method -
hook - the method to be invoked after "method" is invoked. It must be static and take an InvokeEvent parameter
See Also:
InvokeEvent