Re: Rules and custom property-level components (D2W)

Holzner Roman <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Yes, thank you for the tip, now it works fine.

Roman

On 20.03.2006, at 14:46, Anjo Krank wrote:

> You need to watch out as the non-syncing version of setD2WContext()  
> is actually "setD2wContext()".
>
>>>
>>> So I just tried to extend my class of a D2WCustomComponent  
>>> instead of a simple WOComponent, because the D2WCustomComponent  
>>> has a method called d2wContext(). But this was not successful,  
>>> because I always receive a null value. (So it seems that the  
>>> D2WCustomComponent is only for whole pages and not for property- 
>>> components)
>
> No, this is wrong.
>
>>> My question is: is there a possibility to get access to the  
>>> d2wContext in a property component? Or should It normally work  
>>> and it's only my code which has some failure? For me, it's seems  
>>> to be completely impossible, but I won't believe that at the moment.
>
> The confusing thing is that the d2wContext is actually bound to  
> localContext. the easiest way to see how it is working is to look  
> at ERDCustomComponent from Project Wonder.
>
> Cheers, Anjo
>
> Am 20.03.2006 um 13:22 schrieb Holzner Roman:
>
>> hi all
>>
>> A new day, a new idea.
>>
>> To my question, I've the following solution:
>>
>> I added a D2WContext as an attribute to my component. Additionally  
>> I created the corresponding getter and setter. In the constructor  
>> I took via the context the current component() From that object, I  
>> got the d2wContext by calling valueForKey("localContext"). So it  
>> looks like that:
>>
>> 		public class MyComponent extends D2WCustomComponent{
>>
>> 		  protected D2WContext d2wContext;
>>
>> 		  public MyComponent(WOContext context) {
>> 		    WOComponent component = context().component();
>> 		    D2WContext ct = (D2WContext)component.valueForKey 
>> ("localContext");
>> 		    setD2WContext(ct);
>> 		  }
>> 		
>> 		  // Setter for the d2wContext
>> 		  public void setD2WContext(D2WContext newD2WContext) {
>>                     d2wContext = newD2WContext;
>> 		  }
>> 		
>> 		  // overwrites the method from D2WComponent
>> 		  public D2WComponent d2wContext() {
>> 		    return d2wContext;
>> 		  }
>> 		}
>> 	}
>> That seems to work in my application. But is that also a good  
>> solution? Especially as regards "localContext" and the context 
>> ().component() call, I'm not really sure if that's "allowed" or  
>> not. What do you think about it?
>>
>> Roman
>>
>>
>>
>>
>> On 17.03.2006, at 16:40, Holzner Roman wrote:
>>
>>> Hi list
>>>
>>> I just wanted to make a new custom property-level component for  
>>> my D2W project. In my component, I need to make some access to  
>>> values, which are written in my rule file (e.g. the value for  
>>> task, but also some custom values). To pump this information from  
>>> the component I need, as I understand it, some access to the  
>>> d2wContext or something similar.
>>>
>>> So I just tried to extend my class of a D2WCustomComponent  
>>> instead of a simple WOComponent, because the D2WCustomComponent  
>>> has a method called d2wContext(). But this was not successful,  
>>> because I always receive a null value. (So it seems that the  
>>> D2WCustomComponent is only for whole pages and not for property- 
>>> components)
>>>
>>> My question is: is there a possibility to get access to the  
>>> d2wContext in a property component? Or should It normally work  
>>> and it's only my code which has some failure? For me, it's seems  
>>> to be completely impossible, but I won't believe that at the moment.
>>>
>>> So I'm glad to read your answers and thanks in advance for your  
>>> proposals
>>>
>>> Have a nice weekend
>>> Roman
>>> _______________________________________________
>>> WebObjects-dev mailing list
>>> [email protected]
>>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>>>
>>
>> _______________________________________________
>> WebObjects-dev mailing list
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.