er.extensions.components
Class ERXWOComponentContent
java.lang.Object
com.webobjects.appserver.WOElement
com.webobjects.appserver.WODynamicElement
er.extensions.components.ERXWOComponentContent
public class ERXWOComponentContent
- extends com.webobjects.appserver.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. |
Fields inherited from class com.webobjects.appserver.WODynamicElement |
_ConstructorParameters |
Constructor Summary |
ERXWOComponentContent(java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOElement woelement)
|
Method Summary |
void |
appendToResponse(com.webobjects.appserver.WOResponse woresponse,
com.webobjects.appserver.WOContext wocontext)
|
com.webobjects.appserver.WOActionResults |
invokeAction(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext wocontext)
|
void |
takeValuesFromRequest(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext wocontext)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
log
public static org.apache.log4j.Logger log
WOHTMLTemplateNameAttribute
public static java.lang.String WOHTMLTemplateNameAttribute
_defaultTemplate
protected com.webobjects.appserver.WOElement _defaultTemplate
ERXWOComponentContent
public ERXWOComponentContent(java.lang.String name,
com.webobjects.foundation.NSDictionary associations,
com.webobjects.appserver.WOElement woelement)
takeValuesFromRequest
public void takeValuesFromRequest(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext wocontext)
- Overrides:
takeValuesFromRequest
in class com.webobjects.appserver.WOElement
invokeAction
public com.webobjects.appserver.WOActionResults invokeAction(com.webobjects.appserver.WORequest worequest,
com.webobjects.appserver.WOContext wocontext)
- Overrides:
invokeAction
in class com.webobjects.appserver.WOElement
appendToResponse
public void appendToResponse(com.webobjects.appserver.WOResponse woresponse,
com.webobjects.appserver.WOContext wocontext)
- Overrides:
appendToResponse
in class com.webobjects.appserver.WOElement
toString
public java.lang.String toString()
- Overrides:
toString
in class com.webobjects.appserver.WODynamicElement
Copyright © 2002 – 2007 Project Wonder.