You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by hl...@attbi.com on 2003/01/29 00:09:14 UTC

Re: [Tapestry-developer] Embeding css class selectors to tags

This is all about unthinking the bad habits JSP has forced on you.

You started with the concept of setting an attribute of a tag based on certain 
conditions, but then wandered off into this idea of cutting and pasting the 
template.

Try this (I'll use 2.4 syntax for brevity):

<td jwcid="@Any" element="td" class="[[ classForImage ]]"> ... </td>

Any is a swiss-army-knife component, which can emulate any arbitrary tag.  
Parameter element is the tag to emulate, anything else is an informal 
parameter.  All you have to do is implement a getClassForImage() accessor 
method.

--
hlship@attbi.com

Tapestry: Java Web Components
http;//jakarta.apache.org
> I've got the tipical square grid used to display
> object content , I began by customizing a forEach
> iterator that accepts number of columns as a parameter
> and simply inserts <tr></tr> pairs whenever is due
> afterwards I inserted a pair of <td> </td> , and
> finally i've developed the component that renders the
> object itself,(actually just a link image).
> Everything amounts to this:
> 
> <span jwcid="it">
>      <td>
>        <a jwcid="linkfoto"></a>
>          
>      </td>
> </span>
> 
> Time to time ,I've decided to change the apparence of
> the cells containing the objects depending on a
> certain state of the object (the quality of the
> picture), as a straightforward option I've intended to
> use simply css selector elements one for each
> state,and the goal is to introduce them in the <td>
> elements :<td class="Foto1">
> 
> That is Picture with quality==1 gets <td
> class="Foto1"> 
> with quality==2 gets <td class="Foto2"> 
> 
> ,to choose among the different values i use the
> conditional component
> <span jwcid="ifQualitat0"> <td class="Foto0"> Q0 
> the which tanks to OGNL gets cuality property from the
> object and compares to 0 if so it writes the tag.
> 
> All This amounts to this:
> 
>  
> <span jwcid="it">
> 
>      <td>  //BIG PROBLEM THERE
>        <span jwcid="ifQualitat0"> <td class="Foto0">
> Q0     </span> 
>        <span jwcid="ifQualitat1"> <td class="Foto1">
> Q1 </span> 
>        <a jwci d="linkfoto"></a>
>          
>      </td>
> </span>
> 
> As stated by the label if I dont place an extra TD in
> the template I will get a Template Parse
> Exception,because of the HTML being not well
> constructed, strangely enough, if I add the <TD> I get
> a magically produced </td>, and a full bloated
> unexpected unwanted cell.
> 
> So the question is how to deal with the need of
> embeding class selector in tags ?
> 
> It seems me that <td <span id
> conditional>class="myClass" </span> >
> would also not work...
> 
> Thanks in advance.
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Tapestry-developer mailing list
> Tapestry-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer