Conversion of the component docs took longer than I had anticipated (though it was greatly sped up by Howard's xsl work on it) .
You can control browser logging levels via the Shell component. The parameter is "browserLogLevel", with the default being WARNING. It's a string literal taking all the types you would expect. (INFO, ERROR, DEBUG, etc.) I think I have the debug container id hardcoded right now, but if you define a div as I have done in the TimeTracker example application the debug statements will go there. This week has been a little draining but I hope to get more done this weekend and be back to normal next week. I'm deploying a spot fix for a few IE things I noticed tonight. (oops) On 7/19/06, Norbert Sándor <[EMAIL PROTECTED]> wrote:
I have created a custom model, the patch is attached. It is not final but it is appropriate for common requirements. It should be good for a starting point. I added "searchDelay" as well. Some things: - it seems that the AJAX requests sent to the Autocompleter are cached which is not always good. As I see the dojo component does this caching, maybe it can be disabled... - where are the errors reported which occur during the AJAX request? There was an exception but neither dojo nor the java console showed it. Regards, Norbi Jesse Kuhnert wrote: > I think it sounds great/also scary :) I hope more people use it so I can > find out what causes this infamous dojo problem. > > The more I think about it the more it does make sense that > Autocomplete has > a completely different interface for the model data. That won't be > very hard > to do. I'll do it later tonight. (It ~is~ marked as a TODO item in the > source for it, guess now is a good time to do it. ) > > On 7/18/06, Norbert Sándor <[EMAIL PROTECTED]> wrote: >> >> For me the main problem is that Autocompleter iterates through all >> options when rendered. >> Another problem is that filtering is not customizable. >> >> After experimenting with 4.1, it "seems" to be stable. I hope I'm not >> wrong :) but I decided to convert my 4.0 code to it. >> What do you think? >> >> Regards, >> Norbi >> >> Jesse Kuhnert wrote: >> > The filtering happens asynchronously for the new Autocompleter as >> > well, but >> > I admittedly haven't changed IPropertySelectionModel to handle what it >> > needs >> > yet. The current PropertySelection component does equality matching >> > within >> > the component itself. I'd like to add a new method to >> > IPropertySelectionModel called "filterList(String value) " or >> similar to >> > handle this for either component. >> > >> > I think this should work out well for simple lists as well as those >> > backed >> > by database rows. What do you think? Perhaps I should go ahead and >> > create a >> > new model for Autocomplete anyways. If this sounds good I can make the >> > change tonight. >> > >> > BTW, did your dojo issues get magically resolved somehow? Please share >> as >> > you're not the only one who has seen it and I haven't been able to >> > reproduce >> > yet. It's making me more than a little scared. >> > >> > On 7/18/06, Norbert Sándor <[EMAIL PROTECTED]> wrote: >> >> >> >> Hello, >> >> >> >> My question is how can I provide AJAX filtering for it. I used >> >> Tacos:Autocompleter successfully for large data sets (some 1000 >> records) >> >> because it does the selection using AJAX. >> >> The 4.1 Autocompleter seems to push everything to the client side >> which >> >> makes it very slow (and CPU intensive on both the server and the >> >> client). >> >> Correct me if I'm wrong. >> >> >> >> Regards, >> >> Norbi >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> > >> ------------------------------------------------------------------------ >> > >> > No virus found in this incoming message. >> > Checked by AVG Free Edition. >> > Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date: >> 2006.07.17. >> > >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date: 2006.07.17. > > Index: D:/Project/external/Tapestry4.1/tapestry/tapestry-framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java =================================================================== --- D:/Project/external/Tapestry4.1/tapestry/tapestry-framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java (revision 423377) +++ D:/Project/external/Tapestry4.1/tapestry/tapestry-framework/src/java/org/apache/tapestry/dojo/form/Autocompleter.java (working copy) @@ -18,6 +18,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import org.apache.tapestry.IDirect; import org.apache.tapestry.IJSONRender; @@ -85,22 +86,19 @@ json.put("mode", MODE_REMOTE); json.put("widgetId", getName()); json.put("name", getName()); + json.put("searchDelay", getSearchDelay()); - IPropertySelectionModel model = getModel(); + IAutocompleterModel model = getModel(); if (model == null) throw Tapestry.createRequiredParameterException(this, "model"); - int count = model.getOptionCount(); Object value = getValue(); - - for (int i = 0; i < count; i++) { - Object option = model.getOption(i); - - if (isEqual(option, value)) { - json.put("value", model.getValue(i)); - json.put("label", model.getLabel(i)); - break; - } + + Object valueId = model.getIdFor(value); + if (valueId != null) + { + json.put("value", valueId); + json.put("label", model.getLabelFor(value)); } parms.put("props", json.toString()); @@ -115,29 +113,14 @@ */ public void renderComponent(IJSONWriter writer, IRequestCycle cycle) { - IPropertySelectionModel model = getModel(); + IAutocompleterModel model = getModel(); if (model == null) throw Tapestry.createRequiredParameterException(this, "model"); - - int count = model.getOptionCount(); - - for (int i = 0; i < count; i++) + + for (Map.Entry<String, String> entry: model.applyFilter (getFilter()).entrySet()) { - String value = model.getValue(i); - String label = model.getLabel(i); - - if (getFilter() == null || getFilter().trim().length() <= 0) { - writer.put(value, label); - continue; - } - - // primitive filter, for now - // TODO: Create filter interface in IPropertySelectionModel - if (getFilter() != null - && label.toLowerCase().indexOf(getFilter().toLowerCase()) > -1) { - writer.put(value, label); - } + writer.put(entry.getKey(), entry.getValue()); } } @@ -148,7 +131,7 @@ { String value = cycle.getParameter(getName()); - Object object = getModel().translateValue(value); + Object object = getModel().getValueFor(value); try { @@ -197,7 +180,7 @@ setFilter(cycle.getParameter("filter")); } - public abstract IPropertySelectionModel getModel(); + public abstract IAutocompleterModel getModel(); /** @since 4.1 */ public abstract boolean isFilterOnChange(); Index: D:/Project/external/Tapestry4.1/tapestry/tapestry-framework/src/java/org/apache/tapestry/dojo/form/IAutocompleterModel.java =================================================================== --- D:/Project/external/Tapestry4.1/tapestry/tapestry-framework/src/java/org/apache/tapestry/dojo/form/IAutocompleterModel.java (revision 0) +++ D:/Project/external/Tapestry4.1/tapestry/tapestry-framework/src/java/org/apache/tapestry/dojo/form/IAutocompleterModel.java (revision 0) @@ -0,0 +1,32 @@ +// Copyright 2006.07.19. The Apache Software Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package org.apache.tapestry.dojo.form; + +import java.util.Map; + + +/** + * @author acer + * + */ +public interface IAutocompleterModel +{ + public String getIdFor(Object value); + + public String getLabelFor(Object value); + + public Map<String, String> applyFilter(String filter); + + public Object getValueFor(String id); +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jesse Kuhnert Tacos/Tapestry, team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind.