
Public Member Functions | |
| void | appendToResponse (WOResponse woresponse, WOContext wocontext) |
| ERXWOComponentContent (String name, NSDictionary associations, WOElement woelement) | |
| WOActionResults | invokeAction (WORequest worequest, WOContext wocontext) |
| void | takeValuesFromRequest (WORequest worequest, WOContext wocontext) |
| String | toString () |
Static Public Attributes | |
| static Logger | log = Logger.getLogger(ERXWOComponentContent.class) |
| static String | WOHTMLTemplateNameAttribute = "templateName" |
Protected Attributes | |
| WOElement | _defaultTemplate |
Private Member Functions | |
| WOElement | template (WOComponent component) |
Private Attributes | |
| WOAssociation | _templateName |
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";
}
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.
| ERXWOComponentContent | ( | String | name, | |
| NSDictionary | associations, | |||
| WOElement | woelement | |||
| ) |
| void appendToResponse | ( | WOResponse | woresponse, | |
| WOContext | wocontext | |||
| ) |
| WOActionResults invokeAction | ( | WORequest | worequest, | |
| WOContext | wocontext | |||
| ) |
| void takeValuesFromRequest | ( | WORequest | worequest, | |
| WOContext | wocontext | |||
| ) |
| WOElement template | ( | WOComponent | component | ) | [private] |
| String toString | ( | ) |
WOElement _defaultTemplate [protected] |
WOAssociation _templateName [private] |
Logger log = Logger.getLogger(ERXWOComponentContent.class) [static] |
String WOHTMLTemplateNameAttribute = "templateName" [static] |
1.5.8