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#

AttributeTypeDefaultMeaning
nameStringrequiredScreen name.
transactionTimeoutString""Transaction timeout in seconds.
transactionTimeoutParamString""Whether request/session/application attributes carry the timeout.
useTransactionbooleantrueWhether to wrap rendering in a transaction.
useCachebooleanfalseWhether to cache the rendered screen.
actionsAction[]{}Actions to run before rendering.
decoratorDecoratorScreen@DecoratorScreen(name = "")Decorator screen to wrap the content in.
includeScreenIncludeScreen@IncludeScreen(name = "")Screen to include instead of a section tree.
sectionsSection[]{}Top-level widget sections.
locationString""Screen file location, when defined out of line.
locationsString[]{}Multiple file locations to merge.
conditionCondition@ConditionOverall render condition.
failWidgetsWidgetsForContainer@WidgetsForContainerWidgets 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.

AttributeTypeDefaultMeaning
nameStringrequiredForm name.
typeFormTypeFormType.SINGLEForm type: single, list, upload, and so on.
targetString""Submit target.
targetTypeTargetTypeTargetType.INTRA_APPHow the target is resolved.
defaultEntityNameString""Entity fields are auto-generated from.
defaultServiceNameString""Service fields are auto-generated from.
extendsFormString""Form this one extends.
viewSizeint0Rows per page for a list form.
autoFieldsServiceAutoFieldsService[]{}Field auto-generation from a service.
autoFieldsEntityAutoFieldsEntity[]{}Field auto-generation from an entity.
fieldsFormField[]{}Explicit field list.
actionsFormActions@FormActions(UNSET = true)Actions to run before rendering.
rowActionsRowActions@RowActions(UNSET = true)Actions to run per row, for a list form.
sortOrderSortOrder@SortOrder(UNSET = true)Default sort order.
locationString""Form file location, when defined out of line.

framework/widget/src/com/ilscipio/scipio/widget/def/menu/. Menu, MenuItem/SubMenuItem, MenuLink, MenuImage, MenuActions, MenuParameter, IncludeElements, MenuItemCondition, AutoParametersEntity/AutoParametersService.

Main attributes; the full annotation adds default styling per element kind.

AttributeTypeDefaultMeaning
nameStringrequiredMenu name.
typeMenuTypeMenuType.SIMPLEMenu type.
titleString""Menu title.
defaultEntityNameString""Entity items are auto-generated from.
orientationOrientationOrientation.HORIZONTALLayout orientation.
extendsMenuString""Menu this one extends.
includeElementsIncludeElements[]{}Elements included from another menu.
actionsMenuActions@MenuActions(UNSET = true)Actions to run before rendering.
itemsMenuItem[]{}Menu items.
locationString""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#

AttributeTypeDefaultMeaning
nameStringrequiredTree name.
rootNodeNameStringrequiredName of the root node.
defaultRenderStyleRenderStyleRenderStyle.SIMPLERendering style.
openDepthString"0"Levels open by default.
postTrailOpenDepthString"0"Levels open after the trail node.
entityNameString""Entity nodes are read from.
forceChildCheckbooleantrueWhether to check for children even when a node claims none.
nodesTreeNode[]{}Tree nodes.
locationString""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.

java
@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.

Ask the people who wrote it.

Support, development and training from the team that builds Scipio ERP.