Positioning
The position() element pertains only to actions that have been associated with properties using @Action#associateWith(). For these actions, it specifies the positioning of the action’s button with respect to the field representing the object property.
The attribute can take one of four values: BELOW, RIGHT, PANEL or PANEL_DROPDOWN.
For example:
import lombok.Getter;
import lombok.Setter;
public class Customer {
@Property( editing=Editing.DISABLED )
@Getter @Setter
private BigDecimal cost;
@Property( editing=Editing.DISABLED )
@Getter @Setter
private String location;
@Action( associateWith="cost" ) (1)
@ActionLayout(
named="Update", (2)
position=Position.BELOW (3)
)
public Customer updateCost(BigDecimal cost ) {
// ...
}
@Action( associateWith="location" )
@ActionLayout(
named="Update",
position=Position.BELOW
)
public Customer updateLocation(String latitude, String longitude) {
// ...
}
}
| 1 | associate the "updateCost" action with the "cost" property |
| 2 | give the action an abbreviated name, because the fact that the "cost" property is to be updated is implied by its positioning |
| 3 | positioning of the action’s button |
The default is BELOW.
If the action is positioned as RIGHT, then the action’s button is rendered to the right of the property’s field, in a compact drop-down.
If the action is positioned as PANEL, then the action’s button is rendered on the header of the panel that contains the property.
And finally, if the action is positioned as PANEL_DROPDOWN, then the action’s button is again rendered on the panel header.
If there are multiple actions associated with a single property then the positioning can be mix’ed-and-match’ed as required.
If the PANEL or PANEL_DROPDOWN are used, then (as the screenshots above show) the actions from potentially multiple properties grouped by that panel will be shown together.