net.sf.sfac.editor
Annotation Type EditorConfig


@Retention(value=RUNTIME)
public @interface EditorConfig

Annotation used by the GenericObjectEditor to build the Editor GUI.
Annotate a class like this:

                 @EditorConfig(name="My Object", editor="org.mycompany.MyEditor")  
                 public class ObjectToEdit() {
                    ...
                 }
 
to configure the way the object will appear in a generated form GUI.
Annotate a getter (method without parameter or a method with an integer index for indexed getters) like this:
                  @EditorConfig(name="My field", index=0, editor="org.mycompany.MyRenderer")  
                  public String getSomething() {
                     ...
                  }
 
and the return value of the method will be edited in a generated form GUI.
The annotated method is taken as the getter for the field to edit. The editor will try to find corresponding setter. If no setter is found, the field will be read-only.
See methods javadoc for meaning of annotation attributes.

Author:
Olivier Berlanger

Optional Element Summary
 String description
          Gives a displayable description for the edited field/type.
 String descriptionAccess
          Definition of an attribute holding the description.
 String editor
          Full class name of the editor ObjectEditor to use.
 int index
          Gives the preferred field editor position.
 String label
          Gives a displayable name for the edited field/type.
 String labelAccess
          Definition of an attribute holding the editor label.
 String list
          Key of a list to use: this parameter can be interpreted differently (or ignored) by each editor.
 String[] properties
          List of properties: The returned array must contain an odd number of strings, each time the property id followed by the property value.
 String tab
          Id of the Tab where to display the field: this parameter can be interpreted differently (or ignored) by each editor.
 String type
          Type of editor: this parameter can be interpreted differently (or ignored) by each editor.
 

label

public abstract String label
Gives a displayable name for the edited field/type. If omitted or empty string, no label is displayed.
The way this label is used in the resulting GUI depends on the ObjectEditor used, but in usually: Note: If the LanguageSupport is configured, the given label is used as bundle key.
When the labelAccess is defined, this attribute is only used as default value (when no object is there to apply the method defined in labelAccess).

Default:
"<[undefined]>"

description

public abstract String description
Gives a displayable description for the edited field/type. If omitted or empty string, no description is displayed.
The way this description is used in the resulting GUI depends on the ObjectEditor used, but in usually: Note: If the LanguageSupport is configured, the given description is used as bundle key.
When the descriptionAccess is defined, this attribute is only used as default value (when no object is there to apply the method defined in descriptionAccess).

Default:
"<[undefined]>"

index

public abstract int index
Gives the preferred field editor position. The field editors are sorted on this index (if present) and added on the generated GUI in this order. The editor of fields not providing indexes are processed after, more or less in the order of definition in the owning code.

Default:
-1

editor

public abstract String editor
Full class name of the editor ObjectEditor to use.

Default:
"<[undefined]>"

labelAccess

public abstract String labelAccess
Definition of an attribute holding the editor label.
The editor will call corresponding getter (e.g. if labelAccess is "myLabel" the method getMyLabel() is called) on the edited object to have the editor name rather than using the static value specified in the "name" annotation.
The resulting value is used as the label() attribute of this annotation except the fact that it is never translated by the LanguageSupport (you have to do it yourself in the called method if you want translation).

Default:
"<[undefined]>"

descriptionAccess

public abstract String descriptionAccess
Definition of an attribute holding the description.
The editor will call corresponding getter (e.g. if descriptionAccess is "myDescr" the method getMyDescr() is called) on the edited object to have the editor description rather than using the static value specified in the "description" annotation.
The resulting value is used as the description() attribute of this annotation except the fact that it is never translated by the LanguageSupport (you have to do it yourself in the called method if you want translation).

Default:
"<[undefined]>"

type

public abstract String type
Type of editor: this parameter can be interpreted differently (or ignored) by each editor.

For example, with the StringEditor, you can use type="line" (the default) or type="text" to have a single-line (i.e. * JTextField) or a multi-line (i.e. JTextArea) string editor.

Default:
"<[undefined]>"

list

public abstract String list
Key of a list to use: this parameter can be interpreted differently (or ignored) by each editor.
The actual object containing the list is provided by the editor context (method getContextObject(key))

Default:
"<[undefined]>"

tab

public abstract String tab
Id of the Tab where to display the field: this parameter can be interpreted differently (or ignored) by each editor.

Default:
"<[undefined]>"

properties

public abstract String[] properties
List of properties: The returned array must contain an odd number of strings, each time the property id followed by the property value. This parameter can be interpreted differently (or ignored) by each editor.

Default:
{}


Copyright © 2011. All Rights Reserved.