Widget annotations
Overview of the screen, form, menu, tree and condition annotation packages, with a real example.
Source: framework/widget/src/com/ilscipio/scipio/widget/def/, in five
packages, one class per XML element of the widget schemas (151 files in
screen, 62 in form, 21 in menu, 20 in tree, 7 in condition; each
count includes a few enums, readers and [X]List repeatable-container
classes alongside the annotations). This page lists the packages and their
top-level annotations. It does not document every one; the class names
below match the XML element names closely enough to read directly.
screen#
framework/widget/src/com/ilscipio/scipio/widget/def/screen/. The largest
package: Screen, Section and its nested variants, Container and
its numbered variants, Actions/Action and the action kinds (SetAction,
ServiceAction, EntityAndAction, ScriptAction, and so on), the
If*/AndCondition/OrCondition/NotCondition condition tree,
DecoratorScreen/DecoratorSection, IncludeScreen/IncludeForm/
IncludeMenu/IncludeGrid/IncludeTreeWidget, Widget/WidgetType,
Label, Image, HtmlTemplate, Screenlet.
@Screen#
| Attribute | Type | Default | Meaning |
|---|---|---|---|
name | String | required | Screen name. |
transactionTimeout | String | "" | Transaction timeout in seconds. |
transactionTimeoutParam | String | "" | Whether request/session/application attributes carry the timeout. |
useTransaction | boolean | true | Whether to wrap rendering in a transaction. |
useCache | boolean | false | Whether to cache the rendered screen. |
actions | Action[] | {} | Actions to run before rendering. |
decorator | DecoratorScreen | @DecoratorScreen(name = "") | Decorator screen to wrap the content in. |
includeScreen | IncludeScreen | @IncludeScreen(name = "") | Screen to include instead of a section tree. |
sections | Section[] | {} | Top-level widget sections. |
location | String | "" | Screen file location, when defined out of line. |
locations | String[] | {} | Multiple file locations to merge. |
condition | Condition | @Condition | Overall render condition. |
failWidgets | WidgetsForContainer | @WidgetsForContainer | Widgets rendered when the condition fails. |
form#
framework/widget/src/com/ilscipio/scipio/widget/def/form/. Form, the field kinds (TextField, DisplayField,
DropDownField, CheckField, RadioField, DateFindField,
HyperlinkField, SubmitField, LookupField, and so on), FieldGroup,
FormActions/RowActions, AutoFieldsEntity/AutoFieldsService,
SortField/SortOrder, EntityConstraint/EntityOptions/EntityOrderBy.
@Form#
Main attributes; the full annotation carries over 50 for pagination, styling and behavior.
| Attribute | Type | Default | Meaning |
|---|---|---|---|
name | String | required | Form name. |
type | FormType | FormType.SINGLE | Form type: single, list, upload, and so on. |
target | String | "" | Submit target. |
targetType | TargetType | TargetType.INTRA_APP | How the target is resolved. |
defaultEntityName | String | "" | Entity fields are auto-generated from. |
defaultServiceName | String | "" | Service fields are auto-generated from. |
extendsForm | String | "" | Form this one extends. |
viewSize | int | 0 | Rows per page for a list form. |
autoFieldsService | AutoFieldsService[] | {} | Field auto-generation from a service. |
autoFieldsEntity | AutoFieldsEntity[] | {} | Field auto-generation from an entity. |
fields | FormField[] | {} | Explicit field list. |
actions | FormActions | @FormActions(UNSET = true) | Actions to run before rendering. |
rowActions | RowActions | @RowActions(UNSET = true) | Actions to run per row, for a list form. |
sortOrder | SortOrder | @SortOrder(UNSET = true) | Default sort order. |
location | String | "" | Form file location, when defined out of line. |
menu#
framework/widget/src/com/ilscipio/scipio/widget/def/menu/. Menu,
MenuItem/SubMenuItem, MenuLink, MenuImage,
MenuActions, MenuParameter, IncludeElements, MenuItemCondition,
AutoParametersEntity/AutoParametersService.
@Menu#
Main attributes; the full annotation adds default styling per element kind.
| Attribute | Type | Default | Meaning |
|---|---|---|---|
name | String | required | Menu name. |
type | MenuType | MenuType.SIMPLE | Menu type. |
title | String | "" | Menu title. |
defaultEntityName | String | "" | Entity items are auto-generated from. |
orientation | Orientation | Orientation.HORIZONTAL | Layout orientation. |
extendsMenu | String | "" | Menu this one extends. |
includeElements | IncludeElements[] | {} | Elements included from another menu. |
actions | MenuActions | @MenuActions(UNSET = true) | Actions to run before rendering. |
items | MenuItem[] | {} | Menu items. |
location | String | "" | Menu file location, when defined out of line. |
tree#
framework/widget/src/com/ilscipio/scipio/widget/def/tree/. Tree,
TreeNode/SubNode, TreeActions, TreeEntityOne,
EntityAnd/EntityCondition, TreeLink, TreeImage, TreeLabel,
TreeIncludeScreen, OutFieldMap, TreeParameter,
TreeConditionExpr/TreeConditionList, TreeNodeCondition.
@Tree#
| Attribute | Type | Default | Meaning |
|---|---|---|---|
name | String | required | Tree name. |
rootNodeName | String | required | Name of the root node. |
defaultRenderStyle | RenderStyle | RenderStyle.SIMPLE | Rendering style. |
openDepth | String | "0" | Levels open by default. |
postTrailOpenDepth | String | "0" | Levels open after the trail node. |
entityName | String | "" | Entity nodes are read from. |
forceChildCheck | boolean | true | Whether to check for children even when a node claims none. |
nodes | TreeNode[] | {} | Tree nodes. |
location | String | "" | Tree file location, when defined out of line. |
condition#
framework/widget/src/com/ilscipio/scipio/widget/def/condition/. Shared
condition infrastructure used by all four widget kinds: Condition,
ConditionNode, NestedCondition, ConditionEvaluator,
WidgetCondition.
Example: EditFacility screen#
applications/setup/src/com/ilscipio/scipio/setup/widget/SetupScreens.java,
lines 85-104.
@Screen(name = "EditFacility", location = "component://setup/widget/SetupScreens.xml")
@Action(type = ActionType.SET, field = "titleProperty", value = "ProductNewFacility")
@Action(type = ActionType.SET, field = "activeSubMenuItem", value = "facility")
@Action(type = ActionType.SET, field = "partyId", fromField = "parameters.partyId")
@Action(type = ActionType.SCRIPT, location = "component://commonext/webapp/ofbizsetup/WEB-INF/actions/FindFacility.groovy")
@DecoratorScreen(
name = "CommonSetupDecorator",
location = "${parameters.mainDecoratorLocation}",
sections = {
@DecoratorSection(name = "body", sections = {
@InlineSection(condition = @com.ilscipio.scipio.widget.def.screen.Condition(functionalConditions = {
@Condition(type = ServicePermission.class, params = {"facilityGenericPermission", "VIEW"
})}), widgets = @InlineWidgets(value = {
@Widget(type = WidgetType.INCLUDE_FORM, name = "EditFacility", location = "component://setup/widget/SetupForms.xml"
)}), failWidgets = @InlineWidgets(value = {
@Widget(type = WidgetType.LABEL, text = "${uiLabelMap.ProductFacilityViewPermissionError}", style = "common-msg-error-perm"
)}))})
}
)
public interface EditFacility {}Four @Action annotations set two fields, read a parameter into a field,
and run a Groovy script, before the screen decorates its body: an inline
section that checks a service permission, includes the EditFacility form
on success, and shows a permission-error label on failure.