Re: ConditionalAutocomplete and Tapestry 5.4

"Thiago H. de Paula Figueiredo" <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAE_88GY+ccYOE7sGDcZBnZJ_baNPr-7R34Ojct9GgLpsEeaWTQ@mail.gmail.com>
Hi!

I cannot check right now, but I believe the 5.4 Autocomplete mixin is now
using the jQuery implementation (http://jqueryui.com/autocomplete/) instead
of the Scriptaculous one. An option is to copy the 5.3 Tapestry
autocomplete class to your code and make your subclass be a subclass of it.

On Wed, Jan 25, 2017 at 8:12 AM, Jaroslav Ciml <[email protected]>
wrote:

> Hi,
>
> I am trying to upgrade from Tapestry 5.3 to 5.4 and I encountered a
> problem with built-in mixin Autocomplete.
>
> It is quite useful if the mixin takes effect just if some condition is
> met. So I have implemented a custom mixin by subclassing the built-in one.
>
> Here is the important snippet of code:
>
> public class ConditionalAutocomplete extends Autocomplete
> {
>     @Parameter(name = "test", required = true, allowNull = false,
> defaultPrefix = BindingConstants.PROP)
>     private boolean enabled;
>
>     ...
>
>     @Override
>     protected void configure(final JSONObject config)
>     {
>         super.configure(config);
>         if (!enabled)
>         {
>             config.put("frequency", 365 * 24 * 60 * 60); // fire an Ajax
> request after the "ethernity" elapses
>             config.put("minChars", 1000000000); // at least "infinity"
> characters must be entered to fire an Ajax request
>         }
>     }
>
>     ...
> }
>
> I admit that disabling the feature by setting frequency and minChars to
> ethernity and infinity is somewhat tricky and can be considered as dirty.
> On the other hand, I have achived the required feature by reusing the
> existing built-in mixin with all its features.
>
> The mixing can be used in a template file like this:
>
> <t:textfield value="userEmail" t:mixins="conditionalAutocomplete" test="
> userAutocompleteSupported"/>
>
> The built-in mixin Autocomplete seems to be rewritten in Tapestry 5.4 and
> there is no method configure anymore.
>
> Is there any chance to implement the ConditionalAutocomplete with Tapestry
> 5.4?
>
> I can copy the code of Autocomplete.java and make some changes in it
> instead of subclassing. However, I am trying to find some better solution
> as such copying can cause troubles in next Tapestry upgrade.
>
> Thanks for help.
>
> Jarda
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Thiago
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.