no idea at this time, I need some sleep ... tomorrow ;-)

2010/10/16 mdipierro <mdipie...@cs.depaul.edu>:
> Make a mode called button_event.py
>
>  objects={}
>  class BUTTON(DIV):
>     def __init__(self,*a,**b):
>          self.tag = 'button'
>          DIV.__init__(self,*a,**b)
>          self.id=self['_id']
>          objects[self.id]=self
>     def addListener(self,name,f):
>          service.run_procedures[name] = lambda id: f(objects[id])
>          self['_onclick']="ajax('%s',[],':eval');return false;" \
>              % URL('default','call',args=('run',name,self['_id']))
>  button = BUTTON('click me',_id='abc')
>  button.addListener('xyz',lambda button: "jQuery('#%s').hide()" %
> button.id)
>
> and a controller default.py with
>
>  def index():
>      return dict(mybutton = button)
>  def call(): return service()
>
> This works as you expect.
> Here is the problem: the button has to defined in the model, not the
> controller. It it were to be defined in the controller, than the
> service would only register the listener in the scope of the function.
> Functions cannot be serialized. They could be cached in ram but that
> is still not a solution because the process may restart.
>
> Any idea?
>
>
>
>
>
>
>
> On Oct 15, 8:29 pm, Michele Comitini <michele.comit...@gmail.com>
> wrote:
>> 2010/10/16 mdipierro <mdipie...@cs.depaul.edu>:
>>
>> > Do you mean client-side events or server-side events, or something in
>> > between?
>>
>> client side events calling listeners on the server.
>>
>> For instance we have a button. Having an interface to add listeners
>> and managing ajax responses
>> would allow writing similar code in a controller:
>>
>> def ajaxButton(): # may use it with a/c/ajaxButton.load
>>   b=BUTTON('PUSH ME!')
>>   b.addListener(lambda ajaxresponse:
>> ajaxresponse.appendJS('jQuery(%s).hide();' % b.id)
>>
>> the above is just a stupid example, I hope it is not too confusing...
>>
>> I'd create a standard Json response encapsulating the payload of js,
>> page headers, and a list of maps of  the tipe {id: <element id>,
>> {html: <replacement>, onreadyjs: <javascript on element ready>}}.  A
>> javascript function (on the client)  would take care of reading the
>> Json response and take appropriate actions.
>>
>>
>>
>> > I think while we lack server-side events we actually have a system for
>> > handling client side events using jQuery and LOAD. I will post an
>> > example.  I need to resume and fix this:
>>
>> >http://groups.google.com/group/web2py/browse_thread/thread/9c7ac0bfa7...
>>
>> > the jDiv class was the grandfather of the LOAD helper.
>>
>> > On Oct 15, 3:10 pm, Michele Comitini <michele.comit...@gmail.com>
>> > wrote:
>> >> Lately I have been "forced" to use wicket (wicket.apache.org).
>> >> Wicket is by no means "agile" compared to web2py.  Wicket is not a
>> >> full stack framework it needs a lot of other things to serve pages.
>> >>   As with any java coding wicket takes ages and pages to do things
>> >> that python does in one line. Against there is the java language which
>> >> is not functional and you need to carry around full objects (in wicket
>> >> called models) to pass messages between components, which can be long
>> >> to write.
>>
>> >> But the thing I would take from wicket is a strong component/event
>> >> oriented approach with well defined interfaces, and a lot of
>> >> predefined widgets.
>>
>> >> The same componet/event architecture can be implemented in web2py
>> >> using pyjamas, and it is quite easy and much more flexible, but it
>> >> would be nice to have it included by default or as a plugin!
>>
>> >> 2010/10/15 David Marko <dma...@tiscali.cz>:
>>
>> >> > My favourite for clean java ishttp://www.playframework.org/Better
>> >> > experience than with Grails.
>>
>> >> > David
>>
>> >> > On 15 říj, 02:21, Bruno Rocha <rochacbr...@gmail.com> wrote:
>> >> >> Grails uses a template language
>>
>> >> >> <g:each in="${books}">
>>
>> >> >> You can't write Java or Groove in views as we can do with web2py 
>> >> >> writing
>> >> >> pure Python direclty in views.
>> >> >> It is one of the best/important feature in web2py, lot of people love 
>> >> >> web2py
>> >> >> because of the template system.
>>
>> >> >> 2010/10/14 Jonathan Lundell <jlund...@pobox.com>
>>
>> >> >> > On Oct 14, 2010, at 4:38 PM, DJ wrote:
>>
>> >> >> > I was in a discussion recently telling my friend how great Web2Py was
>> >> >> > for programmer productivity with all the inbuilt features (server,
>> >> >> > CRUD, auth). We were wondering if there was anything similar in Java?
>> >> >> > Quick google search brought me to Tapestry and Wicket.
>>
>> >> >> > Can any of you comment on any frameworks in java you have worked with
>> >> >> > that resemble Web2py? Thank you for your comments.
>>
>> >> >> > One possibility is Groovy, essentially a dynamic version of Java, 
>> >> >> > and the
>> >> >> > Grails framework.
>>
>> >> >> >http://en.wikipedia.org/wiki/Groovy_(programming_language)<http://en.wikipedia.org/wiki/Groovy_%28programming_language%29>
>> >> >> >http://en.wikipedia.org/wiki/Grails_(framework)<http://en.wikipedia.org/wiki/Grails_%28framework%29>
>>
>> >> >> > *Java is the new COBOL*
>>
>> >> >> --
>>
>> >> >>http://rochacbruno.com.br
>>
>>

Reply via email to