Re: Custom PopUp Problems
Re: Custom PopUp Problems
- Subject: Re: Custom PopUp Problems
- From: wojingo <email@hidden>
- Date: Thu, 27 Apr 2006 13:30:53 +0930
wojingo wrote:
Hey Scott,
Scott Winn wrote:
[snip]
The problem I am having is that I want to make the Pop-Up a reusable
component. I don't want to have to include all of the Fetch and
Qualifier logic in every page component that needs this pop-up. So I
made the new WOComponent. It is a partial page. I included the
fetch logic, and the list, item, displayString, noSelectionString,
and selectedValue bindings necessary for the WOPopUpButton. Then I
inserted the Pop-Up component into a page that does the editing.
At this point, I can run the app and the pop-up will appear on the
editing page with the correct list contents.
My problem is
1) I don't know how to tell the custom pop-up component what the
current object value to edit is (so it can get the
selected="selected" HTML in the option tag)
2) I don't know how to get the user selected value out of my custom
component to the page component that is doing the editing.
This is only a problem because I'm trying to build a reusable
component. If I were using a regular WOPopUpButton I would just bind
my objects parameters to the correct pop-up bindings. But since it
is a custom component when I include it on my editing page it doesn't
have any bindings at all.
I hope that clarifies things a bit, if not, I'll try again (or start
messing with Project Wonder).
In your custom component (call it Donkey) change the selection binding
of the standard WOPopUpButton to be:
selection = ^selection; (This is called carat notation.)
Then to use Donkey:
myDonkey: Donkey{
selection = theSelectedObjectInMyEditablePage;
}
///// Donkey html
<webobject name="pop"></webobject>
///// Donkey wod
pop: WOPopUpButton{
item = item;
list = list;
selection = ^selection;
}
///// Donkey Java
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class Donkey extends WOComponent {
public Donkey(WOContext context) {
super(context);
}
protected String item;
private NSArray _list =
new NSArray(new String[]{"Item One", "Item Two"});
protected NSArray list(){
return _list;
}
protected boolean isStateless(){
return true;
}
}
Whoops! For the record, that should be,
public boolean isStateless
And calling your component "Donkey" is optional :)
- shaun
_______________________________________________
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