You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Paul Michael Reilly <pm...@pajato.com> on 2003/02/28 14:44:51 UTC

[Jelly] Swing action objects

I have a question about using action objects in a loop, something
like:

...
<panel name="libPanel" var="libPanel">
  <j:forEach var="item" items="${manager.managedObjects}">
    <j:set var="panelName" value="${item.ID}IconPNL"/>
    <j:set var="buttonName" value="${item.ID}IconBTN"/>
    <j:set var="buttonIcon" value="${manager.getIcon(item)}"/>
    <panel name="${panelName}" var="${panelName}">
      <gridBagLayout>
        <gbc gridy="0" gridx="0" fill="none" anchor="center">
          <label text="${item.topCaption}"/>
        </gbc>
        <gbc gridy="1" gridx="0" fill="none" anchor="center">
          <button name="${buttonName}" var="buttonName">
            <action>
              <j:set var="tabTitle" value="${item.title}"/>
              <j:include uri="openContainerTab.xml" 
                         inherit="true" export="true"/>
            </action>
          </button>
          ${dccApp.registerButton( buttonName, buttonIcon, item )}
        </gbc>
        <gbc gridy="2" gridx="0" fill="none" anchor="center">
          <label text="${item.bottomCaption}"/>
        </gbc>
      </gridBagLayout>
    </panel>
  </j:forEach>
</panel>

The "openContainerTab.xml" script needs to have the tab title
generated in the loop and saved for use when the button is
activated.  I don't think the <action> element is this robust.  Nor
can I see clearly how to accomplish this without creating Java
support (registerButton).  Am I missing something obvious?

Is there an opportunity here to enhance Jelly is some useful fashion?

Thanks,

-pmr