Chapter III. Views

Table of Contents

III.1. Simple views
III.1.1. Overview
III.1.2. Reference
III.2. Composite views
III.2.1. Overview
III.2.2. Reference

III.1. Simple views

III.1.1. Overview

View descriptors diagram

Figure III.1. View descriptors diagram


III.1.2. Reference

III.1.2.1. Reference for BasicViewDescriptor hierarchy

BasicViewDescriptor

This is the abstract base descriptor for all views. Its main purpose, since it cannot be used directly, is to factorize common properties.

Table III.1. BasicViewDescriptor properties

PropertyDescription

actionMap

Action​Map

Assigns the view action map. An action map is generally represented as a toolbar attached to the view. The toolbar follows the structure of the action map :

  • each action list is contained in its own toolbar section which is visually separated from the other sections. This allows for visually grouping related actions as they are grouped in the action lists.

  • each action contained in an action list is represented by a toolbar button using the action image as icon and translated action description as toolTip.

Depending on the UI channel, the view action map may also be replicated in a component contextual menu. In that case, the translated action name is used to label each menu item. The same grouping rules apply for the contextual menu than for the toolbar.

background

String

Sets the background color of the UI component. The color must be defined using its string hexadecimal representation (0xargb encoded).

Default value is null, meaning use UI default.

borderType

EBorder​Type

Sets the border type of the view. This is either a value of the EBorderType enum or its equivalent string representation :

  • NONE for no border

  • SIMPLE for a line border

  • TITLED for a titled border. The view is then labeled with its translated name and and icon. Whenever the view name has not been explicitely set, the model name is used is used.

Default value is EBorderType.NONE, i.e. no border.

font

String

Allows to customize the font used by the UI component. The font must be string encoded using the pattern "[name];[style];[size]" :

  • [name] is the name of the font, e.g. arial.

  • [style] is PLAIN, BOLD, ITALIC or a union of BOLD and ITALIC combined with the '|' character, e.g. BOLD|ITALIC.

  • [size] is the size of the font, e.g. 10.

Any of the above pattern section can be left empty, thus falling back to the component default.

Default value is null, meaning use default component font.

foreground

String

Sets the foreground color of the UI component. The color must be defined using its string hexadecimal representation (0xargb encoded).

Default value is null, meaning use UI default.

grantedRoles

Collection​<​String​>​

Assigns the roles that are authorized to use this view. It supports "!" prefix to negate the role(s). Whenever the user is not granted sufficient privileges, the view is replaced by an empty section at runtime. Setting the collection of granted roles to null (default value) disables role based authorization on the view level. The framework then checks for the model roles authorizations and will apply the same restrictions. If both view and model granted roles collections are null, then access is granted to anyone.

modelDescriptor

IModel​Descriptor

Assigns the model descriptor backing the view. The model descriptor serves several purposes :

  • configuration of the view content. For instance whenever a form is assigned a component model descriptor, it will install 1 field per component rendering properties, unless otherwise specified in the view descriptor itself.

  • configuration of the binding layer. There is no need for the developer to configure anything for the binding to occur between the view and the model. Based on their model descriptor, Jspresso will setup all the necessary plumbing to efficiently synchronize model properties with their view couterpart bi-directionally. This synchronization occurs implicitely using the observer pattern and one of the Jspresso key contract is to guarantee this synchronization seamlessly.

Although it is the developer responsibility to make sure the correct model descriptor is assigned to the view, there are cases where the framework will infer it. For instance, a composite view will by default transmit its model descriptor to its children that do not have their model descriptor explicitely set. This allows for setting the model descriptor only on the composite view and keep default null value on the children as an implicite model inheritance enablement.

permId

String

Sets the permanent identifier to this application element. Permanent identifiers are used by different framework parts, like dynamic security or record/replay controllers to uniquely identify an application element. Permanent identifiers are generated by the SJS build based on the element id but must be explicitely set if Spring XML is used.

preferredHeight

Integer

Allows to set a preferred height (in pixels) for the created peer UI component. This will override default and give hints to the UI layouting system.

preferredWidth

Integer

Allows to set a preferred width (in pixels) for the created peer UI component. This will override default and give hints to the UI layouting system.

readOnly

boolean

Allows to set a view read-only, i.e. none of the view part will allow for updating the underlying model. This is mainly a shortcut to assigning an "always closed" writability gate. One difference though is that, since the framework knows that the view will never be updatable, it may take specific decisions to render properties in a slightly different way, e.g. instead of using a disabled textfied, use a label.

Default value is false, i.e. view is updatable.

secondaryActionMap

Action​Map

Assigns the view secondary action map. Same rules as the primary action map apply except that actions in this map should be visually distinguished from the main action map, e.g. placed in another toolbar.

writabilityGates

Collection​<​IGate​>​

Assigns a collection of gates to determine view writability. A view will be considered writable (updatable) if and only if all gates are open. This mecanism is mainly used for dynamic UI authorization based on model state, e.g. a validated invoice should not be editable anymore.

View assigned gates will be cloned for each view instance created and backed by this descriptor. So basically, each view instance will have its own, unshared collection of writability gates.

Jspresso provides a useful set of gate types, like the binary property gate that open/close based on the value of a boolean property of the view model.

By default, view descriptors are not assigned any gates collection, i.e. there is no writability restriction. Note however that view actual writability is the combination of view and model writability.


AbstractCardViewDescriptor

This descriptor serves as abstract base implementation for card view descriptor. A card view is a view stack made of children views (the cards) where only the view (card) at the top of the stack is visible. The actual child view to place on the top of the stack is dynamically determined based on the bound model. This card determination strategy depends on the concrete descriptor sub-types.

One might wonder why a card view is not considered as (and actually does not inherit from) a composite view. The difference is that composite views are used agregate views that displays - hopefully - different parts (the children views) of the same model. A card view descriptor is rather used to make the same UI region display different views depending on different models (or different model states). Once the model is fixed, the card view behaves exactly as its top card.

One of the most important usage of card views is when it is combine as the detail in a master-detail view. The detail view may then change dynamically based on the selected master.

Table III.2. AbstractCardViewDescriptor properties

PropertyDescription
This class does not have any specific property.

BasicCardViewDescriptor

Describes a multi-purpose card view that is configurable with a custom card determination strategy. Cards are registered with a name key that is used to retrieve the card to display based on the card selector selected name key.

Table III.3. BasicCardViewDescriptor properties

PropertyDescription

cardNameSelector

ICard​Name​Selector

Configures the card determination strategy. This delegate is responsible for selecting the card name key based on the model bound to the view. Everytime the bound model changes, the card name selector is triggered to select a new card. The names returned by the card name selector must match the names under which the cards are registered. Whenever the card name selector returns an unknown name, the card view displays an empty view.

cardViewDescriptors

Map​<​String​,IView​Descriptor​>​

Registers the card views keyed by their name keys. The names used as key of the Map must match the names that are returned by the registered card name selector.


EntityCardViewDescriptor

This card view provides a simple card determination strategy that is based on the bound model type. This strategy pulls up the card whose model descriptor matches the type of the bound model.

Table III.4. EntityCardViewDescriptor properties

PropertyDescription

viewDescriptors

List​<​IView​Descriptor​>​

Registers the list of card view descriptors. Every time the bound model changes, this list is iterated until a card with a matching model is found. The first matching card is displayed. Whenever no registered card matches, an empty view is displayed.


BasicActionViewDescriptor

This type of view allows to make an action available as a view and thus participate in the UI composition as a visual component. An action view can then be embedded in surrounding a composite view. It litterally takes the action away from the toolbar/context menu it is located when registered in an action map and makes it a primary citizen of the UI.

Table III.5. BasicActionViewDescriptor properties

PropertyDescription

action

IDisplayable​Action

Assigns the action to display as a view. The action will typically be rendered as a button in the UI. whenever you want to size the icon used to display the action (and thus the button peer), you might use the preferredWidth / preferredHeight properties.

renderingOptions

ERendering​Options

Indicates how the action should be rendered. This is either a value of the ERenderingOptions enum or its equivalent string representation :

  • LABEL_ICON for label and icon

  • LABEL for label only

  • ICON for icon only.

Default value is ERenderingOptions.ICON, i.e. icon only.


BasicCollectionViewDescriptor

This is the abstract base descriptor of all views used to display a collection of elements. A collection view must be backed by a collection descriptor model. Most of the time, the model will be a collection property descriptor so that the collecion to display is directly inferred from the collection property value through the binding layer.

Table III.6. BasicCollectionViewDescriptor properties

PropertyDescription

autoSelectFirstRow

boolean

Configures the default selection that gets applied when the content of the collection view changes. Whenever set to true, the 1st row will be automatically selected, whereas nothing happens whe set to false.

The default value depends on the selection mode of the collection view. When a cumulative selection mode is used, autoSelectFirstRow defaults to false. It defaults to true otherwise.

itemSelectionAction

IAction

Registers an action that is implicitely triggered everytime the selection changes on the collection view UI peer. The context of the action execution is the same as if the action was registered in the view action map.

modelDescriptor

IModel​Descriptor

{@inheritDoc}

paginationViewDescriptor

IView​Descriptor

Configures a view that will control the pagination (if any) on this collection view. When contructed, the collection view will be decorated with the pagination view. The pagination view will be bound to the same model as the one providing the collection of the collection view.

rowAction

IAction

Registers an action that is implicitely triggered everytime a row is activated (e.g. double-clicked for current UI channels) on the collection view UI peer. The context of the action execution is the same as if the action was registered in the view action map.

selectionMode

ESelection​Mode

Sets the selection mode of the collection view. This is either a value of the ESelectionMode enum or its equivalent string representation :

  • MULTIPLE_INTERVAL_SELECTION for allowing any type of selection

  • MULTIPLE_INTERVAL_CUMULATIVE_SELECTION for allowing any type of selection with toggle behaviour

  • SINGLE_INTERVAL_SELECTION for allowing only contiguous interval selection

  • SINGLE_INTERVAL_CUMULATIVE_SELECTION for allowing only contiguous interval selection with toggle behaviour

  • SINGLE_SELECTION for allowing only a single item selection

  • SINGLE_CUMULATIVE_SELECTION for allowing only a single item selection with toggle behaviour

Default value is ESelectionMode.MULTIPLE_INTERVAL_SELECTION, i.e. any type of selection allowed.


BasicListViewDescriptor

This type of descriptor is used to implement a list view. A list view is a single column, uneditable collection view used to display a collection of components. Each item is displayed using a string representation that can be customized using the renderedProperty property. List views are rarely used since one might prefer its much more advanced cousin, i.e. the table view.

Despite its low usage as an individual UI component, the list view is also used by Jspresso to describe tree parts. A collection of sibling tree nodes can actually be considered as being a list view and can be described as such. In the latter case, the renderedProperty property will be used to label the tree nodes.

Table III.7. BasicListViewDescriptor properties

PropertyDescription

iconImageURLProvider

IIcon​Image​URLProvider

The icon image URL provider is the delegate responsible for inferring a tree node icon based on its underlying model. By default (i.e. when iconImageURLProvider is null), Jspresso will use the underlying component descriptor icon, if any. Using a custom icon image URL provider allows to implement finer rules like using different icons based on the underlying object state. There is a single method to implement to achieve this :

String getIconImageURLForObject(Object userObject);

renderedProperty

String

Configures the model property to be rendered in the list. Whenever this property is left to null (default value), the toStringProperty of the element component descriptor is used.


BasicTableViewDescriptor

This descriptor is used to implement a table view. This is certainly the most commonly used collection descriptor in Jspresso. A table view displays a collection of components (one row per component in the collection) detailed by a set of properties (one column per displayed component property).

The table view will automatically adapt its columuns depending on the underlying property descriptors, e.g. :

  • columns for read-only properties won't be editable

  • columns that are assigned writability gates will compute the editability of their cells based on each cell's gates

  • columns will adapt their renderer/editor based on the underlying property type, e.g. a calendar component will be used for dates

  • column titles will be filled with property names translations based on the user locale

  • mandatory properties will be visually indicated

  • ...

A table view provides sensible defaults regarding its configuration, but it can be refined using either the simple renderedProperties or the more advanced yet lot more powerful columnViewDescriptors properties.

Table III.8. BasicTableViewDescriptor properties

PropertyDescription

columnViewDescriptors

List​<​IProperty​View​Descriptor​>​

This property allows for configuring the columns of the table view in a very customizable manner, thus overriding the model descriptor defaults. Each property view descriptor copntained in the list describes a table column that will be rendered in the UI accordingly.

For instance, a writable property can be made specifically read-only on this table view by specifying its column property view descriptor read-only. In that case, the model remains untouched and only the view is impacted.

Following the same scheme, you can assign a list of writability gates on a column to introduce dynamic cell editability on the view without modifying the model.

A last, yet important, example of column view descriptor usage is the role-based column set configuration. Whenever you want a column to be available only for certain user roles (profiles), you can configure a column property view descriptor with a list of granted roles. If the user doesn't have the column(s)required role, the forbidden columns simply won't be displayed. This allows for high authorization-based versatility.

There are many other usages of defining column property view descriptors all of them being linked to customizing the table columns without impacting the model.

horizontallyScrollable

boolean

This property allows to define the table horizontal scrolling behaviour. Whenever it is set to false, the corresponding table UI component will adapt its columns to fit the available horizontal space.

Default value is true, i.e. table columns will have their default size and tha table will scroll horizontally as needed.

renderedProperties

List​<​String​>​

This is somehow a shortcut to using the columnViewDescriptors property. Instead of providing a full-blown list of property view descriptors to configure the table columns, you just pass-in a list of property names. Table columns are then created from this list, keeping model defaults for all column characteristics.

Whenever the property value is null (default), the column list is determined from the collection element component descriptor renderedProperties property.

sortable

boolean

This property allows to define the table horizontal sorting behaviour. Whenever it is set to false, the corresponding table UI component will not allow manual sorting of its rows.

Default value is true, i.e. table allows for its rows to be sorted.

sortingAction

IDisplayable​Action

Configures the action to be activated when a sort is triggered by the user. It should be used with caution and rarely be overriden from the default.


BasicComponentViewDescriptor

Component view descriptors are surely one of the most commonly used view descriptors in Jspresso. It allows to implement advanced form-like views to interact with a single component model. Component properties that are displayed in the view are organized in an invisible grid. Each field component is labelled with the property name it displays and labels can be configured to be displayed aside or above their peer field. Property fields can be configured to span multiple form columns. Component view offer various straightforward customizations, but the most advanced and prowerful one is definitely the propertyViewDescriptors property tat allows to fine-tune each component UI field individually.

Table III.9. BasicComponentViewDescriptor properties

PropertyDescription

columnCount

int

Configures the number of columns on this component view. Property fields that are to be displayed in the view are spread across columns and rows following their defined order. Whenever a row does not contain enough empty cells to recieve the next field (either because the last column has been reached or the next field has been configured to span multiple columns and there is not enough cells left in the current row to satisfty the span), a new row is created and the next field is added to the first column on the new row.

Note that column count and span are defined in fields coordinates (the field including the property UI component + its label). The underlying grid is actually finer since it has to cope with the labels; but this is internal implementation details and Jspresso takes care of it, without the developer having to cope with labels placements.

Default value is 1, meaning that all rendered fields will be stacked in a single column.

labelsPosition

ELabel​Position

Instructs Jspresso where to place the fields label. This is either a value of the ELabelPosition enum or its equivalent string representation :

  • ABOVE for placing each field label above the property UI component

  • ASIDE for placing each field label aside the property UI component

  • NONE for completely disabling fields labelling on the view

Default value is ELabelPosition.ASIDE, i.e. fields label next to the property UI component.

propertyViewDescriptors

List​<​IProperty​View​Descriptor​>​

This property allows for configuring the fields of the component view in a very customizable manner, thus overriding the model descriptor defaults. Each property view descriptor copntained in the list describes a form field that will be rendered in the UI accordingly.

For instance, a writable property can be made specifically read-only on this component view by specifying its property view descriptor read-only. In that case, the model remains untouched and only the view is impacted.

Following the same scheme, you can assign a list of writability gates on a field to introduce dynamic field editability on the view without modifying the model.

A last, yet important, example of column view descriptor usage is the role-based field set configuration. Whenever you want a field to be available only for certain user roles (profiles), you can configure a field property view descriptor with a list of granted roles. If the user doesn't have the field(s)required role, the forbidden field(s) simply won't be displayed. This allows for high authorization-based versatility.

There are many other usages of defining field property view descriptors (like individual labels color and font), all of them being linked to customizing the form fields without impacting the model.

propertyWidths

Map​<​String​,Object​>​

This property allows to simply define property spans in the underlying grid without having to extensively define the propertyViewDescriptors property. It must be configued with a Map containing only the properties that need to span more than 1 column. The other properties will follow the default span of 1.

The Map is :

  • keyed by the name of the property

  • valued by the number of columns of the property span

Default value is null, meaning all property fields have a span of 1.

renderedChildProperties

Map​<​String​,List​>​

Whenever a rendered property is not scalar, this property allows to override which of the referenced component fields should be displayed :

  • as columns when the rendered property is a collection property

  • as fields when the rendered property is a reference property

The property must be configured with a Map which is :

  • keyed by the non-scalar property name

  • valued by the list of the property names to render for the child element(s)

A null value (default), means that all non-scalar properties will be rendered using default rendered properties as specified in their referenced model descriptor.

Please note that this is quite unusual to embed non-scalar properties directly in a component view. Although permitted, you won't have as much flexibility in the content layouting as you would have when using composite views; so the latter is by far recommended.

renderedProperties

List​<​String​>​

This is somehow a shortcut to using the propertyViewDescriptors property. Instead of providing a full-blown list of property view descriptors to configure the component view fields, you just pass-in a list of property names. view fields are then created from this list, keeping model defaults for all fields characteristics.

Whenever the property value is null (default), the fields list is determined from the component descriptor renderedProperties property.


BasicPropertyViewDescriptor

This view descriptor serves 2 purposes :

  • configure complex, component based views : refine columns of table views and fields of component (form) views.

  • display a single property as an autonomous view, i.e. not as a table column or a form field.

The second usage might be a little bit unusual, but here is a use-case scenario : display a text area which maps a text property that contains XML content. This text area must be displayed in a split pane and provide actions to interact directly with the FS (save content to a file, load content from a file, ...). In that case, defining a property view alone on the text property of the owning component might be a good solution.

Table III.10. BasicPropertyViewDescriptor properties

PropertyDescription

action

IAction

Configures the action to be triggered when acting on this property. There are 2 cases :

  1. If the property is read-only, then assigning an action turns the property into a clickable hyperlink

  2. If the property is read-write, the registered action will be trigerred when the user changes the value of the field. Note thet in that case, the action is executed after the model has been updated. However the old property value can be retrieved from the context action param.

horizontalAlignment

EHorizontal​Alignment

This property allows to control the property alignment in views that support it. This is either a value of the EHorizontalAlignment enum or its equivalent string representation :

  • LEFT for left alignment

  • CENTER for center alignment

  • RIGHT for right alignment

Default value is null, meaning use property type default.

labelBackground

String

When the property has to be labelled (e.g. in a component view), this property defines the background color of the corresponding label. It might differ from the field component one. The color must be defined using its string hexadecimal representation (0xargb encoded).

Default value is null, meaning use UI default.

labelFont

String

When the property has to be labelled (e.g. in a component view), this property defines the font of the corresponding label. It might differ from the field component one. The font must be string encoded using the pattern "[name];[style];[size]" :

  • [name] is the name of the font, e.g. arial.

  • [style] is PLAIN, BOLD, ITALIC or a union of BOLD and ITALIC combined with the '|' character, e.g. BOLD|ITALIC.

  • [size] is the size of the font, e.g. 10.

Any of the above pattern section can be left empty, thus falling back to the component default.

Default value is null, meaning use default component font.

labelForeground

String

When the property has to be labelled (e.g. in a component view), this property defines the foregroud color of the corresponding label. It might differ from the field component one. The color must be defined using its string hexadecimal representation (0xargb encoded).

Default value is null, meaning use UI default.

renderedChildProperties

List​<​String​>​

Whenever the property decriptor backing the view is not scalar, this property allows to override which of the referenced component fields should be displayed :

  • as columns when the rendered property is a collection property

  • as fields when the rendered property is a reference property

The property must be configured with a List containing the property names to render for the child element(s).

A null value (default), means that the non-scalar property will be rendered using default rendered properties as specified in its referenced model descriptor.

Please note that this is quite unusual to embed non-scalar properties directly in a property view. Although permitted, you won't have as much flexibility in the content layouting as you would have when using composite views; so the latter is by far recommended.

sortable

boolean

Configure the sortability of a property view when used to defines a table column for instance. Whenever it is not explicitely set, it falls back to the model property sortability. If no model descriptor is set, defaults to true.

width

Integer

When the property has to be displayed in a grid-like layout (e.g. in a component view), this property defines the umber of grid columns the corresponding UI component will span.

Default value is null, meaning use default span of 1.


BasicEnumerationPropertyViewDescriptor

This specialized property view descriptor is used in order to be able to refine the "values" that are taken from the model enumeration. You can configure a set of allowed values from which the user can choose.

Table III.11. BasicEnumerationPropertyViewDescriptor properties

PropertyDescription

allowedValues

Set​<​String​>​

Returns an optional forbidden set of values to restrict the model ones. Only values belonging to the allowed ones should actually be made available as a choice.

forbiddenValues

Set​<​String​>​

Returns an optional forbidden set of values to restrict the model ones. Only values not belonging to the forbidden ones should actually be made available as a choice.

orientation

EOrientation

Configures wether radio values be rendered horizontally or vertically. HORIZONTAL if radio values should be rendered horizontally and VERTICAL otherwise. Default value is VERTICAL.

radio

boolean

Configures the rendering of the enumeration property as radio buttons if supported instead of combobox. Default value is false.


BasicImageViewDescriptor

This type of view descriptor is used to display a binary property or a string property containing an URL as an image. By default, binary properties are rendered as button fields that allow to upload, download and query size of the binary content. This button field visually indicate whether the binary property is empty or not. Whenever you know that the underlying property is used to store image content, you can explicitely define an image view backed by the binary property descriptor and use it in your UI. Jspresso will then display the image whose content is stored in the binary property directly in the UI.

Table III.12. BasicImageViewDescriptor properties

PropertyDescription

scrollable

boolean

Configures the image view to be either croped or scrollable when the display area is too small to display it. A value of true (default) means that the image view will be made scrollable.


BasicReferencePropertyViewDescriptor

This specialized property view descriptor is used in order to be able to refine the "List of values" action that gets automatically installed by Jspresso when a reference property is displayed. You can then customize this action when defining the corresponding column in a table view or field in a component view.

Table III.13. BasicReferencePropertyViewDescriptor properties

PropertyDescription

lovAction

IDisplayable​Action

Allows to override the default "List of values" action attached to this reference property view.

A null value (default) keeps the standard action.


BasicTreeViewDescriptor

This descriptor is use to design a tree view. The way to define a tree view in Jspresso is a matter of assembling tree level descriptors hierarchically. A tree level descriptor is a group of sibling nodes that usually represent a component collection property. Each individual tree node collection can be secured by using role-based authorization (i.e. grantedRoles) on its descriptor.

Table III.14. BasicTreeViewDescriptor properties

PropertyDescription

childDescriptor

ITree​Level​Descriptor

Configures the first tree level as being a single collection of sibling nodes. For instance, if the child tree level is mapped to a collection (collA) containing 5 elements (collA_Elt-1 to 5), the tree would look like :

 rootItem
   collA_Elt-1
   collA_Elt-2
   collA_Elt-3
   collA_Elt-4
   collA_Elt-5
 

In the example above, you should notice that there is no need for the tree to install an intermediary node to visually group the collection elements since the collection is alone on its level.

This property is only used if the rootSubtreeDescriptor is not explicitely set. In the latter case, nested subtrees are determined from the rootSubtreeDescriptor.

childrenDescriptors

List​<​ITree​Level​Descriptor​>​

Configures the first tree level as being a list of collections of sibling nodes (subtrees). For instance, if the children tree levels are mapped to 2 collection properties (collA, collB) each containing 3 elements (collA_Elt-1 to 3 and collB_Elt-1 to 3), the tree would look like :

 rootItem
   collA
     collA_Elt-1
     collA_Elt-2
     collA_Elt-3
   collB
     collB_Elt-1
     collB_Elt-2
     collB_Elt-3
 

In the example above, you should notice intermediate collection property grouping nodes (collA and collB in italic). They automatically appeared to clearly group the tree nodes belonging to the different collections.

This property is only used if the rootSubtreeDescriptor is not explicitely set. In the latter case, nested subtrees are determined from the rootSubtreeDescriptor.

expanded

boolean

Setting this property to true configures the created tree to appear with its node expanded. A value of false (default) means that the tree nodes are initially collapsed.

iconImageURLProvider

IIcon​Image​URLProvider

The icon image URL provider is the delegate responsible for inferring a tree node icon based on its underlying model. By default (i.e. when iconImageURLProvider is null), Jspresso will use the underlying component descriptor icon, if any. Using a custom icon image URL provider allows to implement finer rules like using different icons based on the underlying object state. There is a single method to implement to achieve this :

String getIconImageURLForObject(Object userObject);

itemSelectionAction

IAction

This property alows to bind an action that gets triggered every time the selection changes on the tree view. The action context passed to the action when it is executed is the same as if it had been registered on the tree view.

maxDepth

int

This property is used only when the tree (or sub-tree) is declared recursively, i.e. a tree level belongs to its own children hierarchy. Default value is 10, meaning that a maximum number of 10 levels can be nested.

renderedProperty

String

This property allows to define the model property used to label the root node.

This property is only used if the rootSubtreeDescriptor is not explicitely set. In the latter case, renderedProperty is determined from the rootSubtreeDescriptor.

rootSubtreeDescriptor

ITree​Level​Descriptor

This property allows to explicitely define the tree root level as any other level. Most of the time, you will prefer using the following shortcut properties :

  • childDescriptor

  • childrenDescriptors

  • renderedProperty

Whenever rootSubtreeDescriptor is explicitely set, the properties above are simply ignored since all values are determined from rootSubtreeDescriptor.

rowAction

IAction

Registers an action that is implicitely triggered everytime a row is activated (e.g. double-clicked for current UI channels) on the collection view UI peer. The context of the action execution is the same as if the action was registered in the view action map.


III.1.2.2. Reference for BasicTreeLevelDescriptor hierarchy

BasicTreeLevelDescriptor

This is the base descriptor for all tree levels. A tree level is a collection of sibling nodes that belong to the same formal collection (usually a component collection property). This base descriptor does not accept nested subtrees so it is only used to describe a collection of leaf nodes. If you need to describe intermediary tree levels, yous will use one of the 2 subtypes :

  • BasicSimpleTreeLevelDescriptor to define a collection of tree nodes that accept a single subtree

  • BasicCompositeTreeLevelDescriptor to define a collection of tree nodes that accept a list of subtrees

Defining a tree level is mainly a matter of defining its representation as an individal list of components (i.e. the nodeGroupDescriptor property).

Table III.15. BasicTreeLevelDescriptor properties

PropertyDescription

grantedRoles

Collection​<​String​>​

Assigns the roles that are authorized to use this subtree. It supports "!" prefix to negate the role(s). Whenever the user is not granted sufficient privileges, the subtree is simply hidden. Setting the collection of granted roles to null (default value) disables role based authorization on the node group level. The framework then checks for the model roles authorizations and will apply the same restrictions. If both view and model granted roles collections are null, then access is granted to anyone.

nodeGroupDescriptor

IList​View​Descriptor

Describes the collection of sibling nodes (node group) as a if it were a list view. This is how you instruct Jspresso the type of the components that are used as model behind the tree nodes and which model property is used to compute the node labels. Most of the other properties defined on the node group descriptor itself are ignored (font, color, selection action, ...) since a tree group is not a "real" view but just a mean of defining a subtree. All these properties that are ignored on the tree group can be defined on the tree view itself.

permId

String

Sets the permanent identifier to this application element. Permanent identifiers are used by different framework parts, like dynamic security or record/replay controllers to uniquely identify an application element. Permanent identifiers are generated by the SJS build based on the element id but must be explicitely set if Spring XML is used.


BasicCompositeTreeLevelDescriptor

This descriptor is used to describe a collection of sibling nodes that each nest multiple subtrees. The children subtrees are each placed under an intermediary grouping node. For instance, given a composite tree level mapping a collection of As and whose children are 2 tree levels mapping respectively a collection Ys and Zs, the tree would look like :

 parent
   A-1
     collY
       Y-1.1
       Y-1.2
     collZ
       Z-1.1
       Z-1.2
       Z-1.3
   A-2
     collY
       Y-2.1
       Y-2.2
       Y-2.3
     collZ
       Z-2.1
   A-3
     collY
       Y-3.1
       Y-3.2
     collZ
       Z-3.1
       Z-3.2
 

You can notice the intermediary grouping nodes that are installed to visually separate the 2 collection families (Y and Z).

Table III.16. BasicCompositeTreeLevelDescriptor properties

PropertyDescription

childrenDescriptors

List​<​ITree​Level​Descriptor​>​

Assigns the list children tree level descriptors. A null value (default) makes this tree level a leaf tree level and is strictly equivalent to declaring a BasicTreeLevelDescriptor instead.


BasicSimpleTreeLevelDescriptor

This descriptor is used to describe a collection of sibling nodes that only nest a single subtree. The child subtree is directly placed under each node without any intermediary grouping node. For instance, given a simple tree level mapping a collection of As and whose child is a tree level maping a collection of Bs, the tree would look like :

 parent
   A-1
     B-1.1
     B-1.2
     B-1.3
   A-2
     B-2.1
   A-3
     B-3.1
     B-3.2
 

Table III.17. BasicSimpleTreeLevelDescriptor properties

PropertyDescription

childDescriptor

ITree​Level​Descriptor

Assigns the single child tree level descriptor. A null value (default) makes this tree level a leaf tree level and is strictly equivalent to declaring a BasicTreeLevelDescriptor instead.