You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yunfeng Hou <ho...@yahoo.com> on 2005/12/23 08:55:21 UTC

page and component inheritance

It always troubled me when I need to extend an
existing component, because I have to copy all the
spec from the parent component. Not an OO way. And
when I need my pages to have some properties or
injected services in common, I have to duplicate the
page spec again. Not good either.

Thanks to hivemind, we can extend/replace the engine
when we need. I have an implementation for the feature
I need. All you have to do is to declear a property in
your specification, for example, 
<property name="_inheritance"
initial-value="contrib:Table" />
where the property name is always "_inheritance", and
the initial-value is the parent name. For page
inheritance, the parent can be a page specification
only, you do not need to define the corresponding
template.

Yunfeng Hou

hivemind.xml
========================================================

	<implementation
	
service-id="tapestry.page.PageSpecificationResolver">
		<invoke-factory model="threaded">
			<construct
			
class="com.newtouch.newtouchone.tapestry.InheritancePageSpecificationResolver">
				<set-object property="specificationSource"
					value="infrastructure:specificationSource" />
				<set-object property="componentPropertySource"
					value="infrastructure:componentPropertySource" />
				<set-service property="delegate"
				
service-id="tapestry.page.SpecificationResolverDelegate"
/>
				<set-object property="applicationId"
					value="infrastructure:applicationId" />
				<set-object property="contextRoot"
					value="infrastructure:contextRoot" />
			</construct>
		</invoke-factory>
	</implementation>


	<implementation
	
service-id="tapestry.page.ComponentSpecificationResolver">
		<invoke-factory model="threaded">
			<construct
			
class="com.newtouch.newtouchone.tapestry.InheritanceComponentSpecificationResolver">
				<set-object property="specificationSource"
					value="infrastructure:specificationSource" />
				<set-service property="delegate"
				
service-id="tapestry.page.SpecificationResolverDelegate"
/>
				<set-object property="applicationId"
					value="infrastructure:applicationId" />
				<set-object property="contextRoot"
					value="infrastructure:contextRoot" />
			</construct>
		</invoke-factory>
	</implementation>


========================================================


		
__________________________________________ 
Yahoo! DSL � Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com