You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by tsvetelin <ts...@rushmore-digital.com> on 2003/09/11 18:07:58 UTC

new components in tacos

Hi Harish,

I am so glad to see 2 new components in Tacos.

>From my point of view one of the keys for tapestry success is to have a
large number of standard/shared components. So when the new people and
companies start to inspect the framework they will see that most of the
thing are made and they are available.

I will be very happy(I think this is
true for all of us) to see additional new components there so if someone of
you would like to share a component please send a message, proposal or
component to tacos mailing list. [mailto:tacos-devel@lists.sourceforge.net]


Tsvetelin.
-----Original Message-----
From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
Sent: Thursday, September 11, 2003 6:38 PM
To: Tapestry users
Subject: Re: Decoupled Date Picker component questoin


I published the DecoupledDatePicker and the VariablePropertySelection
components to this list to see if there is enough interest in the
community to make it Tacos component. Now that there are quite a few
people that have shown interest, I shall make an effort to move it to
the public component repository - Tacos, at which point I shall try to
provide some documentation. To those of you who are not aware, there is
a public component repository for Tapestry components in SourceForge at
http://tacos.sf.net.

The demo for the VariablePropertySelection was intended to be a
deployable webapp. I am not sure what the problem is in your case
without more details. Please provide more info and I can try and help.

Just a note: I just took a glance at your code snippet and the one thing
that stuck out was the getPickButton(). I am not sure what you are using
it for, but setting the the names of components is a no-no in Tapestry
as far as I know. Names are always handled by the framework. Oh I see
now, you may want to try the following in your page specification...

    <component id="datePicker" type="DecoupledDatePicker">
        <binding name="field" expression="dateField"/>
        <binding name="button" expression="components.pickButton"/>
        <binding name="value" expression="newswireDate"/>
        <static-binding name="format">MM/dd/yyyy</static-binding>
    </component>

and now you can remove the getPickButton() from your class.

Hope this helps.

-Harish


Bryan Lewis wrote:

>The same thing happened to me.
>
><pickiness warning>
>It would be nice if contributed samples like the DecoupledDatePicker came
with
>a little more documentation, if only the layout of the war file or the
>build.xml.  At my current level of Tapestry experience, it takes me an hour
or
>two to adapt the code to my source-code layout and get it to deploy just
right.
>(Sorry for being ungrateful... wanting to avoid an extra hour or two when
I'm
>being saved several hours. :-)   This might mean that I haven't structured
my
>source code tree according to the standard practice, if there is a standard
>practice.  I've been able to figure out the samples that come in the
Tapestry
>release fairly easily, even when they were out of date, because they're
>end-to-end buildable and executable examples.
>I still haven't gotten the TForms demo of VariablePropertySelection to
work,
>but I've put it on the back burner with a note to self, "Learn more about
>scripting with tapestry."
></pickiness warning>
>
>Anyway, one of the benefits of the DecoupledDatePicker is that you can make
the
>TextField anything you want.  If it's a simple TextField, it gives you a
>String.  If you make it a ValidField, the validator will convert the input
to a
>Date.  Here's how I used it.  This page allows the user to pick a date,
then
>redirects the user to a pdf file with a filename derived from the date.
You
>can see in the comments that there are still a couple of points I'm unclear
on,
>but they're minor and the component is working great.
>
>Newswire.page:
><page-specification class="....">
>
>    <bean name="delegate"
>class="org.apache.tapestry.valid.ValidationDelegate"/>
>
>    <bean name="dateValidator"
class="org.apache.tapestry.valid.DateValidator">
>        <set-property name="required" expression="false"/>
>        <set-property name="maximum" expression="new java.util.Date()"/>
>        <set-property name="format"
>expression="@common.Common@standardDateFormat()"/>
>    </bean>
>
>    <component id="dateField" type="ValidField">
>        <binding name="value" expression="newswireDate"/>
>        <static-binding name="displayName">Newswire Date</static-binding>
>        <binding name="validator" expression="beans.dateValidator"/>
>    </component>
>
>    <component id="form" type="Form">
>        <binding name="listener" expression="listeners.dateSubmit"/>
>        <binding name="delegate" expression="beans.delegate"/>
>    </component>
>
>    <component id="pickButton" type="Button">
>        <static-binding name="label">Pick</static-binding>
>    </component>
>
>    <component id="datePicker" type="DecoupledDatePicker">
>        <binding name="field" expression="dateField"/>
>        <binding name="button" expression="pickButton"/>
>        <binding name="value" expression="newswireDate"/>
>        <static-binding name="format">MM/dd/yyyy</static-binding>
>    </component>
>
></page-specification>
>
>Newswire.java:
>public class Newswire extends BasePage
>{
>    private Date newswireDate;
>    private String error;
>
>    public String getError() { return error; }
>
>    public Date getNewswireDate() { return newswireDate; }
>    public void setNewswireDate(Date value) { newswireDate = value; }
>
>    private Category log = Category.getInstance(getClass());
>
>    public void dateSubmit(IRequestCycle cycle)
>    {
>        IValidationDelegate delegate = (IValidationDelegate)
>
>getBeans().getBean("delegate");
>        if (delegate.getHasErrors()) {
>            error = "Invalid date entry.";
>            return;
>        }
>
>        // A null entry means today.
>        if (newswireDate == null) {
>            newswireDate = new java.util.Date();
>        }
>
>        // Format the date directly into the URL!
>        SimpleDateFormat df = new SimpleDateFormat
>            ("'http://server.domain.com/wires/'yyyy'/news_'MMdd'.pdf'");
>        String url = df.format(newswireDate);
>        log.debug("dateSubmit url = " + url);
>
>        // Use a RedirectException for an external page.
>        throw new RedirectException(url);
>    }
>
>    // I'm not sure I'm doing this the easiest way.  It seems odd that I
should
>    // have to setName() here.  Does it have to be the same as the button's
id?
>    public Button getPickButton()
>    {
>        String name = "pickButton";
>        Button button = (Button) getNestedComponent(name);
>        button.setName(name);
>        return button;
>    }
>
>    public AbstractTextField getDateField()
>    {
>        return (AbstractTextField) getNestedComponent("dateField");
>    }
>
>    public void detach()
>    {
>        // Not sure I have to do this.
>        error = null;
>        super.detach();
>    }
>}
>
>
>----- Original Message -----
>From: "Chris Norris" <CN...@widen.com>
>To: "'Tapestry users'" <ta...@jakarta.apache.org>
>Sent: Thursday, September 11, 2003 9:22 AM
>Subject: Decoupled Date Picker component questoin
>
>
>
>
>>I've been trying to use the decoupled datepicker that Harish posted a
little
>>while ago so that I could use something just like the DatePicker, but with
a
>>custom button instead of some little down arrow thingy that designers
cringe
>>at.  After putting it in and testing it, I have only one problem.  I can't
>>get it to actually try to set a date object... it tries to put out a
string,
>>whereas the DatePicker actually puts out a date.  I don't want to have to
>>make an extra setThisDate(String date) method in every class that already
>>has a setThisDate(Date date) method.  How can I get the
decoupledDatePicker
>>to exhibit the same behavior as the DatePicker?
>>
>>-chris
>>
>>
>>
>
>
>---------------------------------------------------------------------
>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: new components in tacos

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I am little busy with work these days, but I shall try and get something 
out over the weekend.

-Harish


tsvetelin wrote:

>Hi Harish,
>
>I am so glad to see 2 new components in Tacos.
>
>>>From my point of view one of the keys for tapestry success is to have a
>large number of standard/shared components. So when the new people and
>companies start to inspect the framework they will see that most of the
>thing are made and they are available.
>
>I will be very happy(I think this is
>true for all of us) to see additional new components there so if someone of
>you would like to share a component please send a message, proposal or
>component to tacos mailing list. [mailto:tacos-devel@lists.sourceforge.net]
>
>
>Tsvetelin.
>-----Original Message-----
>From: Harish Krishnaswamy [mailto:hkrishnaswamy@comcast.net]
>Sent: Thursday, September 11, 2003 6:38 PM
>To: Tapestry users
>Subject: Re: Decoupled Date Picker component questoin
>
>
>I published the DecoupledDatePicker and the VariablePropertySelection
>components to this list to see if there is enough interest in the
>community to make it Tacos component. Now that there are quite a few
>people that have shown interest, I shall make an effort to move it to
>the public component repository - Tacos, at which point I shall try to
>provide some documentation. To those of you who are not aware, there is
>a public component repository for Tapestry components in SourceForge at
>http://tacos.sf.net.
>
>The demo for the VariablePropertySelection was intended to be a
>deployable webapp. I am not sure what the problem is in your case
>without more details. Please provide more info and I can try and help.
>
>Just a note: I just took a glance at your code snippet and the one thing
>that stuck out was the getPickButton(). I am not sure what you are using
>it for, but setting the the names of components is a no-no in Tapestry
>as far as I know. Names are always handled by the framework. Oh I see
>now, you may want to try the following in your page specification...
>
>    <component id="datePicker" type="DecoupledDatePicker">
>        <binding name="field" expression="dateField"/>
>        <binding name="button" expression="components.pickButton"/>
>        <binding name="value" expression="newswireDate"/>
>        <static-binding name="format">MM/dd/yyyy</static-binding>
>    </component>
>
>and now you can remove the getPickButton() from your class.
>
>Hope this helps.
>
>-Harish
>
>
>Bryan Lewis wrote:
>
>  
>
>>The same thing happened to me.
>>
>><pickiness warning>
>>It would be nice if contributed samples like the DecoupledDatePicker came
>>    
>>
>with
>  
>
>>a little more documentation, if only the layout of the war file or the
>>build.xml.  At my current level of Tapestry experience, it takes me an hour
>>    
>>
>or
>  
>
>>two to adapt the code to my source-code layout and get it to deploy just
>>    
>>
>right.
>  
>
>>(Sorry for being ungrateful... wanting to avoid an extra hour or two when
>>    
>>
>I'm
>  
>
>>being saved several hours. :-)   This might mean that I haven't structured
>>    
>>
>my
>  
>
>>source code tree according to the standard practice, if there is a standard
>>practice.  I've been able to figure out the samples that come in the
>>    
>>
>Tapestry
>  
>
>>release fairly easily, even when they were out of date, because they're
>>end-to-end buildable and executable examples.
>>I still haven't gotten the TForms demo of VariablePropertySelection to
>>    
>>
>work,
>  
>
>>but I've put it on the back burner with a note to self, "Learn more about
>>scripting with tapestry."
>></pickiness warning>
>>
>>Anyway, one of the benefits of the DecoupledDatePicker is that you can make
>>    
>>
>the
>  
>
>>TextField anything you want.  If it's a simple TextField, it gives you a
>>String.  If you make it a ValidField, the validator will convert the input
>>    
>>
>to a
>  
>
>>Date.  Here's how I used it.  This page allows the user to pick a date,
>>    
>>
>then
>  
>
>>redirects the user to a pdf file with a filename derived from the date.
>>    
>>
>You
>  
>
>>can see in the comments that there are still a couple of points I'm unclear
>>    
>>
>on,
>  
>
>>but they're minor and the component is working great.
>>
>>Newswire.page:
>><page-specification class="....">
>>
>>   <bean name="delegate"
>>class="org.apache.tapestry.valid.ValidationDelegate"/>
>>
>>   <bean name="dateValidator"
>>    
>>
>class="org.apache.tapestry.valid.DateValidator">
>  
>
>>       <set-property name="required" expression="false"/>
>>       <set-property name="maximum" expression="new java.util.Date()"/>
>>       <set-property name="format"
>>expression="@common.Common@standardDateFormat()"/>
>>   </bean>
>>
>>   <component id="dateField" type="ValidField">
>>       <binding name="value" expression="newswireDate"/>
>>       <static-binding name="displayName">Newswire Date</static-binding>
>>       <binding name="validator" expression="beans.dateValidator"/>
>>   </component>
>>
>>   <component id="form" type="Form">
>>       <binding name="listener" expression="listeners.dateSubmit"/>
>>       <binding name="delegate" expression="beans.delegate"/>
>>   </component>
>>
>>   <component id="pickButton" type="Button">
>>       <static-binding name="label">Pick</static-binding>
>>   </component>
>>
>>   <component id="datePicker" type="DecoupledDatePicker">
>>       <binding name="field" expression="dateField"/>
>>       <binding name="button" expression="pickButton"/>
>>       <binding name="value" expression="newswireDate"/>
>>       <static-binding name="format">MM/dd/yyyy</static-binding>
>>   </component>
>>
>></page-specification>
>>
>>Newswire.java:
>>public class Newswire extends BasePage
>>{
>>   private Date newswireDate;
>>   private String error;
>>
>>   public String getError() { return error; }
>>
>>   public Date getNewswireDate() { return newswireDate; }
>>   public void setNewswireDate(Date value) { newswireDate = value; }
>>
>>   private Category log = Category.getInstance(getClass());
>>
>>   public void dateSubmit(IRequestCycle cycle)
>>   {
>>       IValidationDelegate delegate = (IValidationDelegate)
>>
>>getBeans().getBean("delegate");
>>       if (delegate.getHasErrors()) {
>>           error = "Invalid date entry.";
>>           return;
>>       }
>>
>>       // A null entry means today.
>>       if (newswireDate == null) {
>>           newswireDate = new java.util.Date();
>>       }
>>
>>       // Format the date directly into the URL!
>>       SimpleDateFormat df = new SimpleDateFormat
>>           ("'http://server.domain.com/wires/'yyyy'/news_'MMdd'.pdf'");
>>       String url = df.format(newswireDate);
>>       log.debug("dateSubmit url = " + url);
>>
>>       // Use a RedirectException for an external page.
>>       throw new RedirectException(url);
>>   }
>>
>>   // I'm not sure I'm doing this the easiest way.  It seems odd that I
>>    
>>
>should
>  
>
>>   // have to setName() here.  Does it have to be the same as the button's
>>    
>>
>id?
>  
>
>>   public Button getPickButton()
>>   {
>>       String name = "pickButton";
>>       Button button = (Button) getNestedComponent(name);
>>       button.setName(name);
>>       return button;
>>   }
>>
>>   public AbstractTextField getDateField()
>>   {
>>       return (AbstractTextField) getNestedComponent("dateField");
>>   }
>>
>>   public void detach()
>>   {
>>       // Not sure I have to do this.
>>       error = null;
>>       super.detach();
>>   }
>>}
>>
>>
>>----- Original Message -----
>>From: "Chris Norris" <CN...@widen.com>
>>To: "'Tapestry users'" <ta...@jakarta.apache.org>
>>Sent: Thursday, September 11, 2003 9:22 AM
>>Subject: Decoupled Date Picker component questoin
>>
>>
>>
>>
>>    
>>
>>>I've been trying to use the decoupled datepicker that Harish posted a
>>>      
>>>
>little
>  
>
>>>while ago so that I could use something just like the DatePicker, but with
>>>      
>>>
>a
>  
>
>>>custom button instead of some little down arrow thingy that designers
>>>      
>>>
>cringe
>  
>
>>>at.  After putting it in and testing it, I have only one problem.  I can't
>>>get it to actually try to set a date object... it tries to put out a
>>>      
>>>
>string,
>  
>
>>>whereas the DatePicker actually puts out a date.  I don't want to have to
>>>make an extra setThisDate(String date) method in every class that already
>>>has a setThisDate(Date date) method.  How can I get the
>>>      
>>>
>decoupledDatePicker
>  
>
>>>to exhibit the same behavior as the DatePicker?
>>>
>>>-chris
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>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
>
>
>  
>