nuxeo world session: layouts and content views

31
1 Layouts and content views Managing reusable UI components Anahide Tchertchian

Upload: nuxeo

Post on 18-Nov-2014

2.482 views

Category:

Technology


1 download

DESCRIPTION

Nuxeo World session on managing reusable UI components in Nuxeo technology, presented by Anahide Tchertchian during Nuxeo World 2010 (November 17-18, 2010).

TRANSCRIPT

Page 1: Nuxeo World Session: Layouts and Content Views

1

Layouts and content viewsManaging reusable UI components

Anahide Tchertchian

Page 2: Nuxeo World Session: Layouts and Content Views

2

Layouts and content views● Layouts concepts and implementation● Content view concepts

● Folder content● Advanced search● Smart search

● Layouts configuration● Studio● Showcase

Page 3: Nuxeo World Session: Layouts and Content Views

3

Layouts

Page 4: Nuxeo World Session: Layouts and Content Views

4

Layout Concepts● Forms● Layouts● Rows/columns● Widgets● Modes

Page 5: Nuxeo World Session: Layouts and Content Views

5

Definitions: layout<layout name="dublincore"> <templates> <template mode="any"> /layouts/layout_default_template.xhtml </template> </templates> <rows> <row> <widget>nature</widget> </row> <row> <widget>subjects</widget> </row> </rows></layout>

Page 6: Nuxeo World Session: Layouts and Content Views

6

Definitions: widget 1/2<widget name="title" type="text"> <labels> <label mode="any">title</label> </labels> <translated>true</translated> <fields> <field>dc:title</field> </fields> <properties widgetMode="edit"> <property name="required">true</property> <property name="styleClass"> DataInputText </property> </properties></widget>

Page 7: Nuxeo World Session: Layouts and Content Views

7

Definitions: widget 2/2<widget name="created" type="datetime"> <labels> <label mode="any"> label.dublincore.created </label> </labels> <translated>true</translated> <fields> <field>dc:created</field> </fields> <properties widgetMode="any"> <property name="pattern"> #{nxu:basicDateAndTimeFormater()} </property> </properties> <widgetModes> <mode value="any">view</mode> </widgetModes></widget>

Page 8: Nuxeo World Session: Layouts and Content Views

8

Implementation with JSFUsed technologies:● JSF: Java Server Faces● Facelets● EL: Expression language

Implementation:➔ Custom service➔ Custom tag library using facelets templating

features

Page 9: Nuxeo World Session: Layouts and Content Views

9

Facelets usage

Output text

Input textError message

Page 10: Nuxeo World Session: Layouts and Content Views

10

Loose object binding

Binding between a document and a layout:

<nxl:layout name="header" mode="view" value="#{currentDocument}" />

After layout facelet handlers applied:

<h:outputText value="#{currentDocument.dc.title}" />

Page 11: Nuxeo World Session: Layouts and Content Views

11

Layout for a workflow task

Page 12: Nuxeo World Session: Layouts and Content Views

12

Layout for any UI component

Page 13: Nuxeo World Session: Layouts and Content Views

13

Content Views

Page 14: Nuxeo World Session: Layouts and Content Views

14

Content view usageGet a list of items and render them

● Query with filters● Contextual parameters● Rendering of the list and content● Sorting and pagination

Page 15: Nuxeo World Session: Layouts and Content Views

15

Content view concepts

Page providerdefinition

Search layout

Page provider

Result layout

Page 16: Nuxeo World Session: Layouts and Content Views

16

Page provider 1/2<coreQueryPageProvider> <property name="coreSession"> #{documentManager} </property>

<pattern> SELECT * FROM Document WHERE ecm:parentId = ? AND ecm:isCheckedInVersion = 0 AND ecm:mixinType != 'HiddenInNavigation' AND ecm:currentLifeCycleState != 'deleted' </pattern> <parameter>#{currentDocument.id}</parameter>

<sort column="dc:title" ascending="true" /> <pageSize>20</pageSize></coreQueryPageProvider>

Page 17: Nuxeo World Session: Layouts and Content Views

17

Page provider 2/2

<coreQueryPageProvider> <property name="coreSession"> #{documentManager} </property>

<whereClause docType="AdvancedSearch"> <predicate parameter="dc:title" operator="FULLTEXT"> <field schema="advanced_search" name="title" /> </predicate> … </whereClause>

<sort column="dc:title" ascending="true" /> <pageSize>20</pageSize></coreQueryPageProvider>

Page 18: Nuxeo World Session: Layouts and Content Views

18

Content View

<contentView name="current_document_children">

<searchLayout name="search_layout" /> <searchDocument>#{searchDocument}</searchDocument>

<coreQueryPageProvider>...</coreQueryPageProvider>

<resultLayouts> <layout name="document_listing" /> </resultLayouts>

</contentView>

Page 19: Nuxeo World Session: Layouts and Content Views

19

Adaptability● Use standard layouts● Pluggable page provider to perform any

kind of query

Page 20: Nuxeo World Session: Layouts and Content Views

20

Smart search addon demo

Page 21: Nuxeo World Session: Layouts and Content Views

21

Smart search folder demo

Page 22: Nuxeo World Session: Layouts and Content Views

22

Result layouts 1/2● Layouts iteration● Loose mapping between listing item and

result layout● More information on layout rows/columns:

● Column label● Sort

Page 23: Nuxeo World Session: Layouts and Content Views

23

Result layouts 2/2Column selection

Page 24: Nuxeo World Session: Layouts and Content Views

24

Layouts configuration

Page 25: Nuxeo World Session: Layouts and Content Views

25

Layouts for widget types« Meta » layouts, or layouts for layouts configuration:

● Studio configuration● Documentation● Preview

Page 26: Nuxeo World Session: Layouts and Content Views

26

Studio configuration

Page 27: Nuxeo World Session: Layouts and Content Views

27

Documentation demo

Page 28: Nuxeo World Session: Layouts and Content Views

28

Preview demo

Page 29: Nuxeo World Session: Layouts and Content Views

29

Next features● Listing layouts and content views

configuration in Studio● GWT and Freemarker implementation of

layouts and content views

Page 30: Nuxeo World Session: Layouts and Content Views

30

Developer documentation● http://doc.nuxeo.com/display/NXDOC/Layouts

● http://doc.nuxeo.com/display/NXDOC/Content+views

● http://doc.nuxeo.com/display/NXDOC/Search

Page 31: Nuxeo World Session: Layouts and Content Views

31

Thank you!

Questions?