Re: extended bindings
Re: extended bindings
- Subject: Re: extended bindings
- From: Timo Hoepfner <email@hidden>
- Date: Fri, 3 Nov 2006 22:00:56 +0100
Hi,
(1)reduce coding efforts.
That is already possible since more than 4,5 years using WOOgnl from
Project Wonder (*). WOOgnl just got even more powerful with recent
additions from Mike (**).
In wod file, instead of saying
UseBatching: WOConditional { condition = useBatching; } //
and implement method "useBatching"
We can do (more handy binding sugestions are welcome)
UseBatching: XYConditional {
testingValueOne = searchingResults.count;
testingValueTwo =
session.sessionUser.userPreferences.batchSize;
operator = ">";
}
With WOOgnl that would be something like:
condition =
"~searchingResults.count>session.sessionUser.userPreferences.batchSize";
Instead of doing
MyImage: WOImage { src = myImageSource; ...}
We can do
MyImage XYImage { src = contentEO.@imageUrlWithImageName?ofType?
_apple|jpg; }
expect url from method call
[contentEO imageUrlWithImageName:@"apple" ofType: @"jpg"]
or contentEO.imageUrlWithImageName("apple","jpg")
src = "~contentEO.imageUrlWithImageName('apple','jpg')";
(2)support runtime manageable contents and more.
MayImage: XYField { dataDict = aDataDict; }
// Where XYField is a WOSwitchComponent, the component name is
specified in aDataDict:
{
WOComponentName = XYImage;
sourceObjectKeyPath = contentEO;
fieldKey = src;
valueKeyPath = "@imageUrlWithImageName?ofType?_apple|jpg:";
border = 0;
width = 135;
...
}
And aDataDict can be from database, etc. that way one can have a
meta page (WOComponent) to handle various contentEOs and those EOs
are editable at runtime.
Several possibilities
(a) store BOTH HTML and WOD in your EO, create a component which
overrides template() and use WOComponent.templateWithHTMLString to
specify html and wod via bindings.
(b) use the LATEST (http://www.mdimension.com/~wonder/) WOOgnl from
Wonder and get rid of the WOD part of (a) by saving HTML like this to
your EO:
<wo:XYImage src="~contentEO.imageUrlWithImageName('apple','jpg')"
border="$0" width="$135" someString="bla" ... />
(c) use WOSwitchComponent and just store the WOD in your EO
There's some component in preparation which supports all of that.
(*) Short overview on WOOgnl
http://en.wikibooks.org/wiki/Programming:WebObjects/Project_WONDER/
Frameworks/WOOgnl
(**) Articles on Mike's recent additions to WOOgnl:
http://article.gmane.org/gmane.comp.web.webobjects.wonder-disc/4048
http://article.gmane.org/gmane.comp.web.webobjects.wonder-disc/4071
Timo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden