how could i put the tree in a widget on the dashboard??

i need to see the tree in the dashboard. i have the idea to create my own widget type using the template /incl/directory_tree_explorer.xhtml (i think thats the tree´s template if i am wrong, please tell me)

here is the code how i am doing it

all is in the layouts-dashboard-contrib.xml on nuxeo-user-dashboard-jsf.jar

<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
point="layouts">

<layout name="grid_dashboard_layout">
  <templates>
    <template mode="any">
      /layouts/layout_grid_template.xhtml
    </template>
  </templates>
  <rows>
    <row>
      <properties mode="any">
        <property name="nxl_gridStyleClass_0">gridStyle6</property>
        <property name="nxl_gridStyleClass_1">gridStyle6</property>
      </properties>
      <widget>dashboard_left</widget>
      <widget>dashboard_right</widget>
      <widget>arbol_widget</widget>
    </row>
  </rows>
</layout>

and then i create the widget

<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
point="widgettypes">

<widgetType name="arbol_widget_type">
  <handler-class>
    org.nuxeo.ecm.platform.forms.layout.facelets.plugins.TemplateWidgetTypeHandler
  </handler-class>
  <property name="template">
    /incl/directory_tree_explorer.xhtml
  </property>
</widgetType>

<widget name="arbol_widget" type="arbol_widget_type">
  <labels>
    <label mode="any"></label>
  </labels>
  <properties widgetMode="any">
    <property name="category">DASHBOARD_RIGHT</property>
  </properties>
  <fields>
    <field>arbol_widget:directoryTreeNav</field>
  </fields>
  <properties widgetMode="any">
    <property name="template">/incl/directory_tree_explorer.xhtml</property>
  </properties>
</widget>

i´ll appreciate if someone help me

thanks ;)

0 votes

1 answers

2121 views

ANSWER



Hi,

I think you may be confusing widgets displaying content (like your tree) and widgets displaying other widgets via actions configuration.

The widgets named “dashboard_left” and “dashboard_right” are widgets stacking other widgets. The global grid layout configuration (with associated styles in the row property, names nxl_gridStyleClass_0, nxl_gridStyleClass_1) does not need to be altered for you to add your own widget to the dashboard. You only need to redefine this layout configuration if you'd like to change the “2 columns” appearance. Documentation about this configuration is here: http://doc.nuxeo.com/x/UYao

Now if you want to add your widget to the right column, for instance, you need to add an action in this category, with type “widget”, and reference the widget name in its property “widgetName”. Your widget can be declared independently (as you did) but it's not the one holding the action category “DASHBOARD_RIGHT”, it's the action. This configuration is visible at the end of the file you're referring to: https://github.com/nuxeo/nuxeo-user-center/blob/release-5.6/nuxeo-user-dashboard/nuxeo-user-dashboard-jsf/src/main/resources/OSGI-INF/layouts-dashboard-contrib.xml (and you should not duplicate the tag properties widgetMode=“any” in a given widget configuration)

The widget type configuration looks ok, but the directory_tree_explorer.xhtml template is not a widget template: it should display its usual content in the dashboard, that is virtual navigations (btw are you sure that you're using the jsf dashboard, and not the opensocial one with gadgets?). But the field configuration “arbol_widget:directoryTreeNav” will be ignored, and i'm not sure what it refers to for your use case.

Hope this helps

1 votes