You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Inge Solvoll <in...@gmail.com> on 2009/02/16 12:59:12 UTC

T5: Equanda feature request

Don't know if this is a bad thing to ask about here, you just tell me if I
should take this business elsewhere... :)

In equanda-tapestry5 I discovered a very nice and useful component,
TextField, which updates a zone through the onchange event of a regular
textfield. This is excactly what I've been looking for, except that I need
to be able to specify an event other than "change". I've looked at the
source code, and it seems trivial to make the event a parameter. For now, I
will make this change in my own copy of this component, but I would love to
see this implemented in the equanda component!

Also, wouldn't it be cleaner to provide this component as a mixin? If
possible? I think I'll try that, I'll post the result here if I'm successful
:)

Regards

Inge

Re: T5: Equanda feature request

Posted by Joachim Van der Auwera <jo...@progs.be>.
Inge Solvoll wrote:
> Don't know if this is a bad thing to ask about here, you just tell me if I
> should take this business elsewhere... :)
>   
Either here or using the equanda-user mailing list. Both are fine.

> In equanda-tapestry5 I discovered a very nice and useful component,
> TextField, which updates a zone through the onchange event of a regular
> textfield. This is excactly what I've been looking for, except that I need
> to be able to specify an event other than "change". I've looked at the
> source code, and it seems trivial to make the event a parameter. For now, I
> will make this change in my own copy of this component, but I would love to
> see this implemented in the equanda component!
>   
Patches are always welcome.

> Also, wouldn't it be cleaner to provide this component as a mixin? If
> possible? I think I'll try that, I'll post the result here if I'm successful
> :)
>   
I thinks there are specific reasons for not using a mixin, but can't 
remember them now.
Though the example application does not show it, it is used in the rest 
of equanda combined with the autocomplete mixin. I assume it had 
something to do with that.

Kind regards,
Joachim

-- 
Joachim Van der Auwera
PROGS bvba, progs.be


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


Re: T5: Equanda feature request

Posted by Inge Solvoll <in...@gmail.com>.
Sorry for spamming, but here is the JIRA issue.

https://issues.apache.org/jira/browse/TAP5-521


On Tue, Feb 17, 2009 at 2:52 PM, Inge Solvoll <in...@gmail.com>wrote:

> I will add a JIRA issue for adding a parameter in a link with javascript!
>
>
> On Tue, Feb 17, 2009 at 1:58 PM, Joachim Van der Auwera <jo...@progs.be>wrote:
>
>> Inge Solvoll wrote:
>>
>>> The only thing I see that is a little bit "dirty" is the way that equanda
>>> puts the entered value into the link string. Is there any way to make it
>>> easier to do this kind of thing natively in T5? Perhaps through a
>>> different
>>> approach entirely?
>>>
>>>
>> Ideally, the tapestry js should include a function to add a parameter in a
>> link. I have tried to cover all the link format cases I could think of, but
>> would not be surprised if it fails in certain cases. I you encounter that,
>> let me know.
>>
>>
>> Kind regards,
>> Joachim
>>
>> --
>> Joachim Van der Auwera
>> PROGS bvba, progs.be
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>

Re: T5: Equanda feature request

Posted by Inge Solvoll <in...@gmail.com>.
I will add a JIRA issue for adding a parameter in a link with javascript!

On Tue, Feb 17, 2009 at 1:58 PM, Joachim Van der Auwera <jo...@progs.be>wrote:

> Inge Solvoll wrote:
>
>> The only thing I see that is a little bit "dirty" is the way that equanda
>> puts the entered value into the link string. Is there any way to make it
>> easier to do this kind of thing natively in T5? Perhaps through a
>> different
>> approach entirely?
>>
>>
> Ideally, the tapestry js should include a function to add a parameter in a
> link. I have tried to cover all the link format cases I could think of, but
> would not be surprised if it fails in certain cases. I you encounter that,
> let me know.
>
>
> Kind regards,
> Joachim
>
> --
> Joachim Van der Auwera
> PROGS bvba, progs.be
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: Equanda feature request

Posted by Joachim Van der Auwera <jo...@progs.be>.
Inge Solvoll wrote:
> The only thing I see that is a little bit "dirty" is the way that equanda
> puts the entered value into the link string. Is there any way to make it
> easier to do this kind of thing natively in T5? Perhaps through a different
> approach entirely?
>   
Ideally, the tapestry js should include a function to add a parameter in 
a link. I have tried to cover all the link format cases I could think 
of, but would not be surprised if it fails in certain cases. I you 
encounter that, let me know.

Kind regards,
Joachim

-- 
Joachim Van der Auwera
PROGS bvba, progs.be


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


Re: T5: Equanda feature request

Posted by Inge Solvoll <in...@gmail.com>.
I just went ahead and created the mixin based on the equanda TextField
component, as far as I can see, it works nicely. The mixin lets any event on
any component update a zone. The only requirement is that the HTML element
has a "value" attribute. This limitation could easily be erased as well, I
guess. Right now I don't need to.

The only thing I see that is a little bit "dirty" is the way that equanda
puts the entered value into the link string. Is there any way to make it
easier to do this kind of thing natively in T5? Perhaps through a different
approach entirely?


Usage and source code:


TML:
<input t:type="textField" t:id="searchField" value="search" zone="list"
event="keypress" t:mixins="zoneUpdater"/>

JAVA:
- Provide a listener, in this case "onKeyPressFromSearchField", that returns
a Block the usual zone way.


SOURCE:
package myapp.frontend.tapestry5.mixins;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.RenderSupport;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry5.annotations.InjectContainer;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.ioc.annotations.Inject;

@IncludeJavaScriptLibrary("classpath:/org/equanda/tapestry5/resources/equanda.js")
public class ZoneUpdater {

  @Inject
  private ComponentResources resources;

  @Environmental
  private RenderSupport renderSupport;

  @Parameter(defaultPrefix = BindingConstants.LITERAL, required = true)
  private String event;

  @InjectContainer
  private ClientElement element;

  @Parameter
  private Object[] context;

  @Parameter(defaultPrefix = BindingConstants.LITERAL, required = true)
  private String zone;

  protected Link createLink(Object[] contextArray) {
    return resources.createEventLink(event, contextArray);
  }

  void afterRender(MarkupWriter writer) {
      String urlStart = createLink(context).toAbsoluteURI();
      String urlEnd = "";
      int pos = urlStart.indexOf(';');
      if (pos > 0) {
        urlEnd = urlStart.substring(pos);
        urlStart = urlStart.substring(0, pos);
      }
      renderSupport.addScript("element = $('%s');\n" +
      // Update the element with the id of zone div. This may be changed
dynamically on the client side.
          "$T(element).zoneId = '%s';\n" + "element.observe(\"" + event +
"\", function(event) { eqTfzu( event, '%s/', '%s' ); });\n",
element.getClientId(), zone, urlStart, urlEnd);
    }

}


On Mon, Feb 16, 2009 at 12:59 PM, Inge Solvoll <in...@gmail.com>wrote:

> Don't know if this is a bad thing to ask about here, you just tell me if I
> should take this business elsewhere... :)
>
> In equanda-tapestry5 I discovered a very nice and useful component,
> TextField, which updates a zone through the onchange event of a regular
> textfield. This is excactly what I've been looking for, except that I need
> to be able to specify an event other than "change". I've looked at the
> source code, and it seems trivial to make the event a parameter. For now, I
> will make this change in my own copy of this component, but I would love to
> see this implemented in the equanda component!
>
> Also, wouldn't it be cleaner to provide this component as a mixin? If
> possible? I think I'll try that, I'll post the result here if I'm successful
> :)
>
> Regards
>
> Inge
>