er.extensions.components
Class ERXWOComponentContent
java.lang.Object
com.webobjects.appserver.WOElement
com.webobjects.appserver.WODynamicElement
er.extensions.components.ERXWOComponentContent
public class ERXWOComponentContent
- extends WODynamicElement
Allows for multiple Component Contents.
Currently, WOComponentContent can only access a single subtemplate. We need a
way to pass several named contents.
==============================
Parent component:
==============================
<webobject name=SomeComponent>
This text will be ignored (unless you use WOComponentContent without templateName
in which case the templates will get appended twice!)
<webobject name=Template1>
This is the first template
</webobject>
<webobject name=Template2>
This is the second template
</webobject>
<webobject name=Template3>
This is the third template
</webobject>
</webobject>
===========
Parent wod:
===========
SomeComponent: SomeComponent {
someIvar = someValue;
}
Template1: ERXWOTemplate {
templateName = "firstTemplate";
}
Template2: ERXWOTemplate {
templateName = "secondTemplate";
}
Template3: ERXWOTemplate {
templateName = "thirdTemplate";
}
==============================
Child Component (SomeComponent)
==============================
Some static html
<webobject name=ComponentContent1>
This is the default content if "firstTemplate" is not defined by parent
</webobject>
<webobject name=Repetition>
<webobject name=ComponentContent3>
This is the default content if "thirdTemplate" is not defined by parent
</webobject>
</webobject>
<webobject name=ComponentContent2>
This is the default content if "secondTemplate" is not defined by parent
</webobject>
some more static html
===========
Child wod:
===========
ComponentContent1: ERXWOComponentContent {
templateName = "firstTemplate";
}
ComponentContent2: ERXWOComponentContent {
templateName = "secondTemplate";
}
ComponentContent3: ERXWOComponentContent {
templateName = "thirdTemplate";
}
So, the way this could work is to add functionality to WOComponentContent
which allows it to iterate through its elements and locate the named
templates. It also needs to be extended so that it takes the contents of its
refernce as a default if no named template is provided/found.
<webobject name=IfThenElse>
<webobject name=TrueBlock>
This is true block
</webobject>
<webobject name=FalseBlock>
This is false block
</webobject>
</webobject>
IfThenElse: IfThenElseComponent {
condition = someCondition;
}
Template1: ERXWOTemplate {
templateName = "true";
}
Template2: ERXWOTemplate {
templateName = "false";
}
- Author:
- ak (Java port), Charles Lloyd
| Bindings |
templateName | The templateName of the ERXWOTemplate which should be rendered
in place of this element. If not set, this element will behave like
a regular WOComponentContent, but filter out all ERXWOTemplates. |
log
public static Logger log
WOHTMLTemplateNameAttribute
public static String WOHTMLTemplateNameAttribute
_defaultTemplate
protected WOElement _defaultTemplate
ERXWOComponentContent
public ERXWOComponentContent(String name,
NSDictionary associations,
WOElement woelement)
takeValuesFromRequest
public void takeValuesFromRequest(WORequest worequest,
WOContext wocontext)
- Overrides:
takeValuesFromRequest in class WOElement
invokeAction
public WOActionResults invokeAction(WORequest worequest,
WOContext wocontext)
- Overrides:
invokeAction in class WOElement
appendToResponse
public void appendToResponse(WOResponse woresponse,
WOContext wocontext)
- Overrides:
appendToResponse in class WOElement
toString
public String toString()
- Overrides:
toString in class WODynamicElement
Copyright © 2002 – 2007 Project Wonder.