7 Replies Latest reply: Mar 31, 2011 10:41 AM by Nick Scavelli RSS

Portlet decoration - configuration in pages.xml

Michal Vanco Newbie

Hi,

 

is there some way how to configure portlet decoration in pages.xml file?

 

I don't see the option at schema: http://www.gatein.org/xml/ns/gatein_objects_1_0

 

Thanks a lot, Michal Vanco

  • 1. Portlet decoration - configuration in pages.xml
    Vu Viet Phuong Novice

    Yes, you can add some tags :

     

          <show-info-bar>false</show-info-bar>

          <show-application-state>false</show-application-state>

          <show-application-mode>false</show-application-mode>

     

    as childs of tag <portlet-application> in pages.xml file to config portlet as you want. You can look at an example in GateIn : $GateIn/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/pages.xml

    Notice that our HomePagePortlet is configured in this file so that it doesn't have any decoration !

  • 2. Portlet decoration - configuration in pages.xml
    Michal Vanco Newbie

    Hi,

     

    thanks for your reply but that's not what I'm looking for.

     

    We have created new "Decoration themes" and we want to configure the theme for some specific portlet.

    I know that there is a way how to set default decoration theme for skin so that it's used for all portlets after skin change.

    But what if we need to set other theme for just one portlet?

    That's something what is not present at current schema.

     

    Thanks, Michal

  • 3. Re: Portlet decoration - configuration in pages.xml
    Minh Hoang TO Novice

    There is no way to configure the theme from .xml for the moment.

     

    GateIn uses JIBX to convert XML into Java Object, the element <portlet-application> in pages.xml is converted into instance of class org.exoplatform.portal.config.model.Application. The JIBX configuration applied to component of UIFramework is  component/portal/src/main/resources/binding.xml

     

     

    <mapping name="portlet-application"

               label="portlet-application"

               class="org.exoplatform.portal.config.serialize.PortletApplication"

               marshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler"

               unmarshaller="org.exoplatform.portal.config.serialize.PortletApplicationHandler">

      </mapping>

     

     

    From this mapping element, we see that the binding of  'theme' field is missing. So there is no way to configure theme from XML

     

    By the way, we could customize the theme via UI

  • 4. Re: Portlet decoration - configuration in pages.xml
    Michal Vanco Newbie

    Thanks for the mapping information!

    I think that some users would appreciate this option as well. I'm about to create a feature request in Jira, do you agree?

     

    In case you are using extension and you have whole portal configuration there...you want everything after first deploy and not after manual change in UI

  • 5. Re: Portlet decoration - configuration in pages.xml
    Minh Hoang TO Novice

    My last conclusion was wrong, so sorry!

     

    Although the theme binding is missing in binding.xml, the work is still done by org.exoplatform.portal.config.serialize.PortletApplicationHandler, a handler  invoked during unmarshalling.

     

    nextOptionalTag(ctx, "application-type");

          String theme = nextOptionalTag(ctx, "theme");

          String title = nextOptionalTag(ctx, "title");

          String accessPermissions = nextOptionalTag(ctx, "access-permissions");

          boolean showInfoBar = nextOptionalBooleanTag(ctx, "show-info-bar", true);

     

    The code snippet shows us that configuration for theme is possible

  • 6. Re: Portlet decoration - configuration in pages.xml
    Michal Vanco Newbie

    It really works, thanks!!!

     

    But there was a bit difficult way how to set it properly (no documentation, no example...I had to go through these files: PortletApplicationHandler, /groovy/portal/webui/application/UIPortlet.gtmpl, UIPortlet to find correct structure of theme property)

     

    To share these findings, portlet definition in pages.xml should look like:

     

    <page>

            <name>page</name>

            <title>Page Title</title>

            <access-permissions>Everyone</access-permissions>

            <edit-permission>*:/platform/administrators</edit-permission>

            <portlet-application>

                <portlet>

                    <application-ref>app</application-ref>

                    <portlet-ref>PortletInApp</portlet-ref>

                </portlet>

                <theme>SkinName:ThemeName</theme>

                <title>Page Title</title>

                <access-permissions>Everyone</access-permissions>

                <show-info-bar>true</show-info-bar>

                <show-application-state>false</show-application-state>

                <show-application-mode>false</show-application-mode>

            </portlet-application>

    </page>

     

    It definitely needs to be documented and it would be nice if it is also present at 1_1 schema (as well as icon definition).

  • 7. Re: Portlet decoration - configuration in pages.xml
    Nick Scavelli Novice

    Unfortanutely there's nothing preventing the gatein_objects XSD and the jibx bindings from getting out of sync, which is exactly what has happened here.  The 1.2 schema (in trunk) has addressed some of these inconsitencies which includes the theme and icon you mention.