You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Trunick <Jo...@SmartPrice.com> on 2003/08/26 21:09:54 UTC

Optional Centering

I want to have my page optionally centered. I wrapped
the top <center> with a Conditional and the bottom
</center> with a Conditional. Of course, Tapestry 
complains that the nested html isn't well formed. How
do I get this functionality?

J

Re: Optional Centering

Posted by Laurent Cornelis <la...@ubiquity.be>.
You can use a cascading stylesheet.

You define two classes in your stylesheet (one centered and one not
centered). And you uses a tag any with a parameter class that use one of the
two CSS class.

----- Original Message -----
From: "Joel Trunick" <Jo...@SmartPrice.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Tuesday, August 26, 2003 9:09 PM
Subject: Optional Centering


>
> I want to have my page optionally centered. I wrapped
> the top <center> with a Conditional and the bottom
> </center> with a Conditional. Of course, Tapestry
> complains that the nested html isn't well formed. How
> do I get this functionality?
>
> J
>


RE: Optional Centering

Posted by Dustin Frazier <du...@philanthropix.org>.
This is another chance to plug the "universal conditional" idea that I know
has been bandied about.  It would be *so* handy to be able to do something
like:

<center jwcid="@Any" condition="ognl:centerPage()">
...
</center>

Don't forget that <center> is deprecated HTML, though... :)

Dustin

-----Original Message-----
From: Eric Schneider [mailto:eric@centralparksoftware.com] 
Sent: Tuesday, August 26, 2003 1:01 PM
To: Tapestry users
Subject: Re: Optional Centering


Joel,

You could use an "Any" component to create table cell that wraps the content.

.html:
<table>
<tr>
 <td jwcid="myTdTag" element="td">
 .....page content.....
 </td>
</tr>
</table>

.page:
<component id="myTdTag" type="Any">
    <binding name="align" expression="methodThatReturnsLeftCenterOrRight"/>
</component>

Cheers,
Eric

----- Original Message ----- 
From: "Joel Trunick" <Jo...@SmartPrice.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Tuesday, August 26, 2003 3:09 PM
Subject: Optional Centering


>
> I want to have my page optionally centered. I wrapped
> the top <center> with a Conditional and the bottom
> </center> with a Conditional. Of course, Tapestry
> complains that the nested html isn't well formed. How
> do I get this functionality?
>
> J
>


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



Re: Optional Centering

Posted by Eric Schneider <er...@centralparksoftware.com>.
Joel,

You could use an "Any" component to create table cell that wraps the
content.

.html:
<table>
<tr>
 <td jwcid="myTdTag" element="td">
 .....page content.....
 </td>
</tr>
</table>

.page:
<component id="myTdTag" type="Any">
    <binding name="align" expression="methodThatReturnsLeftCenterOrRight"/>
</component>

Cheers,
Eric

----- Original Message ----- 
From: "Joel Trunick" <Jo...@SmartPrice.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Tuesday, August 26, 2003 3:09 PM
Subject: Optional Centering


>
> I want to have my page optionally centered. I wrapped
> the top <center> with a Conditional and the bottom
> </center> with a Conditional. Of course, Tapestry
> complains that the nested html isn't well formed. How
> do I get this functionality?
>
> J
>


Re: Optional Centering

Posted by Andreas Bolka <an...@gmx.net>.
Tuesday, August 26, 2003, 9:09:54 PM, Joel wrote:

> I want to have my page optionally centered. I wrapped the top
> <center> with a Conditional and the bottom </center> with a
> Conditional. Of course, Tapestry complains that the nested html
> isn't well formed. How do I get this functionality?

------
.html:
------
<style>
  .center { text-align: center; }
  .default { text-align: left; }
</style>
...
<div jwcid="centerDiv">
  ... page content ...
</div>

------
.page:
------
<component id="centerDiv" type="Any">
  <binding name="class" expression="centerDivClass" />
</component>

------
.java:
------
public String getCenterDivClass() {
  return isCentered() ? "center" : "default";
}

[may contain some typos :)]

-- 
Best regards,
 Andreas                            mailto:andreas.bolka@gmx.net