You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard Wallace <rw...@thewallacepack.net> on 2006/01/26 17:10:27 UTC

[shale] Clay questions

Hello again,

Sorry if I'm getting to be a pest, but I really like Clay and want to 
understand it better.  So, here are my questions of the day:

Can you (or how do you) use resource bundles in the clay config files?  
I'm trying to get to a place where I can use the symbol replacement 
features of Clay like in the use-cases, specifically the templating.  
So, I'd have a component similar to the basePage component with a 
layout.  Then in the layout I'd use @title for the page title.  But how 
can I use a resource bundle to specify the title?  Additionally, if I 
define label components in the clay config files, how would I use values 
from resource bundles for them?  And, if I use resource bundles in the 
clay configs, is that just going to use the default or system locale, or 
will it use the users session locale?

I was trying to get my headers and footers put together yesterday and 
ran into a problem doing images.  My first impulse was to use an <img> 
tag with a jsfid="graphicImage" attribute.  But that didn't work as 
expected.  Since this is a header that will be used in files that could 
be in any directory I can't really use relative paths because there is 
no way to know what the current working directory is so I need to 
specify the full path.  Would the best way to do this be something like 
<img src="#{@images}/mylogo.gif" /> and define @images to be 
"#{facesContext.externalContext.request.contextPath}/images"
 in the clay-config.xml?  Similarly, what's the best way to include 
stylesheets?  Before I discovered the power of symbols I used <link 
rel="stylesheet" type="text/css" 
href="#{facesContext.externalContext.request.contextPath}/styles/default.css" 
/>, which is
a bit of a mess.  So, would it be better to define a @styles symbol?

In the use-cases, dataTables are built strictly using components in the 
clay config files.  Is this the only way to construct them?  I was 
almost hoping for something more like:

<table jsfid="dataTable" value="#{@managed-bean.data}" var="e">
  <tr>
    <td jsfid="column">
      #{e.value1}
    </td>
    <td jsfid="column">
      #{e.value2}
    </td>
  </tr>
</table>


or something similar.  Is that possible?

One last question while I'm on the subject.  One thing that I'd like to 
be able to do with dataTables is have a single value be used to create 
more than one row.  So, for instance, we might have a list of bugs.  For 
each bug we may want 2 rows, the first being the short description, who 
submitted it and when and then the second row being a more detailed 
comment.  The second row could be shown/hidden by the user with DHTML so 
they could get a better idea of what is the issue is.  I did this with 
the myfaces dataList component in JSP for a report once, manually 
building the table elements with a bunch of verbatims and such.  Would I 
have to do the same with Clay (minus the verbatims, of course)?  How 
would I do that?  If I tried to do it in the clay-config.xml I would 
need to do something like:

<component jsfid="report" extends="dataList">
  <attributes>
    <set name="value" value="#{@managed-bean.data}" />
    <set name="var" value="e" />
  </attributes>
  <element renderId="0" jsfid="outputText">
    <attributes>
      <set name="value" value="<tr>" />
    </attributes>
  </element>
  <element renderId="1" jsfid="outputText">
    <attributes>
      <set name="value" value="<td>" />
    </attributes>
  </element>
  <element renderId="2" jsfid="outputText">
    <attributes>
      <set name="value" value="#{e.value1}" />
    </attributes>
  </element>
  <element renderId="3" jsfid="outputText">
    <attributes>
      <set name="value" value="</td>" />
    </attributes>
  </element>
  <element renderId="4" jsfid="outputText">
    <attributes>
      <set name="value" value="</tr>" />
    </attributes>
  </element>
  <element renderId="5" jsfid="outputText">
    <attributes>
      <set name="value" value="<tr>" />
    </attributes>
  </element>
  <element renderId="6" jsfid="outputText">
    <attributes>
      <set name="value" value="<td colspan=2>" />
    </attributes>
  </element>
  ....
</component>

There has got to be a better way.  Any ideas?

Thanks,
Rich

PS Sorry for the length of the message, but I'm really excited about 
Clay and the possibilities it gives me and my web designers.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org