• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

comprehension problem gwt & events

 
Greenhorn
Posts: 1
Mac Objective C Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I'm new to GWT. At the moment I'm reading the tutorial for the
StockWatcher (http://code.google.com/intl/de-DE/webtoolkit/doc/latest/
tutorial/codeclient.html).
Here is the code I do not understand:



At the first line a new Button is created. Afterwards the button gets
a new anonymous ClickHandler with the "onClick()" function. So far so
good.
But when the user clicks the button and the "onClick()" function is
called, how is it possible, that the String variable "symbol" still
lives in memory?
I have implemented this code to my eclipse and it works perfectly. But
I do not understand how is it possible to get the value of the
"symbol" variable after the button has been created and sent to
client.??? When user clicks on the button the "onClick()" function is
called and still has the value of the "symbol" string??'
Can someone explain it to me?
Thanks
Artur
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.
The variable symbol is referenced by stocks.indexOf(symbol); Hence it is not garbage collected and available when the onClick executes
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic