Re: Event handler for model ?

2009-06-13 Thread Dalla

I thinkt I´m getting the hang of things now, using your examples and
the ones from the link I posted

On 12 Juni, 09:39, mnenchev  wrote:
> Well what exactly you want to do?
>
>
>
> Dalla wrote:
> > Could you please post some examples will?
> > Or maybe send me some code? mnenchevs example was good, but more
> > examples never hurt :-)
>
> > On 11 Juni, 14:08, Will  wrote:
>
> >> That's what I use as well.  I created an Abstract Class with
> >> Hashmap for removing a handler
> >> (because HandlerManager.removeHandler(..) is depricated) and use that
> >> for all my UI components that create custom events.  I then create sub-
> >> Classes of EventHandler for each logical group of events but that's
> >> just to help keep the project readable.  Doing it once for the base UI
> >> class didn't seem overweight but we'll see how it performs once I get
> >> the project into a perf test.
>
> >> On Jun 10, 8:40 am, Dalla  wrote:
>
> >>> Hi
>
> >>> I´m having trouble understanding how to implement an event handler for
> >>> my custom objects with the new event handler system. Let´s pretend I
> >>> have a very simple model class like this one:
>
> >>> public class ArrivalData {
> >>>         private Date date;
> >>>         private boolean processing = false;
>
> >>>         public Date getDate() {
> >>>                 return date;
> >>>         }
>
> >>>         public void setDate(Date date) {
> >>>                 this.date = date;
> >>>         }
>
> >>> }
>
> >>> When setDate is called, I want to fire an event that my view
> >>> components can listen on, and act on when called for.
> >>> How would you go about doing that? Are there any existing handler
> >>> interfaces that can be used?
> >>> I found this tutorial (see link below), but it seems pretty
> >>> complicated for what I´m trying to 
> >>> acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g...
>
> >>> What´s best practice here?- Dölj citerad text -
>
> - Visa citerad text -

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Event handler for model ?

2009-06-12 Thread mnenchev


Well what exactly you want to do?

Dalla wrote:

> Could you please post some examples will?
> Or maybe send me some code? mnenchevs example was good, but more
> examples never hurt :-)
>
> On 11 Juni, 14:08, Will  wrote:
>   
>> That's what I use as well.  I created an Abstract Class with
>> Hashmap for removing a handler
>> (because HandlerManager.removeHandler(..) is depricated) and use that
>> for all my UI components that create custom events.  I then create sub-
>> Classes of EventHandler for each logical group of events but that's
>> just to help keep the project readable.  Doing it once for the base UI
>> class didn't seem overweight but we'll see how it performs once I get
>> the project into a perf test.
>>
>> On Jun 10, 8:40 am, Dalla  wrote:
>>
>>
>>
>> 
>>> Hi
>>>   
>>> I´m having trouble understanding how to implement an event handler for
>>> my custom objects with the new event handler system. Let´s pretend I
>>> have a very simple model class like this one:
>>>   
>>> public class ArrivalData {
>>> private Date date;
>>> private boolean processing = false;
>>>   
>>> public Date getDate() {
>>> return date;
>>> }
>>>   
>>> public void setDate(Date date) {
>>> this.date = date;
>>> }
>>>   
>>> }
>>>   
>>> When setDate is called, I want to fire an event that my view
>>> components can listen on, and act on when called for.
>>> How would you go about doing that? Are there any existing handler
>>> interfaces that can be used?
>>> I found this tutorial (see link below), but it seems pretty
>>> complicated for what I´m trying to 
>>> acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g...
>>>   
>>> What´s best practice here?
>>>   
> >
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Event handler for model ?

2009-06-11 Thread Dalla

Could you please post some examples will?
Or maybe send me some code? mnenchevs example was good, but more
examples never hurt :-)

On 11 Juni, 14:08, Will  wrote:
> That's what I use as well.  I created an Abstract Class with
> Hashmap for removing a handler
> (because HandlerManager.removeHandler(..) is depricated) and use that
> for all my UI components that create custom events.  I then create sub-
> Classes of EventHandler for each logical group of events but that's
> just to help keep the project readable.  Doing it once for the base UI
> class didn't seem overweight but we'll see how it performs once I get
> the project into a perf test.
>
> On Jun 10, 8:40 am, Dalla  wrote:
>
>
>
> > Hi
>
> > I´m having trouble understanding how to implement an event handler for
> > my custom objects with the new event handler system. Let´s pretend I
> > have a very simple model class like this one:
>
> > public class ArrivalData {
> >         private Date date;
> >         private boolean processing = false;
>
> >         public Date getDate() {
> >                 return date;
> >         }
>
> >         public void setDate(Date date) {
> >                 this.date = date;
> >         }
>
> > }
>
> > When setDate is called, I want to fire an event that my view
> > components can listen on, and act on when called for.
> > How would you go about doing that? Are there any existing handler
> > interfaces that can be used?
> > I found this tutorial (see link below), but it seems pretty
> > complicated for what I´m trying to 
> > acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g...
>
> > What´s best practice here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Event handler for model ?

2009-06-11 Thread Will

That's what I use as well.  I created an Abstract Class with
Hashmap for removing a handler
(because HandlerManager.removeHandler(..) is depricated) and use that
for all my UI components that create custom events.  I then create sub-
Classes of EventHandler for each logical group of events but that's
just to help keep the project readable.  Doing it once for the base UI
class didn't seem overweight but we'll see how it performs once I get
the project into a perf test.


On Jun 10, 8:40 am, Dalla  wrote:
> Hi
>
> I´m having trouble understanding how to implement an event handler for
> my custom objects with the new event handler system. Let´s pretend I
> have a very simple model class like this one:
>
> public class ArrivalData {
>         private Date date;
>         private boolean processing = false;
>
>         public Date getDate() {
>                 return date;
>         }
>
>         public void setDate(Date date) {
>                 this.date = date;
>         }
>
> }
>
> When setDate is called, I want to fire an event that my view
> components can listen on, and act on when called for.
> How would you go about doing that? Are there any existing handler
> interfaces that can be used?
> I found this tutorial (see link below), but it seems pretty
> complicated for what I´m trying to 
> acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g...
>
> What´s best practice here?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Event handler for model ?

2009-06-11 Thread mnenchev

Here you are some simple example, witch is not the best example but 
would point you:

public interface MyHandler {

 public void handle(T t);
}

public class ArrivalData {
private Date date;
private boolean processing = false;
private List> dateHandlers = new 
ArrayList();

public void addHandler(MyHandler h) {
dateHandlers.add(h);
}

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
for(MyHandler h : dateHandlers) {
h.handle(date);
}
}

}

public class CustomObject implements MyHandler {



@Override
public void handle(Date date) {
// receive data from setDate(..);
// handle it in some way
}


}




Dalla wrote:
> No clues anyone?
>
> On 10 Juni, 14:40, Dalla  wrote:
>   
>> Hi
>>
>> I´m having trouble understanding how to implement an event handler for
>> my custom objects with the new event handler system. Let´s pretend I
>> have a very simple model class like this one:
>>
>> public class ArrivalData {
>> private Date date;
>> private boolean processing = false;
>>
>> public Date getDate() {
>> return date;
>> }
>>
>> public void setDate(Date date) {
>> this.date = date;
>> }
>>
>> }
>>
>> When setDate is called, I want to fire an event that my view
>> components can listen on, and act on when called for.
>> How would you go about doing that? Are there any existing handler
>> interfaces that can be used?
>> I found this tutorial (see link below), but it seems pretty
>> complicated for what I´m trying to 
>> acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g...
>>
>> What´s best practice here?
>> 
> >
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Event handler for model ?

2009-06-11 Thread Dalla

No clues anyone?

On 10 Juni, 14:40, Dalla  wrote:
> Hi
>
> I´m having trouble understanding how to implement an event handler for
> my custom objects with the new event handler system. Let´s pretend I
> have a very simple model class like this one:
>
> public class ArrivalData {
>         private Date date;
>         private boolean processing = false;
>
>         public Date getDate() {
>                 return date;
>         }
>
>         public void setDate(Date date) {
>                 this.date = date;
>         }
>
> }
>
> When setDate is called, I want to fire an event that my view
> components can listen on, and act on when called for.
> How would you go about doing that? Are there any existing handler
> interfaces that can be used?
> I found this tutorial (see link below), but it seems pretty
> complicated for what I´m trying to 
> acheive.http://www.itsolut.com/chrismusings/2009/04/28/business-events-with-g...
>
> What´s best practice here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---