AW: AW: a smaall question
AW: AW: a smaall question
- Subject: AW: AW: a smaall question
- From: Helge Staedtler <email@hidden>
- Date: Thu, 18 Aug 2005 14:44:26 +0200
Well...
...works, but... besides having bidirectional import-statements...
You could set a public var in your class WOMySubclass, by adding changing
the subclass as follows...
public class WOMySubclass extends WOComponent {
public Session mySession = null;
public String mySessionVar = null;
public WOMySubclass (WOContext context) {
super(context);
}
public void awakwe() {
super.awake();
mySession = castedSession();
}
public Session castedSession() {
return (Session)session();
}
}
This way you end up with - attention now!!! - *NO* brackets at all. ;-)
Calling anywhere in your components e.g. mySession.mySessionVar = "easy";
Regards,
Helge
Am 18.08.2005 13:00 Uhr schrieb "David Teran" unter
<email@hidden>:
> ... but this works only if your subclass is in the same framework /
> app project as the session class you instanciate. If not then you
> might end up with bi directional import requirements which are hard
> to handle.
>
> better is to use keyvaluecoding like : session().valueForKey but then
> again you have to cast the result.
>
> regards, David
>
> On 18.08.2005, at 11:41, Helge Staedtler wrote:
>
>> You could let all your WOComponents inherit from a subclass you
>> create e.g.
>> from the following stuff...
>>
>> public class WOMySubclass extends WOComponent {
>>
>> public WOMySubclass (WOContext context) {
>> super(context);
>> }
>>
>> public Session castedSession() {
>> return (Session)session();
>> }
>>
>> }
>>
>> Then you only have to call castedSession(). You have saved 4
>> brackets. ;-)
>> If only all problems could be solved that easy...
>>
>> Regards,
>> Helge
>>
>>
>>
>>
>>
>> Am 18.08.2005 11:23 Uhr schrieb "Amedeo Mantica" unter
>> <email@hidden>:
>>
>>
>>> I have a variable declared in my Session.java
>>>
>>> when I need to access it i need alway to prepend "((Session)session
>>> ())".... ok
>>>
>>> But the is another method to do this.... some times some funcions
>>> become log and confusive... only ((Session)session()) are six
>>> brackets.... :=)
>>>
>>> Thanks and best regards
>>> Amedeo
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>>
>>
>> --
>> Helge Städtler
>>
>> - Expect and Respect.
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40cluster9.com
>>
>> This email sent to email@hidden
>>
>
--
Helge Städtler
- Expect and Respect.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden