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 editable
          Set the editor the editable or not (the isEditable() in swing components).
 String editor
          Full class name of the editor ObjectEditor to use.
 String enabled
          Set the editor the enabled or not (the isEnabled() in swing components).
 int index
          Gives the preferred field editor position.
 String label
          Gives a displayable name for the edited field/type.
 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.
 String visibility
          Definition editor the visibility.
 

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:

The given string can reference an attribute (with "") or a method (with "{$...}") of the edited object. In this case, the specified method is called on the edited object to get the label.
See net.sf.sfac.gui.editor.access.ModelAccessFactory class javadoc for more info.

Note: If the LanguageSupport is configured, the given label is used as bundle key.

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:

The given string can reference an attribute (with "") or a method (with "{$...}") of the edited object. In this case, the specified method is called on the edited object to get the description.
See net.sf.sfac.gui.editor.access.ModelAccessFactory class javadoc for more info.

Note: If the LanguageSupport is configured, the given description is used as bundle key.

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]>"

editable

public abstract String editable
Set the editor the editable or not (the isEditable() in swing components).
By default, an editor is editable if its parent is editable, if a model is set and if there is a setter defined allowing it to update the model.
A static visibility ("true" or "false") is not really useful, so for this annotation value, you should preferably use the method/attribute reference explained below.

The given string can reference an attribute (with "") or a method (with "{$...}") of the edited object. In this case, the specified method is called on the edited object to get the editable attribute.
See net.sf.sfac.gui.editor.access.ModelAccessFactory class javadoc for more info.

Default:
"<[undefined]>"

enabled

public abstract String enabled
Set the editor the enabled or not (the isEnabled() in swing components).
By default, an editor is editable if its parent is editable, if a model is set and if there is a setter defined allowing it to update the model.
A static visibility ("true" or "false") is not really useful, so for this annotation value, you should preferably use the method/attribute reference explained below.

The given string can reference an attribute (with "") or a method (with "{$...}") of the edited object. In this case, the specified method is called on the edited object to get the enabled attribute.
See net.sf.sfac.gui.editor.access.ModelAccessFactory class javadoc for more info.

Default:
"<[undefined]>"

visibility

public abstract String visibility
Definition editor the visibility.
By default, an editor is visible if its parent is visible (and root are visible by default).
A static visibility ("true" or "false") is not really useful, so for this annotation value, you should preferably use the method/attribute reference explained below.

The given string can reference an attribute (with "") or a method (with "{$...}") of the edited object. In this case, the specified method is called on the edited object to get the visibility.
See net.sf.sfac.gui.editor.access.ModelAccessFactory class javadoc for more info.

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 © 2012. All Rights Reserved.