Sessions and announcers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sessions and announcers

Bernat Romagosa
Hi again, I hope I'm not in your spam lists already...

I've subclassed ILSession for my application, as I need to handle users, languages and announcements, but I couldn't find anywhere how to tell my app to use this new session class (I'm afraid they forgot to explain it at http://doc.iliadproject.org/#Using-a-custom-session-class), so I executed ILSessionManager sessionClass: MySessionClass, which I'm not sure is the right thing to do and may be the source of the rest of my problems...

The other problem is related with announcements. In this session class I have an instVar called announcer, which holds an instance of Announcer. When, in a widget called languageSelector, the user selects a language using a dropdown box, an announcement is triggered, upon which the session changes its language (it does) and all widgets listening to this announcement should update themselves, but they don't.

I've even put spies in the widgets and they seem to ignore the announcement when it happens, for instance:

MySession >> initialize
   super initialize.
   self announcer on: STALocaleChosen do: [:it | self locale: it localeString. Transcript show: it localeString]

This works, but:

MyWidget >> initialize
  super initialize.
  self session announcer on: STALocaleChosen do: [:it | self markDirty. Transcript show: 'hello, I received an announcement']

This doesn't :(

I'm not sure what's going on here... can someone shed some light?

Thank you once more!

Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: Sessions and announcers

Bernat Romagosa
So I've managed to fix the localisation thing using announcements, I'm not sure what was wrong, but I did a fresh start and it worked as expected.

I'm still not sure whether doing ILSessionManager sessionClass: MySessionClass was the proper way to proceed though...

Thanks!

Bernat Romagosa.

2011/2/28 AxiNat <[hidden email]>
Hi again, I hope I'm not in your spam lists already...

I've subclassed ILSession for my application, as I need to handle users, languages and announcements, but I couldn't find anywhere how to tell my app to use this new session class (I'm afraid they forgot to explain it at http://doc.iliadproject.org/#Using-a-custom-session-class), so I executed ILSessionManager sessionClass: MySessionClass, which I'm not sure is the right thing to do and may be the source of the rest of my problems...

The other problem is related with announcements. In this session class I have an instVar called announcer, which holds an instance of Announcer. When, in a widget called languageSelector, the user selects a language using a dropdown box, an announcement is triggered, upon which the session changes its language (it does) and all widgets listening to this announcement should update themselves, but they don't.

I've even put spies in the widgets and they seem to ignore the announcement when it happens, for instance:

MySession >> initialize
   super initialize.
   self announcer on: STALocaleChosen do: [:it | self locale: it localeString. Transcript show: it localeString]

This works, but:

MyWidget >> initialize
  super initialize.
  self session announcer on: STALocaleChosen do: [:it | self markDirty. Transcript show: 'hello, I received an announcement']

This doesn't :(

I'm not sure what's going on here... can someone shed some light?

Thank you once more!

Bernat Romagosa.

Reply | Threaded
Open this post in threaded view
|

Re: Sessions and announcers

Nicolas Petton
Le lundi 28 février 2011 à 17:40 +0100, AxiNat a écrit :
> So I've managed to fix the localisation thing using announcements, I'm
> not sure what was wrong, but I did a fresh start and it worked as
> expected.

Great!
>
> I'm still not sure whether doing ILSessionManager sessionClass:
> MySessionClass was the proper way to proceed though...

yes, but be careful, it does *not* remove existing sessions, so you may
very well still have old sessions.

To remove all sessions:
ILSessionManager current removeAllSessions

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: Sessions and announcers

Nicolas Petton
In reply to this post by Bernat Romagosa
Le lundi 28 février 2011 à 16:57 +0100, AxiNat a écrit :
> Hi again, I hope I'm not in your spam lists already...

Hehe, not at all, this is the right place to ask questions :)

Nico