Panels Configuration

We have to provide panel configuration files containing our panel definitions for each module. Since we want to share a basic layout throughout our application, we'll define a common configuration file, which will be imported by each module's panel configuration file.

Shared layout

We'll use a "classic" layout, which decomposes a page into header, menu, content and footer parts. We'll save this configuration as /WEB-INF/calyxo-panels-shared.xml.

<calyxo-panels-config version="0.9"
  xmlns="http://calyxo.odysseus.de/xml/ns/panels">
  <panels>

    <!-- abstract page layout panel. Concrete subpanels need to
      specify a page title and content. Optionally they may
      provide menu items. -->
    <panel name="/layout.page" template="/WEB-INF/jsp/page.jspx">
      <!-- title (abstract) -->
      <param name="title"/>
      <!-- header -->
      <panel name="header" template="/WEB-INF/jsp/header.jspx">
        <param name="text" value="Login Sample App"/>
      </panel>
      <!-- menu -->
      <panel name="menu" template="/WEB-INF/jsp/menu.jspx">
        <list name="items">
          <!-- subpanels may define menu items like this:
          <item>
            <param name="title" value="Logout"/>
            <param name="action" value="/logout"/>
          </item>
          -->
        </list>
      </panel>
      <!-- content (abstract) -->
      <panel name="content"/>
      <!-- messages -->
      <panel name="messages" template="/WEB-INF/jsp/messages.jspx"/>
      <!-- footer -->
      <panel name="footer" template="/WEB-INF/jsp/footer.jspx"/>
    </panel>

  </panels>
</calyxo-panels-config>
DTD lookup
Many XML editors allow to associate root element names with DTDs. If your editor supports this, you may want to associate calyxo-panels-config with CALYXO_HOME/calyxo-panels/conf/share/calyxo-panels-config.dtd. Alternatively, you should adjust the DTD system path or simply copy the DTD file to your /WEB-INF directory.

This file defines the single toplevel panel /layout.page containing

  • A title parameter, which will be used as the page title. The parameter value is left undefined.
  • A header panel, which takes a text parameter. The corresponding template is /WEB-INF/jsp/header.jspx.
  • A menu panel, which contains a list of items, each having title and action parameters. However, as defined here, the list is empty. The corresponding template is /WEB-INF/jsp/menu.jspx.
  • A content panel. This panel is abstract, since it does not specify a template.
  • A footer panel, taking no parameters. The corresponding template is /WEB-INF/jsp/footer.jspx.

Derived panels will have to provide a value for the title parameter and a template attribute for the content panel. Optionally, they may override the empty list of items in the menu panel.

Panels for module "outside"

Our outside module has to provide concrete panel definitions for the login - and goodbye pages. To specify a common header text and menu items used within the module, we define an abstract base panel which will be extended by concrete panels. The base panel extends our shared layout panel we defined above. We'll save this configuration as /WEB-INF/calyxo-panels-outside.xml.

<calyxo-panels-config version="0.9"
  xmlns="http://calyxo.odysseus.de/xml/ns/panels"
  xmlns:base="http://calyxo.odysseus.de/xml/ns/base">

  <base:import file="calyxo-panels-config-shared.xml"/>

  <panels>

    <!-- base page for pages in this module -->
    <panel name="/base.page" super="/layout.page">
      <panel name="header">
        <param name="text" value="Login Sample App (outside)"/>
      </panel>
      <panel name="menu">
        <list name="items">
          <item>
            <param name="title" value="Login"/>
            <param name="action" value="/index"/>
          </item>
        </list>
      </panel>
    </panel>

    <!-- login page -->
    <panel name="/login.page" super="/base.page">
      <param name="title" value="Login page"/>
      <panel name="content" template="/WEB-INF/jsp/login.jspx"/>
    </panel>

    <!-- goodbye page -->
    <panel name="/goodbye.page" super="/base.page">
      <param name="title" value="Goodbye page"/>
      <panel name="content" template="/WEB-INF/jsp/goodbye.jspx"/>
    </panel>

  </panels>

</calyxo-panels-config>

As you can see, we use the <base:import> element to include the configuration file containing our shared layout definition.

The /base.page panel still leaves the page title and content template open to the /login.page and goodbye.page panels.

Panels for module "inside"

Due to the nature of our sample application, the inside module has to provide only one concrete panel definition for its welcome page. We should save this configuration as /WEB-INF/calyxo-panels-outside.xml.

<calyxo-panels-config version="0.9"
  xmlns="http://calyxo.odysseus.de/xml/ns/panels"
  xmlns:base="http://calyxo.odysseus.de/xml/ns/base">

  <base:import file="calyxo-panels-config-shared.xml"/>

  <panels>

    <!-- base page for pages in this module -->
    <panel name="/base.page" super="/layout.page">
      <panel name="header">
        <param name="text" value="Login Sample App (inside)"/>
      </panel>
      <panel name="menu">
        <list name="items">
          <item>
            <param name="title" value="Logout"/>
            <param name="action" value="/logout"/>
          </item>
        </list>
      </panel>
    </panel>

    <!-- welcome page -->
    <panel name="/welcome.page" super="/base.page">
      <param name="title" value="Welcome page"/>
      <panel name="content" template="/WEB-INF/jsp/welcome.jspx"/>
    </panel>

  </panels>

</calyxo-panels-config>

Again, we <base:import> our shared layout configuration file and define a /base.page panel specifying header text and menu items.

The /base.page panel still leaves the page title and content template open to the /welcome.page panel.