org.openxava.annotations
Annotation Type Tree


@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface Tree

With @Tree you can instruct OpenXava to visualize collections as a tree instead of a list.

Applies to collections. Example:

  @OneToMany(mappedBy="parentContainer", cascade = CascadeType.REMOVE)
  @Editor("TreeView")
  @ListProperties("description")
  @OrderBy("path, treeOrder")
  private Collection treeItems;
 

The full syntax for @Tree is @Tree(forViews="", notForViews="", pathProperty="path", idProperties="", idSeparator=",", initialExpandedState=true, orderIncrement=2, pathSeparator="/").
  1. forViews. Indicates in which views the tree behavior is going to be applied.
  2. notForViews. Views which are excluded from the tree renderization.
  3. pathProperty. Indicates the property to be used as the path, by default points to "path". You can customize this property if the entity path reference is persisted in a property with another name.
  4. idProperties. The tree implementation needs a unique identification for each of the elements displayed. By default the tree implementation use the properties annotated with @Id, but you can define which properties the tree must use as the unique identifier. The defined properties are comma separated.
  5. initialExpandedState. If true the tree is rendered with all nodes expanded.
  6. orderIncrement. If you define a orderBy and the orderBy is an integer type, the Tree implementation uses this field to allow reordering of the tree elements, by default the increment value is 2 and is the minimum allowed. This value allow easy reordering of elements.
  7. pathSeparator. If you use a separator for your path different than the default "/". Then you can set this property to the value that you are using.
  8. Author:
    Federico Alcantara

    Optional Element Summary
     java.lang.String forViews
              List of comma separated view names where this annotation applies.
     java.lang.String idProperties
              Optional.
     java.lang.String idSeparator
              Optional.
     boolean initialExpandedState
              Optional.
     java.lang.String notForViews
              List of comma separated view names where this annotation does not apply.
     int orderIncrement
              Optional.
     java.lang.String pathProperty
              Optional.
     java.lang.String pathSeparator
              Optional.
     

    forViews

    public abstract java.lang.String forViews
    List of comma separated view names where this annotation applies.

    Exclusive with notForViews.
    If both forViews and notForViews are omitted then this annotation apply to all views.
    You can use the string "DEFAULT" for referencing to the default view (the view with no name).

    Default:
    ""

    notForViews

    public abstract java.lang.String notForViews
    List of comma separated view names where this annotation does not apply.

    Exclusive with forViews.
    If both forViews and notForViews are omitted then this annotation apply to all views.
    You can use the string "DEFAULT" for referencing to the default view (the view with no name).

    Default:
    ""

    pathProperty

    public abstract java.lang.String pathProperty
    Optional. Defaults to path. Property used for the path, must be a String type with a size appropriate to the task at hand.

    Returns:
    property name
    Default:
    "path"

    idProperties

    public abstract java.lang.String idProperties
    Optional. Comma separated list of properties used for identifying the tree node. By default the id of the entity is used. If more than one property is used, their values will be nodeIdSeparator separated and enclosed in brackets.

    Returns:
    node property name.
    Default:
    ""

    idSeparator

    public abstract java.lang.String idSeparator
    Optional. String to be used to separate multiple Id elements.

    Default:
    ","

    initialExpandedState

    public abstract boolean initialExpandedState
    Optional. Indicates how to render the tree when the expandedPropertyName is not defined. It's default value is true.

    Returns:
    expanded state.
    Default:
    true

    orderIncrement

    public abstract int orderIncrement
    Optional. Defines the increment used for the keys when orderBy is used The default value is 2. The minimum is 2.

    Returns:
    order increment.
    Default:
    2

    pathSeparator

    public abstract java.lang.String pathSeparator
    Optional. Defines the separator for the path elements. Default value is /

    Returns:
    path separator character.
    Default:
    "/"