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 <borut.bolc...@gmail.com>wrote:

> Taha,
>
> can you please post the PeriodicAjaxUpdater.js also?
>
> Cheers,
> Borut
>
> 2010/10/17 Taha Hafeez <tawus.tapes...@gmail.com>
>
> > 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:zone t:mixins='periodicAjaxUpdater' t:zone='timeZone' t:period='4'
> > t:event='refresh' t:id='timeZone'>${today}</t:zone>
> >
> > //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 <ibe...@gmail.com> 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
> > >
> > >
> >
>

Reply via email to