Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Rename macro 'n' to 'mgnl-n'.

...

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue
mgnl-p
compositesimpleText
some text value
mgnl-p
compositesimpleDate
2006-05-01T21:47:58.230+02:00

...

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue
mgnl-p
switchable
text (last tab selected)
mgnl-p
switchablesimpleText
some text value
mgnl-p
switchablesimpleDate
2006-05-01T21:47:58.230+02:00

...

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
formNode

 

   
mgnl-p
simpleText
Simple English Text
   
mgnl-p
simpleText_de
Einfache deutsche Text
   
mgnl-p
multiValueText
English1,English2,English3
   
mgnl-p
multiValueText_de
Deutsche1,Deutsche2

...

  • return true for Transformer.hasI18NSupport() 
  • implement a compatible Magnolia i18n logic.

Default Value

ConfiguredFieldDefinition.defaultValue  contains the String representation of the default value.

The default value is only showed the first time the related form is displayed.

This behavior is only supported by  basic field

Implemented

Property

A field needs to be linked to a property as data source. The value of the property is used to store the value entered/selected by the user on the field.
In Magnolia 5.1, every field are bound to a property that support Transformer called TransformedProperty.
This property is initialized with the configured Transformer and set to the field as datasource by the FieldFactory.

 

Mockup
Nameww

A ConfiguredField is linked to a TransformedProperty<T>. 

  • TransformedProperty<T> 

...

 

BaseProperty

BaseProperty implements the following basic mechanism:

  • Handle i18n support.
  • Delegate the configured handler the request  when property.getValue() and property.setValue() are called.

 

Implemented Handlers

 

BasicPropertyHandler

Overview

Mockup
Namebasic

...

  • is initialized with a Transformer.

TransformedProperty<T> extend ObjectProperty<T>.

  • value T : Transformer.readFromItem()
  • T : Transformer.getType()

The Transformer has the responsibility to retrieve the initial value and to set the property class type.

TransformedProperty<T>  may be of any type. For a TextField configured to handle Long (ConfiguredFieldDefinition.type = Long), the <T>  will be of type Long.
For complexer Field (Multi, Composite) the <T> is of type PropertysetItem . This let the complex field easily handle multi property.

Implemented Transformer

BasicTransformer

The property linked to a field is retrieved and stored based on the Field's  property name defined in the field definition.

A new property is created in case id does not yet exist.

...

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue
   
mgnl-p
simpleText
Simple English Text
   
mgnl-p
simpleText_de
Einfache deutsche Text
   
mgnl-p
simpleText_fr
Simple text en francais
OptionGroupPropertyHandler

In case of an OptionGroup field is defined as multiselect, the selected values are stored as a JCR multi-value-property. This JCR multi-value-property is normally handled as a List, but the underlying Vaadin field is only working with Set . This handler simply convert  List to Set

TextCodePropertyHandler

Simple TextCode Handler that return an empty String instead of a null property value.

TwinSelectPropertyHandler

Like for the OptionGroup field, the underlying Vaadin Field need additional convertor between List to Set.

...

CompositeTransformer

In addition to the CompositeField and SwitchableField default Handler Transformer, we provide two an additional CompositeHandlerTransformer:

SubNodeCompositeHandler

 SubNodeCompositeHandler  will store the  property values of the fields composing the composite field under the following format:

...

enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse

...

formNode

...

 

...

Second field name composing the
Composite field

...

NoOpCompositeTransformer

NoOpCompositeTransformer

...

Third field name composing the
Composite field

...

(warning) This Handler do not support i18n (in Magnolia 5.1).

NoOpCompositeHandler

NoOpCompositeHandler is useful if you want to combine a Multi filed storing individual field value into sub nodes with composite field as Multi field component.

Mockup
Namen

In this case, the Multi field handler field Transformer will createread/read write the node Item structure and pass a properties as PropertysetItem to the NoOpCompositeHandler NoOpCompositeTransformer. This handler This Transformer just act as a property container. 

MultiTransformer

...

MultiValueTransformer
MultiValuesPropertyMultiHandler

This is the default Handler default Transformer set for Multi value fields. The fields values are stored in a LinkedList<T> . This LinkedList<T> is then automatically convert to a JCR multi-value-property once it is persisted.
(warning) This will only work for simple fields like text/date/radio...

...

MultiValueJSONTransformer

Handler storing Transformer storing the fields values as a String with ',' as separator.
(warning) This will only work for simple fields like text/date/radio... and values are stored as String.

...

MultiValueChildrenNodeTransformer

HandlerTransformer storing the fields values in sub node item property: (Equivalent Jcr Structure of the form Item)

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameElement nameValue

Mgnl n
formNode

 

 

   
Mgnl n
00
Incremental child node name 
       
mgnl-p
multi
Multi field nameTyped value in the First field
   
Mgnl n
01
Incremental child node name 
       
mgnl-p
multi

Multi field name

 yped Typed value in the Second field
   
Mgnl n
02
Incremental child node name 
       
mgnl-p
multi

Multi field name

Typed value in the Third field
SubNodesMultiPropertysetItemHandler
MultiValueSubChildrenNodePropertiesTransformer

Transformer storing each field values into a sub Item. Equivalent to MultiValueChildrenNodeTransformer but this Transformer is able to handle multiple values.  Based on the previous NoOpCompositeHandlero previous NoOpCompositeTransformer example:

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameElement nameValue

Mgnl n
formNode

 

 

   
Mgnl n
multi
Multi field name 
       
Mgnl n
00
Incremental child node name 
           
mgnl-p
text

Text field name composing the
Composite field

Typed value in the Text field
           
mgnl-p
date
Date field name composing the
Composite field
Selected date
           
mgnl-p
select
Select field name composing the
Composite field
Selected selection
       
Mgnl n
 01
Incremental child node name 
           
mgnl-p
text

Text field name composing the
Composite field

Typed value in the Text field
           
mgnl-p
date
Date field name composing the
Composite field
Selected date
           
mgnl-p
select
Select field name composing the
Composite field
Selected selection
       
Mgnl n
02
Incremental child node name 
           
mgnl-p
text

Text field name composing the
Composite field

Typed value in the Text field
           
mgnl-p
date
Date field name composing the
Composite field
Selected date
           
mgnl-p
select
Select field name composing the
Composite field
Selected selection

...

MultiValueSubChildrenNodeTransformer

Handler creating Transformer creating first a child node (named as the multi field) and storing the fields values in sub node property (equivalent to MultiValueChildrenNodeTransformer) :

Advanced Tables - Table Plus
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameElement nameValue

Mgnl n
formNode

 

 

   
Mgnl n
multi
Multi field name 
       
Mgnl n
038a2c75-2638-48e6-a
Incremental child node name 
           
mgnl-p
multi
Multi field name038a2c75-2638-48e6-a6ba-9bd2a9fe6c78
       
Mgnl n
 72e2ef55-6c11-4b0e-8
Incremental child node name 
           
mgnl-p
multi

Multi field name

 72e2ef55-6c11-4b0e-8e02-d47c4ad41083
       
Mgnl n
11bbf78b-4ecf-4e9f-a
Incremental child node name 
           
mgnl-p
multi

Multi field name

11bbf78b-4ecf-4e9f-a06e-6181ef56d98c

 

 

Limitation

 

How to

 

Open Issue

Default value handling

The field definition allows to define a default value as a String:

  • Text field, type is String default value is 'default value'
  • Text field, type is Long default value is 1000l
  • ....

This default value should be displayed in the related form field if ????

  • It is a new Form
    • (plus) easy to implement
    • (minus) if a field is added to an existing form, this default value will never be displayed.
    • (thumbs up) chooses solution
  • If the property related to a form is null (currently if a property has an empty value, this property is removed or not saved)
    • (plus) easy to implement
    • (minus) if a user remove the default value associated to a field --> no property saved. When he will reopen this form, the default value will be displayed again
  • ??

...