Re: [T5] Complexity for simple things, where is the documentation?
Thanks! 2011/1/8 Taha Hafeez > Hi Borut.. > > With pleasure. > > var PeriodicAjaxUpdater = Class.create({ > initialize:function(params){ > this.element = $(params.element); > this.url = params.url; > this.period = params.period; > $T(this.element).zoneId = params.zone; > var self = this; > new PeriodicalExecuter(function(){ > self.updateZone(); > }, this.period); > }, > > updateZone:function(){ > var zoneManager = Tapestry.findZoneManager(this.element); > if(!zoneManager){ > return; > } > > zoneManager.updateFromURL(this.url); > } > }); > > Had to search it using 'find' command on my laptop ... Seriously need to > update my work at http://code.google.com/p/tapestry-addons > > regards > Taha > > > On Sat, Jan 8, 2011 at 12:41 PM, Borut Bolčina >wrote: > > > Taha, > > > > can you please post the PeriodicAjaxUpdater.js also? > > > > Cheers, > > Borut > > > > 2010/10/17 Taha Hafeez > > > > > May be this helps! > > > > > > // > > > // Mixin > > > // > > > package tapestrydemo.mixins; > > > > > > import org.apache.tapestry5.ComponentResources; > > > import org.apache.tapestry5.BindingConstants; > > > import org.apache.tapestry5.services.javascript.JavaScriptSupport; > > > import org.apache.tapestry5.ClientElement; > > > import org.apache.tapestry5.annotations.Import; > > > import org.apache.tapestry5.annotations.Environmental; > > > import org.apache.tapestry5.annotations.InjectContainer; > > > import org.apache.tapestry5.annotations.Parameter; > > > import org.apache.tapestry5.ioc.annotations.Inject; > > > import org.apache.tapestry5.json.JSONObject; > > > > > > @Import(library="PeriodicAjaxUpdater.js") > > > public class PeriodicAjaxUpdater { > > > @Inject > > > private ComponentResources _componentResources; > > > > > > @Environmental > > > private JavaScriptSupport _javaScriptSupport; > > > > > > @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL) > > > private String _event; > > > > > > @Parameter > > > private Object[] _context; > > > > > > @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) > > > private String _zone; > > > > > > @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) > > > private int _period; > > > > > > @InjectContainer > > > private ClientElement _container; > > > > > > void afterRender(){ > > > String url = _componentResources.createEventLink(_event, > > > _context).toAbsoluteURI(); > > > JSONObject params = new JSONObject(); > > > params.put("url", url); > > > params.put("element", _container.getClientId()); > > > params.put("zone", _zone); > > > params.put("period", _period); > > > _javaScriptSupport.addScript("new PeriodicAjaxUpdater(%s);", > > > params.toString()); > > > } > > > } > > > > > > //A simple page > > > > > t:event='refresh' t:id='timeZone'>${today} > > > > > > //Page java > > > public class Index { > > > @Component(id="timeZone") > > > private Zone _zone; > > > > > > public java.util.Date getToday(){ > > > return new java.util.Date(); > > > } > > > > > > Object onRefresh(){ > > > return _zone.getBody(); > > > } > > > } > > > > > > regards > > > Taha > > > > > > > > > > > > On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo < > > > thiag...@gmail.com> wrote: > > > > > > > On Sat, 16 Oct 2010 18:30:15 -0300, iberck wrote: > > > > > > > > In this example, > > > >> what happend if I want to learn mixins for create my own, where is > the > > > >> official documentation? > > > >> > > > > > > > > http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just > > > went > > > > to the T5.2 front page and searched for "mixin". > > > > > > > > > > > > Must I necessarily download and understand the source code of > > > >> Autocompletemixin for learn? > > > >> > > > > > > > > No, but it's a good thing to do. :) > > > > > > > > > > > > I think not all users are used to download the source code of the > > > >> frameworks for learning > > > >> > > > > > > > > I agree, but you can learn a lot from reading source code. ;) > > > > > > > > -- > > > > Thiago H. de Paula Figueiredo > > > > Independent Java, Apache Tapestry 5 and Hibernate consultant, > > developer, > > > > and instructor > > > > Owner, Ars Machina Tecnologia da Informação Ltda. > > > > http://www.arsmachina.com.br > > > > > > > > > > > > - > > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > > > > > > >
Re: [T5] Complexity for simple things, where is the documentation?
Hi Borut.. With pleasure. var PeriodicAjaxUpdater = Class.create({ initialize:function(params){ this.element = $(params.element); this.url = params.url; this.period = params.period; $T(this.element).zoneId = params.zone; var self = this; new PeriodicalExecuter(function(){ self.updateZone(); }, this.period); }, updateZone:function(){ var zoneManager = Tapestry.findZoneManager(this.element); if(!zoneManager){ return; } zoneManager.updateFromURL(this.url); } }); Had to search it using 'find' command on my laptop ... Seriously need to update my work at http://code.google.com/p/tapestry-addons regards Taha On Sat, Jan 8, 2011 at 12:41 PM, Borut Bolčina wrote: > Taha, > > can you please post the PeriodicAjaxUpdater.js also? > > Cheers, > Borut > > 2010/10/17 Taha Hafeez > > > May be this helps! > > > > // > > // Mixin > > // > > package tapestrydemo.mixins; > > > > import org.apache.tapestry5.ComponentResources; > > import org.apache.tapestry5.BindingConstants; > > import org.apache.tapestry5.services.javascript.JavaScriptSupport; > > import org.apache.tapestry5.ClientElement; > > import org.apache.tapestry5.annotations.Import; > > import org.apache.tapestry5.annotations.Environmental; > > import org.apache.tapestry5.annotations.InjectContainer; > > import org.apache.tapestry5.annotations.Parameter; > > import org.apache.tapestry5.ioc.annotations.Inject; > > import org.apache.tapestry5.json.JSONObject; > > > > @Import(library="PeriodicAjaxUpdater.js") > > public class PeriodicAjaxUpdater { > > @Inject > > private ComponentResources _componentResources; > > > > @Environmental > > private JavaScriptSupport _javaScriptSupport; > > > > @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL) > > private String _event; > > > > @Parameter > > private Object[] _context; > > > > @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) > > private String _zone; > > > > @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) > > private int _period; > > > > @InjectContainer > > private ClientElement _container; > > > > void afterRender(){ > > String url = _componentResources.createEventLink(_event, > > _context).toAbsoluteURI(); > > JSONObject params = new JSONObject(); > > params.put("url", url); > > params.put("element", _container.getClientId()); > > params.put("zone", _zone); > > params.put("period", _period); > > _javaScriptSupport.addScript("new PeriodicAjaxUpdater(%s);", > > params.toString()); > > } > > } > > > > //A simple page > > > t:event='refresh' t:id='timeZone'>${today} > > > > //Page java > > public class Index { > > @Component(id="timeZone") > > private Zone _zone; > > > > public java.util.Date getToday(){ > > return new java.util.Date(); > > } > > > > Object onRefresh(){ > > return _zone.getBody(); > > } > > } > > > > regards > > Taha > > > > > > > > On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo < > > thiag...@gmail.com> wrote: > > > > > On Sat, 16 Oct 2010 18:30:15 -0300, iberck wrote: > > > > > > In this example, > > >> what happend if I want to learn mixins for create my own, where is the > > >> official documentation? > > >> > > > > > > http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just > > went > > > to the T5.2 front page and searched for "mixin". > > > > > > > > > Must I necessarily download and understand the source code of > > >> Autocompletemixin for learn? > > >> > > > > > > No, but it's a good thing to do. :) > > > > > > > > > I think not all users are used to download the source code of the > > >> frameworks for learning > > >> > > > > > > I agree, but you can learn a lot from reading source code. ;) > > > > > > -- > > > Thiago H. de Paula Figueiredo > > > Independent Java, Apache Tapestry 5 and Hibernate consultant, > developer, > > > and instructor > > > Owner, Ars Machina Tecnologia da Informação Ltda. > > > http://www.arsmachina.com.br > > > > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > >
Re: [T5] Complexity for simple things, where is the documentation?
Taha, can you please post the PeriodicAjaxUpdater.js also? Cheers, Borut 2010/10/17 Taha Hafeez > May be this helps! > > // > // Mixin > // > package tapestrydemo.mixins; > > import org.apache.tapestry5.ComponentResources; > import org.apache.tapestry5.BindingConstants; > import org.apache.tapestry5.services.javascript.JavaScriptSupport; > import org.apache.tapestry5.ClientElement; > import org.apache.tapestry5.annotations.Import; > import org.apache.tapestry5.annotations.Environmental; > import org.apache.tapestry5.annotations.InjectContainer; > import org.apache.tapestry5.annotations.Parameter; > import org.apache.tapestry5.ioc.annotations.Inject; > import org.apache.tapestry5.json.JSONObject; > > @Import(library="PeriodicAjaxUpdater.js") > public class PeriodicAjaxUpdater { > @Inject > private ComponentResources _componentResources; > > @Environmental > private JavaScriptSupport _javaScriptSupport; > > @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL) > private String _event; > > @Parameter > private Object[] _context; > > @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) > private String _zone; > > @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) > private int _period; > > @InjectContainer > private ClientElement _container; > > void afterRender(){ > String url = _componentResources.createEventLink(_event, > _context).toAbsoluteURI(); > JSONObject params = new JSONObject(); > params.put("url", url); > params.put("element", _container.getClientId()); > params.put("zone", _zone); > params.put("period", _period); > _javaScriptSupport.addScript("new PeriodicAjaxUpdater(%s);", > params.toString()); > } > } > > //A simple page > t:event='refresh' t:id='timeZone'>${today} > > //Page java > public class Index { > @Component(id="timeZone") > private Zone _zone; > > public java.util.Date getToday(){ > return new java.util.Date(); > } > > Object onRefresh(){ > return _zone.getBody(); > } > } > > regards > Taha > > > > On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo < > thiag...@gmail.com> wrote: > > > On Sat, 16 Oct 2010 18:30:15 -0300, iberck wrote: > > > > In this example, > >> what happend if I want to learn mixins for create my own, where is the > >> official documentation? > >> > > > > http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just > went > > to the T5.2 front page and searched for "mixin". > > > > > > Must I necessarily download and understand the source code of > >> Autocompletemixin for learn? > >> > > > > No, but it's a good thing to do. :) > > > > > > I think not all users are used to download the source code of the > >> frameworks for learning > >> > > > > I agree, but you can learn a lot from reading source code. ;) > > > > -- > > Thiago H. de Paula Figueiredo > > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > > and instructor > > Owner, Ars Machina Tecnologia da Informação Ltda. > > http://www.arsmachina.com.br > > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > >
Re: [T5] Complexity for simple things, where is the documentation?
JumpStart is the BEST Tapestry Documentation... http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/zonewithoutyellowfade http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/zonewithoutyellowfade Good Luck... -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Complexity-for-simple-things-where-is-the-documentation-tp3214893p3216712.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: [T5] Complexity for simple things, where is the documentation?
For your specific use case, displaying the server time on the page, would you not be better off to initialize a value to the current server time upon initial page display, and then use a JS widget to increment/refresh the time field on the client side? This would save a lot of unnecessary network traffic, unless there is a compelling reason to have absolute synchronization between what is displayed and the actual time on the server. The variance would be sub one second with this approach, and you would not require zone updating etc. Regards, Jim. -Original Message- From: iberck [mailto:ibe...@gmail.com] Sent: 16 October 2010 22:30 To: users@tapestry.apache.org Subject: Re: [T5] Complexity for simple things, where is the documentation? Thank you very much for your time and your responses In this example, what happend if I want to learn mixins for create my own, where is the official documentation? Must I necessarily download and understand the source code of Autocompletemixin for learn? I think not all users are used to download the source code of the frameworks for learning -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Complexity-for-simple-things-where- is-the-documentation-tp3214893p3215542.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Complexity for simple things, where is the documentation?
May be this helps! // // Mixin // package tapestrydemo.mixins; import org.apache.tapestry5.ComponentResources; import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.services.javascript.JavaScriptSupport; import org.apache.tapestry5.ClientElement; import org.apache.tapestry5.annotations.Import; import org.apache.tapestry5.annotations.Environmental; import org.apache.tapestry5.annotations.InjectContainer; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.json.JSONObject; @Import(library="PeriodicAjaxUpdater.js") public class PeriodicAjaxUpdater { @Inject private ComponentResources _componentResources; @Environmental private JavaScriptSupport _javaScriptSupport; @Parameter(required=true, defaultPrefix=BindingConstants.LITERAL) private String _event; @Parameter private Object[] _context; @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) private String _zone; @Parameter(defaultPrefix=BindingConstants.LITERAL, required=true) private int _period; @InjectContainer private ClientElement _container; void afterRender(){ String url = _componentResources.createEventLink(_event, _context).toAbsoluteURI(); JSONObject params = new JSONObject(); params.put("url", url); params.put("element", _container.getClientId()); params.put("zone", _zone); params.put("period", _period); _javaScriptSupport.addScript("new PeriodicAjaxUpdater(%s);", params.toString()); } } //A simple page ${today} //Page java public class Index { @Component(id="timeZone") private Zone _zone; public java.util.Date getToday(){ return new java.util.Date(); } Object onRefresh(){ return _zone.getBody(); } } regards Taha On Sun, Oct 17, 2010 at 3:09 AM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Sat, 16 Oct 2010 18:30:15 -0300, iberck wrote: > > In this example, >> what happend if I want to learn mixins for create my own, where is the >> official documentation? >> > > http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just went > to the T5.2 front page and searched for "mixin". > > > Must I necessarily download and understand the source code of >> Autocompletemixin for learn? >> > > No, but it's a good thing to do. :) > > > I think not all users are used to download the source code of the >> frameworks for learning >> > > I agree, but you can learn a lot from reading source code. ;) > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: [T5] Complexity for simple things, where is the documentation?
On Sat, 16 Oct 2010 18:30:15 -0300, iberck wrote: In this example, what happend if I want to learn mixins for create my own, where is the official documentation? http://tapestry.apache.org/tapestry5.2-dev/guide/mixins.html. I just went to the T5.2 front page and searched for "mixin". Must I necessarily download and understand the source code of Autocompletemixin for learn? No, but it's a good thing to do. :) I think not all users are used to download the source code of the frameworks for learning I agree, but you can learn a lot from reading source code. ;) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Complexity for simple things, where is the documentation?
Thank you very much for your time and your responses In this example, what happend if I want to learn mixins for create my own, where is the official documentation? Must I necessarily download and understand the source code of Autocompletemixin for learn? I think not all users are used to download the source code of the frameworks for learning -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Complexity-for-simple-things-where-is-the-documentation-tp3214893p3215542.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Complexity for simple things, where is the documentation?
If you ONLY want to refresh your whole page every 1 second you can do it in many ways. Without Tapestry. One is with a pretty simple javascript, like for example in this guide: http://www.quackit.com/javascript/javascript_refresh_page.cfm Usually you would not use xx megabytes of special software libraries that can work in gazillion of customized ways for building a web site with only 3 simple web pages? Right. So if you ask a question on the mailing list of such a software framework, people will generally think that you need something special and will give you some more complex examples that would work in various scenarios. In 10/16/2010 09:55 AM, iberck wrote: > In another past post I asked how can I refresh my page with the server time: > http://tapestry.1045711.n5.nabble.com/T5-Refresh-1-second-Ajax-method-td3210194.html#a3210194 smime.p7s Description: S/MIME Cryptographic Signature
Re: [T5] Complexity for simple things, where is the documentation?
You won't find any simpler solutions to this in other frameworks either. If you want to create a page that refreshes itself with the serve time periodically, you can't avoid at least some knowledge about how AJAX works in general. You may avoid javascript by using Google Web Toolkit, but that has its own learning curve. The solution to your problem here is very simple and requires a minimal amount of digging from your side. Just create a script that uses Ajax.Updater from prototype, and generate a link on the server side that you can use to trigger an event on your java class. See Autocompleter mixin from tapestry for a very good example. Once you've learned this rather simple technique, you won't need much else. Tapestry's strength here is that it enables you to make a nice wrapping out of your specialized component, so later on you can find your script, your html and your java files packaged together in a nice module doing a very simple thing and nothing else. See my blog for some more simple examples. http://tinybits.blogspot.com/ On Sat, Oct 16, 2010 at 9:55 AM, iberck wrote: > > I'm little confused with Tapestry > > In another past post I asked how can I refresh my page with the server > time: > > http://tapestry.1045711.n5.nabble.com/T5-Refresh-1-second-Ajax-method-td3210194.html#a3210194 > > I only need refresh my page with the server time and I need to learn > mixins, > ajax, zones, prototype, components, tapestry ajax methods (tapestry.js), ? > > http://blog.bolkey.com/2010/05/creating-a-news-feed-in-tapestry-5/ > why all this code for that simple issue? > > I don't understand why there is this level of complexity... I see if you > want to learn tapestry also you need to learn necessarily Prototype and > download some source code to understand some things, I only see official > documentation with basic concepts by alphabet but what happend with > specific > scenarios? the documentation is the source code? > For example, where is the documentation for Tapestry.js use? > > I only want help to have a better framework or understand this point... > > Thank you for read me > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/T5-Complexity-for-simple-things-where-is-the-documentation-tp3214893p3214893.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
[T5] Complexity for simple things, where is the documentation?
I'm little confused with Tapestry In another past post I asked how can I refresh my page with the server time: http://tapestry.1045711.n5.nabble.com/T5-Refresh-1-second-Ajax-method-td3210194.html#a3210194 I only need refresh my page with the server time and I need to learn mixins, ajax, zones, prototype, components, tapestry ajax methods (tapestry.js), ? http://blog.bolkey.com/2010/05/creating-a-news-feed-in-tapestry-5/ why all this code for that simple issue? I don't understand why there is this level of complexity... I see if you want to learn tapestry also you need to learn necessarily Prototype and download some source code to understand some things, I only see official documentation with basic concepts by alphabet but what happend with specific scenarios? the documentation is the source code? For example, where is the documentation for Tapestry.js use? I only want help to have a better framework or understand this point... Thank you for read me -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Complexity-for-simple-things-where-is-the-documentation-tp3214893p3214893.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org