cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Larson <>
Subject [RT] Woody dynamic widgets design
Date Thu, 11 Sep 2003 19:06:50 GMT
Proposal to allow the declarative specification of dynamic widgets in Woody:
(Use case that is driving dynamic widgets: web-based form and report design gui)

Bruno, if you have a chance could you comment on this before you are gone for the week?

Make the form definition dynamic:

  Rely on aggregation, etc. to ensure all widget definitions are in the same source.
  Create a container <wd:widgets/> for reusable widget definitions.
  Create <wd:include/> to reference the reusable widget containers.
  Create a new discriminated "union" widget with methods:
    setCase(id) to change the distriminant and corresponding widgets.
    getCase() to return the current discriminant id.

  Sample form definition:

    <wd:form xmlns:wd="">

      <wd:widgets id="fullname">
        <wd:field id="firstname" required="true">
          <wd:datatype base="string"/>
          <wd:label>First Name</wd:label>
        <wd:field id="middlename" required="true">
          <wd:datatype base="string"/>
          <wd:label>Middle Name</wd:label>
        <wd:field id="lastname" required="true">
          <wd:datatype base="string"/>
          <wd:label>Last Name</wd:label>

      <wd:union id="name" default="noname">

        <wd:case id="noname"/>

        <wd:case id="nickname">
          <wd:field id="nickname" required="true">
            <wd:datatype base="string"/>

        <wd:case id="fullname">
          <wd:include id="fullname"/>



Make the form template dynamic:

  Rely on aggregation, etc. to ensure all templates are in the same source.
  This will allow support for recursively nested unions.
  Create a container <wt:templates/> for reusable templates.
  Create <wt:include/> to reference the reusable template containers.
  Create <wt:union/> to select templates based on the widget instance discriminants.
  The context in <wt:union/> is the contained widgets so recursively included
  templates will reference the proper widgets.  We would need to introduce
  xpath-like syntax (e.g. "/widget", "../widget", and "widget/widget") to allow
  other widgets to be referenced from templates contained in a union.

  Sample form template:

    <page xmlns:wt="">
      <title>The Title</title>
        <wt:form-template action="#{$continuation/id}.continue" method="POST">

          <wt:templates id="fullname">
            <wt:widget-label id="firstname"/>: <wt:widget id="firstname"/>
            <wt:widget-label id="middlename"/>: <wt:widget id="middlename"/>
            <wt:widget-label id="lastname"/>: <wt:widget id="lastname"/>

          <wt:union id="name">
            <wt:case id="noname"/>
            <wt:case id="nickname">
              <wt:widget-label id="nickname"/>: <wt:widget id="nickname"/>
            <wt:case id="fullname">
              <wt:include id="fullname"/>

          <input type="submit"/>

Make the binding dynamic:

  I have not worked on this yet, but it will probably follow the same pattern
  as the definitions and templates sections.

Make the flowscript support the dynamic widgets:

  I will look at this next, along with the binding.

Well, that is the preliminary view.  Before the design gets finished and coded,
what do others think of this?  Am I on the right track?  What could be done better?

--Tim Larson

Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

View raw message