JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.aspects.gui
Interface FieldAppearenceGuiConf

All Known Subinterfaces:
GuiConf
All Known Implementing Classes:
GuiAC

public interface FieldAppearenceGuiConf

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

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

Method Summary
 void hideTreeRelation(FieldItem field)
          This configuration method allows to hide a given relation (collection) in a treeview, even if the show relations mode is on .
 void setBorder(FieldItem field)
          Sets a border to the field in an object view.
 void setBorder(FieldItem field, String alignment, String style)
          Sets a border to the field in an object view.
 void setCategories(MemberItem member, String[] categories)
          Sets the categories of an item of a class.
 void setCategory(MemberItem member, String category)
          Sets the category of an item of a class.
 void setCollectionType(CollectionItem collection, String type)
          Set the type of the objects of a collection.
 void setDefaultEditorHeight(ClassItem type, int height, int rows)
          Sets the default editor height for value of a given type.
 void setDefaultEditorHeight(VirtualClassItem type, int height, int rows)
          Sets the default editor height for value of a given type.
 void setDefaultEditorWidth(ClassItem type, int width, int columns)
          Sets the default editor width for value of a given type.
 void setDefaultEditorWidth(VirtualClassItem type, int width, int columns)
          Sets the default editor width for value of a given type.
 void setDefaultShowRowNumbers(boolean value)
          Tells the GUI wether to show row numbers for tables and lists by default.
 void setDefaultSortedColumn(CollectionItem collection, String column)
          Sets a default sorted column for a collection.
 void setDefaultValue(FieldItem field, MethodItem method, String value)
          Set the default value for a choice.
 void setDefaultValue(FieldItem field, String value)
          Set the default value for a choice.
 void setDescription(MemberItem member, String description)
          Sets the description of a class member (field of method).
 void setDisplayLabel(MemberItem member, boolean value)
          Wether to display a label containing the name of the field in views.
 void setDynamicFieldChoice(FieldItem field, Boolean editable, ClassItem targetClass, String targetMethod)
          Same as setFieldChoice but with dynamically defined values.
 void setDynamicFieldChoice(FieldItem field, Boolean editable, MethodItem targetMethod)
          Same as setFieldChoice but with dynamically defined values.
 void setEditable(FieldItem field, boolean editable)
          Set a field to be editable.
 void setEditorHeight(FieldItem field, int height, int rows)
          Sets the height of the field's embedded editor when exist.
 void setEditorWidth(FieldItem field, int width, int columns)
          Sets the width of the field's embedded editor when exist.
 void setEmbeddedAdder(CollectionItem collection, boolean embedded)
          Tells the GUI wether to use an embedded view for the adder of a collection.
 void setEmbeddedEditor(MemberItem cl)
          This configuration method allows the programmer to set a class member to be internally edited.
 void setEmbeddedEditorColumns(CollectionItem collection, String viewName, MemberItem[] members)
          Tells to use embedded editors for the cells of some columns
 void setEmbeddedEditors(ClassItem cl)
          Tells the GUI to use embedded editors for all fields of a class, whenever possible.
 void setEmbeddedEditors(CollectionItem collection, String viewName, boolean embedded)
          Tells wether to use embedded editors for the cells of a table
 void setEmbeddedView(MemberItem member)
          Tells the GUI to insert a referenced object to be displayed as an embedded view in its container object view.
 void setFieldChoice(FieldItem field, Boolean editable, String[] choice)
          This configuration method allows the programmer to make a set of object to be proposed to the final user when an edition of this field value is performed.
 void setFieldEnum(FieldItem field, String enum)
          Declare a field as an enumeration.
 void setFileChooserView(MethodItem method, String[] fileExtensions, String fileDescription)
          Sets the view of a given setter's calling box to be a file chooser.
 void setFloatFormat(FieldItem field, String format)
          Sets the display format of a float or double field.
 void setIcon(MemberItem field, String name)
          This configuration method attaches an icon to a given field so that the iconized instances of this field will be represented by this icon (for instance in a treeview).
 void setLabel(MemberItem member, MemberItem selector, String label)
          Sets the label of a class member (field of method) for a given context
 void setLabel(MemberItem member, String label)
          Sets the label of a class member (field of method).
 void setMembersOrder(CollectionItem collection, ClassItem targetClass, String[] memberNames)
          Sets the default order in which the attributes of the elements of a collection are to be rendered.
 void setMembersOrder(CollectionItem collection, String viewName, ClassItem targetClass, String[] memberNames)
          Sets the order in which the attributes of the elements of a collection are to be rendered for a given view.
 void setNumRowsPerPage(CollectionItem collection, int numRows)
          Sets the number of rows to display simultaneously for a collection.
 void setPreferredHeight(CollectionItem collection, int height)
          Tells the preferred height a table or list view of a collection should take, if possible.
 void setPreferredWidth(CollectionItem collection, int width)
          Tells the preferred width a table or list view of a collection should take, if possible.
 void setStyle(FieldItem field, String style)
          Set the style of a field
 void setTableView(FieldItem field)
          Sets the render of a given field (more precisely a collection) to be rendered by a table.
 void setViewType(FieldItem field, String viewName, String viewType)
          Sets the view type of a field instead of using the default one ("List" or "Table").
 void setVisible(MemberItem member, boolean visible)
          Sets an item to be visible or not.
 void showRowNumbers(CollectionItem collection, boolean value)
          Tells the GUI wether to show row numbers for tables and lists.
 

Method Detail

setVisible

public void setVisible(MemberItem member,
                       boolean visible)
Sets an item to be visible or not.

If a field of method item is not visible, it will not be displayed by the object views. If a class item is not visible, then it will not be possible to open a view on objects of this class.

By default, the RTTI does not define this property and every item is visble. Thus, the GUI aspect component programmer should overload the default contructor of this class to set some visible attributes to false.

Parameters:
member - the member item (may be a method or a field name); it can be null to set the whole class visible or not
visible - whether the member must be visible
See Also:
GuiAC.isVisible(MetaItem)

setEmbeddedEditors

public void setEmbeddedEditors(ClassItem cl)
Tells the GUI to use embedded editors for all fields of a class, whenever possible.

Parameters:
cl - the class item
See Also:
FieldEditor

setEmbeddedEditors

public void setEmbeddedEditors(CollectionItem collection,
                               String viewName,
                               boolean embedded)
Tells wether to use embedded editors for the cells of a table

Parameters:
collection -
viewName -
embedded -
See Also:
#setEmbeddedEditors(CollectionItem,String,MemberItem[])

setEmbeddedEditorColumns

public void setEmbeddedEditorColumns(CollectionItem collection,
                                     String viewName,
                                     MemberItem[] members)
Tells to use embedded editors for the cells of some columns

Parameters:
collection -
viewName -
members -
See Also:
setEmbeddedEditors(CollectionItem,String,boolean)

setEmbeddedEditor

public void setEmbeddedEditor(MemberItem cl)
This configuration method allows the programmer to set a class member to be internally edited.

By default, each member of a class is editable with an "edit" button or link that opens a popup that allows the user to edit its value (see the FieldEditor interface). If this configuration method is called, then the editor will be embedded into the object's view the member belongs to.

See Also:
FieldEditor

setBorder

public void setBorder(FieldItem field,
                      String alignment,
                      String style)
Sets a border to the field in an object view.

Parameters:
field - the field
alignment - LEFT: title is on the left, RIGHT: title is on the right, CENTER: title is centered
style - LINE: the border is a line, ETCHED: the border is a 3D line, LOWERED: the border is a 3D effect that makes the bordered element lowered, RAISED: the border is a 3D effect that makes the bordered element raised.
See Also:
setBorder(FieldItem)

setBorder

public void setBorder(FieldItem field)
Sets a border to the field in an object view. Uses a default style (LINE) and alignement(LEFT)

Parameters:
field - the field
See Also:
setBorder(FieldItem,String,String)

setEditorWidth

public void setEditorWidth(FieldItem field,
                           int width,
                           int columns)
Sets the width of the field's embedded editor when exist.

Parameters:
field - the field
width - the editor width in pixel (typically used by SWING)
columns - the editor width in character columns (typically used by the WEB)
See Also:
setEmbeddedEditor(MemberItem), setEditorHeight(FieldItem,int,int), setDefaultEditorWidth(ClassItem,int,int)

setDefaultEditorWidth

public void setDefaultEditorWidth(VirtualClassItem type,
                                  int width,
                                  int columns)
Sets the default editor width for value of a given type.

Parameters:
width - the editor width in pixel (typically used by SWING)
columns - the editor width in character columns (typically used by the WEB)
See Also:
setDefaultEditorWidth(ClassItem,int,int), setDefaultEditorHeight(VirtualClassItem,int,int), setEditorWidth(FieldItem,int,int)

setDefaultEditorWidth

public void setDefaultEditorWidth(ClassItem type,
                                  int width,
                                  int columns)
Sets the default editor width for value of a given type.

Parameters:
width - the editor width in pixel (typically used by SWING)
columns - the editor width in character columns (typically used by the WEB)
See Also:
setDefaultEditorWidth(VirtualClassItem,int,int), setDefaultEditorHeight(VirtualClassItem,int,int), setEditorWidth(FieldItem,int,int)

setEditable

public void setEditable(FieldItem field,
                        boolean editable)
Set a field to be editable.

Parameters:
field - the field
editable - the flag (true is default)

setEditorHeight

public void setEditorHeight(FieldItem field,
                            int height,
                            int rows)
Sets the height of the field's embedded editor when exist.

Parameters:
field - the field
height - the editor height in pixel
rows - the editor height in character rows
See Also:
setEmbeddedEditor(MemberItem), setEditorWidth(FieldItem,int,int), setDefaultEditorHeight(ClassItem,int,int)

setDefaultEditorHeight

public void setDefaultEditorHeight(VirtualClassItem type,
                                   int height,
                                   int rows)
Sets the default editor height for value of a given type.

Parameters:
height - the editor height in pixel
rows - the editor height in character rows
See Also:
setDefaultEditorHeight(ClassItem,int,int), setDefaultEditorWidth(VirtualClassItem,int,int), setEditorHeight(FieldItem,int,int)

setDefaultEditorHeight

public void setDefaultEditorHeight(ClassItem type,
                                   int height,
                                   int rows)
Sets the default editor height for value of a given type.

Parameters:
height - the editor height in pixel
rows - the editor height in character rows
See Also:
setDefaultEditorHeight(VirtualClassItem,int,int), setDefaultEditorWidth(VirtualClassItem,int,int), setEditorHeight(FieldItem,int,int)

setCategory

public void setCategory(MemberItem member,
                        String category)
Sets the category of an item of a class.

The category must correspond to one of these defined on the class with the setCategories configuration method.

Parameters:
member - the member to categorize (a method or a field)
category - the existing category name
See Also:
setCategories(MemberItem,String[]), ClassAppearenceGuiConf.setCategories(ClassItem,String[])

setCategories

public void setCategories(MemberItem member,
                          String[] categories)
Sets the categories of an item of a class.

The category must correspond to one of these defined on the class with the setCategories configuration method.

Parameters:
member - the member to categorize (a method or a field)
categories - the existing category names
See Also:
setCategory(MemberItem,String), ClassAppearenceGuiConf.setCategories(ClassItem,String[])

setEmbeddedView

public void setEmbeddedView(MemberItem member)
Tells the GUI to insert a referenced object to be displayed as an embedded view in its container object view.

Parameters:
member - the member (reference field or method) that must be embedded

setEmbeddedAdder

public void setEmbeddedAdder(CollectionItem collection,
                             boolean embedded)
Tells the GUI wether to use an embedded view for the adder of a collection.

Parameters:
collection - the collection
embedded - wether to use an embedded view for the adder

setTableView

public void setTableView(FieldItem field)
Sets the render of a given field (more precisely a collection) to be rendered by a table.

In a table view, each item of the displayed collection fills a table line. Each column represents one field of the objects whithin the collection (the item within the collection whould be of the same class --- or at least share a common superclass).

Parameters:
field - the field that contains the collection

showRowNumbers

public void showRowNumbers(CollectionItem collection,
                           boolean value)
Tells the GUI wether to show row numbers for tables and lists.

Parameters:
collection - the affected collection
value - wether to show row numbers
See Also:
setDefaultShowRowNumbers(boolean)

setDefaultShowRowNumbers

public void setDefaultShowRowNumbers(boolean value)
Tells the GUI wether to show row numbers for tables and lists by default.

Parameters:
value - wether to show row numbers
See Also:
showRowNumbers(CollectionItem,boolean)

setDefaultSortedColumn

public void setDefaultSortedColumn(CollectionItem collection,
                                   String column)
Sets a default sorted column for a collection.

By default, collections are not sorted. You can precise a column to use to sort the collection by default. It will be used at the construction of the collection.

Parameters:
collection - the collection
column - the column used to sort (it is a fieldItem, watch out for case). You may preprend a '-' to use the reverse order of that column.

setMembersOrder

public void setMembersOrder(CollectionItem collection,
                            ClassItem targetClass,
                            String[] memberNames)
Sets the default order in which the attributes of the elements of a collection are to be rendered.

Parameters:
collection - the collection
targetClass - the class of attributes to render
memberNames - the name of the members in the rendering order
See Also:
setMembersOrder(CollectionItem,String,ClassItem,String[]), ClassAppearenceGuiConf.setTableMembersOrder(ClassItem,String[]), ClassAppearenceGuiConf.setAttributesOrder(ClassItem,String[])

setMembersOrder

public void setMembersOrder(CollectionItem collection,
                            String viewName,
                            ClassItem targetClass,
                            String[] memberNames)
Sets the order in which the attributes of the elements of a collection are to be rendered for a given view.

Parameters:
collection - the collection
viewName - the type for which to set the members order
targetClass - the class of attributes to render
memberNames - the name of the members in the rendering order
See Also:
setMembersOrder(CollectionItem,ClassItem,String[])

setFieldChoice

public void setFieldChoice(FieldItem field,
                           Boolean editable,
                           String[] choice)
This configuration method allows the programmer to make a set of object to be proposed to the final user when an edition of this field value is performed.

Most of the GUI will propose the choice within a ComboBox.

When the choices values can not be defined at programming time but must be dynamically created, then the programmer can use the setDynamicFieldChoice method.

Parameters:
field - the field
choice - the values the user will have to choose from when a edition of the field is performed
See Also:
setDynamicFieldChoice(FieldItem,Boolean,ClassItem,String), setFieldChoice(FieldItem,Boolean,String[]), setFieldEnum(FieldItem,String), GuiConf.defineEnum(String,String[],int,int)

setFieldEnum

public void setFieldEnum(FieldItem field,
                         String enum)

Declare a field as an enumeration.

Parameters:
field - the field
enum - the name of the enumeration
See Also:
GuiConf.defineEnum(String,String[],int,int), setFieldChoice(FieldItem,Boolean,String[]), setDynamicFieldChoice(FieldItem,Boolean,ClassItem,String)

setDynamicFieldChoice

public void setDynamicFieldChoice(FieldItem field,
                                  Boolean editable,
                                  ClassItem targetClass,
                                  String targetMethod)
Same as setFieldChoice but with dynamically defined values.

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

If the target method is static, it will be called with the object as the only parameter. If it's not static, it will called on the object with no parameters.

Parameters:
field - the field
targetClass - the class that contains the target method
targetMethod - name of a static method within the target class that returns the values to choose from. It must take an Object as parameter which will be the instance to which the field belongs to.

setDynamicFieldChoice

public void setDynamicFieldChoice(FieldItem field,
                                  Boolean editable,
                                  MethodItem targetMethod)
Same as setFieldChoice but with dynamically defined values.

Parameters:
field - the field
targetMethod - a static method that returns the values to choose from. It must take an Object as parameter which will be the instance to which the field belongs to.
See Also:
setDynamicFieldChoice(FieldItem,Boolean,ClassItem,String)

setCollectionType

public void setCollectionType(CollectionItem collection,
                              String type)
Set the type of the objects of a collection.

If this method is not used, the collection type can be dynamically found out by the GUI from the adder's argument types.

Parameters:
collection - the collection within this class
type - the type of this collection (an exiting class name)

setPreferredHeight

public void setPreferredHeight(CollectionItem collection,
                               int height)
Tells the preferred height a table or list view of a collection should take, if possible.

Parameters:
collection - the collection
height - the preferred height

setPreferredWidth

public void setPreferredWidth(CollectionItem collection,
                              int width)
Tells the preferred width a table or list view of a collection should take, if possible.

Parameters:
collection - the collection
width - the preferred width

setNumRowsPerPage

public void setNumRowsPerPage(CollectionItem collection,
                              int numRows)
Sets the number of rows to display simultaneously for a collection. This is only used by the web GUI so that generated web pages are not too big. If the number of elements in the collection is bigger than numRows, a "previous" and a "next" button are displayed so that the user can see the rest of the collection. The default is 10.

Parameters:
collection - the collection
numRows - the number of rows per page

setFileChooserView

public void setFileChooserView(MethodItem method,
                               String[] fileExtensions,
                               String fileDescription)
Sets the view of a given setter's calling box to be a file chooser.

As logically expected, the type of the set field must be a string or an URL.

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).
See Also:
URL, GuiAC.isFileChooserView(MethodItem)

setIcon

public void setIcon(MemberItem field,
                    String name)
This configuration method attaches an icon to a given field so that the iconized instances of this field will be represented by this icon (for instance in a treeview).

Parameters:
name - the icon's resource name

hideTreeRelation

public void hideTreeRelation(FieldItem field)
This configuration method allows to hide a given relation (collection) in a treeview, even if the show relations mode is on .

Parameters:
field - the field

setDefaultValue

public void setDefaultValue(FieldItem field,
                            MethodItem method,
                            String value)
Set the default value for a choice.

The default value is dynamically calculated by the method parameter from the string value (result can be an object). A default implementation for method is provided by GuiAC.

Parameters:
field - the field
method - a static method that returns the default value (prototype: Object m(FieldItem,String))
value - the string representation of the default value
See Also:
GuiAC.getDefaultValue(FieldItem,String)

setDefaultValue

public void setDefaultValue(FieldItem field,
                            String value)
Set the default value for a choice.

Same as setDefaultValue(ClassItem, String, MethodItem, String) using default MethodItem GuiAC.getDefaultValue.

Parameters:
field - the field
value - the string representation of the default value
See Also:
GuiAC.getDefaultValue(FieldItem,String), setDefaultValue(FieldItem,MethodItem,String)

setFloatFormat

public void setFloatFormat(FieldItem field,
                           String format)
Sets the display format of a float or double field.

Parameters:
field - the field
format - the display format of the field
See Also:
DecimalFormat

setDescription

public void setDescription(MemberItem member,
                           String description)
Sets the description of a class member (field of method).

Parameters:
member - the member
description - the description of the class member

setLabel

public void setLabel(MemberItem member,
                     String label)
Sets the label of a class member (field of method).

Parameters:
member - the member
label - the label of the class member
See Also:
setLabel(MemberItem,MemberItem,String)

setLabel

public void setLabel(MemberItem member,
                     MemberItem selector,
                     String label)
Sets the label of a class member (field of method) for a given context

Parameters:
member - the member
label - the label of the class member
See Also:
setLabel(MemberItem,String)

setDisplayLabel

public void setDisplayLabel(MemberItem member,
                            boolean value)
Wether to display a label containing the name of the field in views.

Parameters:
member - the member
value - boolean indicating wether to display the label

setStyle

public void setStyle(FieldItem field,
                     String style)
Set the style of a field

Parameters:
field - the field
style - the CSS style
See Also:
ClassAppearenceGuiConf.setStyle(ClassItem,String)

setViewType

public void setViewType(FieldItem field,
                        String viewName,
                        String viewType)
Sets the view type of a field instead of using the default one ("List" or "Table"). It allows you to define a custom view constructor for that type in order to handle complex tables. The view constructor must take 3 arguments: a CollectionItem, an Object (the susbtance), and a CollectionItemView)


Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli