You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Harish Krishnaswamy <hk...@comcast.net> on 2003/09/11 03:04:46 UTC

Re: Suggestion: Add visible attribute to buttons,

Why did you not use CSS in combination with the informal "class" 
attribute to accomplish this? That may have been simpler, I guess. But, 
I am not too familiar with 2.3, but then I think this is still possible. 
Just curious.

-Harish

Paul Jackson wrote:

>Hi all,
>
> 
>
>I'm not sure if this is the correct forum but I say it anyway.
>
> 
>
>We've extended a lot of the tapestry component so we are able to put
>some additional attributes on to ease the generation of the html
>template and the .page configuration.
>
> 
>
>We have put a standard attribute called 'visible' (boolean) onto the
>buttons, links, actionLinks, propertySelection etc components so we are
>able to control when they are being displayed.
>
> 
>
>Especially the buttons. We have an 'edit' button which puts pages into
>edit mode. Using the visible boolean we are able to hide or show the
>buttons easily rather than creating a lot of span tags which makes the
>html hard to read.
>
> 
>
>We're using 2.3 (waiting for 3.0 to be released) at the moment so I'm
>not if there is anything equivalent in there.
>
>Paul Jackson
>Ph +61 (0)2 8233 7564
>Meridian Informatics (www.meridianinfo.com
><http://www.meridianinfo.com/> )
>Custom Software for Agile Financial Services
>
> 
>
>
>  
>


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


Re: Suggestion: Add visible attribute to buttons,

Posted by Vince Marco <vm...@mac.com>.
Oooops, one too many conditionals there.  :-)

But I still would like an attribute at the component level so that my 
HTML template wasn't even aware of the conditional logic.  One of the 
biggest draws for me to Tapestry is separating code logic from HTML.  
Pushing the conditional to CSS is handier than all the conditional tags, 
but it muddies my separation.

Vince

> Yes, very nice technique.  It sure beats wrapping every conditional 
> component in a new conditional component.  Thanks, Harish.
>



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


Re: Suggestion: Add visible attribute to buttons,

Posted by Vince Marco <vm...@mac.com>.
Yes, very nice technique.  It sure beats wrapping every conditional 
component in a new conditional component.  Thanks, Harish.




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


Re: Suggestion: Add visible attribute to buttons,

Posted by Bryan Lewis <br...@maine.rr.com>.
This was a cool thing to learn, thanks.  A slightly more compact way to add it
to the HTML is to use the "style" attribute, as I tried it for hiding a Submit
button.... (maybe this is a frowned-upon technique?)...

    <input type="submit" jwcid="deleteSubmit" value="Delete"
style="ognl:buttonClass"/>

    public String getButtonClass() {
        return "visibility:hidden";
    }

I would think this would come in handy for fixing an occasional
StaleLinkException.  As far as Tapestry is concerned, the component is there (I
would think), so it wouldn't complain that there are a different number of
components on the page if the visibility changes.


----- Original Message ----- 
From: "Harish Krishnaswamy" <hk...@comcast.net>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, September 11, 2003 10:05 AM
Subject: Re: Suggestion: Add visible attribute to buttons,


> I don't think you can conditionally render tags in CSS but you can
> provide OGNL expressions to informal attributes of template tags.
>
> You can do this the following way...
>
> <html>
> <head>
>     <title>Untitled</title>
>     <style type="text/css">
>     .showButton
>     {
>         visibility: visible;
>     }
>     .hideButton
>     {
>         visibility: hidden;
>     }
>     </style>
> </head>
>
> <body>
>
> <input type="Button" value="hello" class="ognl:buttonClass"
> jwcid="@Button".../>
>
> </body>
> </html>
>
> Whenever you want to hide the button just return the "hideButton" string
> from the getButtonClass() method and return the "showButton" string when
> you want to show the button.
>
> -Harish
>
> Vince Marco wrote:
>
> > Harish,
> >
> > I wasn't aware that you could conditionally render tags using CSS.  I
> > have seen some of the cool stuff at www.csszengarden.com, but haven't
> > seen avoiding the rendering of a tag altogether which seems to be what
> > Paul's "visible" attribute does (correct me if I'm wrong here Paul).
> >
> > Do you have a link or example of this?  I do agree with Paul that
> > either the "condition" or "visible" attribute would be very cool to
> > have on all the visual Tapestry components.  If this can be done in
> > CSS, then great!!
> >
> > Vince
> >
> > Harish Krishnaswamy wrote:
> >
> >> Why did you not use CSS in combination with the informal "class"
> >> attribute to accomplish this? That may have been simpler, I guess.
> >> But, I am not too familiar with 2.3, but then I think this is still
> >> possible. Just curious.
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: Suggestion: Add visible attribute to buttons,

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I don't think you can conditionally render tags in CSS but you can 
provide OGNL expressions to informal attributes of template tags.

You can do this the following way...

<html>
<head>
    <title>Untitled</title>
    <style type="text/css">
    .showButton
    {
        visibility: visible;
    }
    .hideButton
    {
        visibility: hidden;
    }
    </style>
</head>

<body>

<input type="Button" value="hello" class="ognl:buttonClass" 
jwcid="@Button".../>

</body>
</html>

Whenever you want to hide the button just return the "hideButton" string 
from the getButtonClass() method and return the "showButton" string when 
you want to show the button.

-Harish

Vince Marco wrote:

> Harish,
>
> I wasn't aware that you could conditionally render tags using CSS.  I 
> have seen some of the cool stuff at www.csszengarden.com, but haven't 
> seen avoiding the rendering of a tag altogether which seems to be what 
> Paul's "visible" attribute does (correct me if I'm wrong here Paul).
>
> Do you have a link or example of this?  I do agree with Paul that 
> either the "condition" or "visible" attribute would be very cool to 
> have on all the visual Tapestry components.  If this can be done in 
> CSS, then great!!
>
> Vince
>
> Harish Krishnaswamy wrote:
>
>> Why did you not use CSS in combination with the informal "class" 
>> attribute to accomplish this? That may have been simpler, I guess. 
>> But, I am not too familiar with 2.3, but then I think this is still 
>> possible. Just curious.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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


Re: Suggestion: Add visible attribute to buttons,

Posted by Vince Marco <vm...@mac.com>.
Harish,

I wasn't aware that you could conditionally render tags using CSS.  I 
have seen some of the cool stuff at www.csszengarden.com, but haven't 
seen avoiding the rendering of a tag altogether which seems to be what 
Paul's "visible" attribute does (correct me if I'm wrong here Paul).

Do you have a link or example of this?  I do agree with Paul that either 
the "condition" or "visible" attribute would be very cool to have on all 
the visual Tapestry components.  If this can be done in CSS, then great!!

Vince

Harish Krishnaswamy wrote:

> Why did you not use CSS in combination with the informal "class" 
> attribute to accomplish this? That may have been simpler, I guess. 
> But, I am not too familiar with 2.3, but then I think this is still 
> possible. Just curious.




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