Incremental Layouts and Actions

Updated: November 10, 2022

JSF UI Deprecation
This requires to have the JSF UI addon installed on your server that is deprecated since Nuxeo Platform LTS 2019.
Please refer to the Web UI documentation.

Actions are leveraged by the layout framework to include widgets inside layouts dynamically, benefiting from sorting and filtering features of actions within layouts.

Configuration is a bit overkill for now; this could be simplified in the future, but the main principle is to:

  1. Define a layout including action widgets.
  2. Define action widgets referencing an action category (depending on the use case).
  3. Define actions with type widget within this category, referencing a widget name.
  4. Define widgets with corresponding names.

Here is a complete example, taken from the default Nuxeo Summary layout, and showing how some widgets are shown conditionally on the page.

Summary Layout Definition

<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
  <layout name="grid_summary_layout">
      <template mode="any">
        <properties mode="any">
          <property name="nxl_gridStyleClass_0">gridStyle12</property>
        <properties mode="any">
          <property name="nxl_gridStyleClass_0">gridStyle7</property>
          <property name="nxl_gridStyleClass_1">gridStyle5</property>
        <properties mode="any">
          <property name="nxl_gridStyleClass_0">gridStyle12</property>

This layout is using a grid, so that widgets are piled up within grid slots and stacked up correctly when some widgets are not displayed.

Let's look at the summary_panel_left widget configuration:

Action Widget Definition

<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
  <widget name="summary_panel_left" type="documentActions">
      <label mode="any"></label>
    <properties widgetMode="any">
      <property name="category">SUMMARY_PANEL_LEFT</property>
      <property name="subStyleClass">summaryActions</property>

Actions can be displayed by this widget when using the category SUMMARY_PANEL_LEFT. Here is a sample action configuration:

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  <action id="summary_note_text" type="widget" order="100">
      <property name="widgetName">summary_note_text</property>

This action is using the type widget, referencing the widget named summary_note_text. Note that it's also using a filter that makes sure the widget will be shown only when the document has a schema named note:

<extension target="org.nuxeo.ecm.platform.actions.ActionService"
  <filter id="hasNote">
    <rule grant="true">

Finally, here is the widget configuration:

<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
  <widget name="summary_note_text" type="richtext_with_mimetype">
    <properties mode="view">
      <property name="translatedHtml">
      <property name="cssClass">note_content_block</property>
    <controls mode="any">
      <control name="requireSurroundingForm">true</control>

Note that the widget holds a control to make sure a form is added around it: the summary layout is not surrounded by a form since version 5.8 to allow defining fine-grained forms inside it.


We'd love to hear your thoughts!

All fields required