[
http://jira.nuxeo.org/browse/NXP-1518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_25287
]
Anahide Tchertchian commented on NXP-1518:
------------------------------------------
Layout service
==============
Layout service: component that handles a registry of named layouts and
associated api to access them.
API:
getLayout(id, mode)
...
A layout definition:
<layout id="dublincore">
<!-- optional source used to organize widget calls -->
<source></source>
<widget id="title" type="text">
<labels>
<!-- default label (no mode specified) -->
<label>label.dublincore.title</label>
<label mode="edit"></label>
</labels>
<description>foo</description>
<help>bar</help>
<!-- translate labels, description, help... -->
<translate>true</translate>
<!-- field with schema, field name and optional id -->
<fields>
<field schema="dublincore" name="title" id="text">
</fields>
<!-- if a mode is given, it overwrites the layout mode ;
no expressions allowed for now (?) -->
<mode>view</mode>
<!-- jsf properties to apply when rendering the document ;
EL expressions accepted -->
<properties>
<property name="rendered">true</property>
<property name="required">#{!currentUser.administrator}</property>
<!-- other common components attributes: onclick, etc...-->
<property name="styleClass">dataInputText</property>
</properties>
<!-- properties for a given mode -->
<properties>
<mode>edit</mode>
<mode>create</mode>
<property name="rendered">false</property>
</properties>
</widget>
<widget id="subjects" type="list">
<fields>
<field schema="dublincore" name="subjects">
</fields>
<properties>
<property name="directory">subject</property>
</properties>
</widget>
<!-- widget for lists/sub fields -->
<widget id="files" type="complexList">
<fields>
<field schema="files" name="files">
</fields>
<subwidget id="file" type="file">
<subfields>
<subfield name="content" id="blob">
<subfield name="filename" id="filename">
</subfields>
</subwidget>
</widget>
</layout>
Usage in xhtml file:
<nx:widget widget="widget" document="document" mode="mode" />
The specific component handler used to manage widgets will put components
defined in the widget type definition in the tree at creation time.
It will derive from the CompositeFaceletTagHandler.
Specific tag handlers can be defined to do specific work (properties setting
for instance).
When a source is mentioned, it is used as if it was defined using a
ui:decorate tag.
Widget type definition:
<widget type="text">
<handler-class>org.nuxeo.ecm.platform.layout.WidgetTagHandler</handler-class>
<!-- optional component description using default implementation -->
<components mode="view">
<component id="text">
<component-type>...</component-type>
<renderer-type>...</renderer-type>
<handler-class>...</handler-class>
<source>...</source>
</component>
</components>
<components mode="edit">
<component id="text">
<component-type></component-type>
<renderer-type></renderer-type>
<handler-class></handler-class>
<source></source>
</component>
<component id="message">
....
</component>
</components>
</widget>
Link to document types
======================
Documents types can be configured to use registered layouts.
This will be added to a type definition:
<type id="Root" coretype="Root">
<label>Server Root</label>
<icon>/icons/folder.gif</icon>
...
<layoutClusters>
<!-- default cluster (no mode specified) -->
<cluster>
<layout>dublincore</layout>
</cluster>
<!-- do not display -->
<cluster mode="create">
<layout>dublincore</layout>
<layout>file</layout>
</cluster>
</layoutClusters>
</type>
Document layout service api:
getLayout(document, mode)
<nx:cluster document="document" name="default" mode="edit" />
will call recursively <nx:layout document="document" name="layout_id"
mode="edit" /> for each layout in given cluster.
This will call recursively the associated nx:widget tags.
Layout can be generated using the old layout system for compatibility
purposes, or generated automatically using the schema definition (?).
> Layout system
> -------------
>
> Key: NXP-1518
> URL: http://jira.nuxeo.org/browse/NXP-1518
> Project: Nuxeo Enterprise Platform 5
> Issue Type: Task
> Reporter: Anahide Tchertchian
> Assignee: Anahide Tchertchian
> Fix For: 5.2 M1
>
>
> Form automatic generation using an XML configuration.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets