Oops... as always... I seem to find the answer right after I send out these 
emails.  Well, hoping I help someone else:

I found ERXComponentUtilities.inheritTemplateFrom() in Wonder.

I'll take a look at that one.




On Jan 5, 2011, at 6:55 PM, Ricardo J. Parada wrote:

> Hi Chuck,
> 
> I have a need for inheriting from a class and template.  I saw your code 
> here.  But I don't know hwat ResourceManagerAdditions is.  Probably in your 
> private library.  Does Wonder have something equivalent?
> 
> Thanks,
> Ricardo Parada
> 
> 
> 
> 
> On Oct 15, 2009, at 7:27 PM, Chuck Hill wrote:
> 
>> 
>> On Oct 15, 2009, at 4:22 PM, Lon Varscsak wrote:
>> 
>>> Is there a way to subclass a component and have it use the template of
>>> the super-class?
>> 
>> 
>>   /**
>>    * Allows a component to "inherit" the template (.html and .wod files) 
>> from another component.
>>    * <p>Usage:</p>
>>    * <pre>
>>    * public WOElement template() {
>>    *     return inheritTemplateFrom("AddAddress", "CoreUI");
>>    * }
>>    * </pre>
>>    * This very simple implementation does have some limitations:
>>    * <ol>
>>    * <li>It can't he used to inherit the template of another component 
>> inheriting a template.</li>
>>    * <li>It can't handle having two components with the same name in 
>> different packages</li>
>>    * <li>It does not use WO template caching</li>
>>    * </ol>
>>    *
>>    * @see com.webobjects.appserver.WOComponent#template()
>>    *
>>    * @param componentName the name of the component whose template will be 
>> inherited
>>    * @param frameworkName name of the framework the component is in, or null 
>> if in the application
>>    * @return the template form the indicated component
>>    */
>>   public WOElement inheritTemplateFrom(String componentName, String 
>> frameworkName)
>>   {
>>       /** require [valid_componentName] componentName != null;  **/
>>       String componentPath = componentName + ".wo/" + componentName + ".";
>>       String htmlString = 
>> ResourceManagerAdditions.stringFromResource(componentPath + "html", null, 
>> session().languages());
>>       String wodString = 
>> ResourceManagerAdditions.stringFromResource(componentPath + "wod", null, 
>> session().languages());
>>       return WOComponent.templateWithHTMLString(htmlString, wodString, 
>> session().languages());
>>       /** ensure [valid_Result] Result != null;  **/
>>   }
>> 
>> 
>> -- 
>> Chuck Hill             Senior Consultant / VP Development
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/rparada%40mac.com
>> 
>> This email sent to [email protected]
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/rparada%40mac.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to