• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom PopUp Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Custom PopUp Problems (From: Scott Winn <email@hidden>)
 >Re: Custom PopUp Problems (From: Ken Anderson <email@hidden>)
 >Re: Custom PopUp Problems (From: Scott Winn <email@hidden>)
 >Re: Custom PopUp Problems (From: wojingo <email@hidden>)

  • Prev by Date: Re: Custom PopUp Problems
  • Next by Date: Re: reproduction of mailing list posts
  • Previous by thread: Re: Custom PopUp Problems
  • Next by thread: Re: Custom PopUp Problems
  • Index(es):
    • Date
    • Thread