What you want is to implement the EventBus pattern (formally Observer
Pattern).

Basically, with an Eventbus, your panels subscribe to a given event and
when some other panel "fires" that event the subscriber gets the
message:

Panel1:
        //Subscribe to event Type1.
        eventBus.addHandler(EventType1.class,
                new EventType1Handler() {
                    @Override
                    public void oneEvent(final EventType1 event) {
                        //do whatever with the event
                    }
                });

Panel2:
        onClick(.....){
                ....
                //After some action, fire that something has change to
all
                //those subscribers that might be interested.
                eventBus.fireEvent(new EventType1(whatever));
        }

I'm quite new using Wicket, but I haven't seen anything like this
implemented. But I think it's quite trivial. It would be quite nice if
Wicket itself provides you with an out-of-the-box EventBus, the same way
GWT does. 

Have a look to the GWT implementation, you can practically "copy-paste"
it. There it's called HandlerManager.

I don't know what's the "standard" way to solve the problem you have.
Surelly everybody has run into it sooner or later. I'm very interested
in hearing what a seasoned Wicket developer has to say.




-----Original Message-----
From: Ben [mailto:benarje...@yahoo.com] 
Sent: Mittwoch, 8. September 2010 16:15
To: users@wicket.apache.org
Subject: How can I capture the data on one panel 1 when i click submit
button on panel 2


Hi,

I have a page and multiple panels added to it.

e.g I have panel1 and panel2 added to a page.

On Panel I have components RadioChoice, dropdownchoice,text area that
accepts input from the user.
Panel 2 has two textfields (accepts the login info) and submit button.

When i click submit button on panel2, how can I capture the data from
panel1.

Here is my panel1

public class ImageQualityPanel extends Panel {


    public ImageQualityPanel(String id, WicketAnalysisForm aform) {
        super(id);

        ImageQuality imageQuality = new ImageQuality(); //model

        add(new ImageQualityForm("imageQualityForm", new
CompoundPropertyModel(imageQuality), aform));
    }

    private static class ImageQualityForm extends Form {

        public ImageQualityForm(String id, IModel model,
WicketAnalysisForm
aform) {
            super(id, model);

            add(new Label("qualityQuestion", (....)));
            add(new Label("safetyQuestion", (...)));
            add(new Label("locationQuestion", (...)));
            add(new Label("commentsQuestion", (...)));

            List<String> options = Arrays.asList("Yes", "No");

            add(new RadioChoice("qualityGroup", options);
            add(new RadioChoice("criteriaGroup", options);

            TextArea notes = new TextArea("notes");
            notes.setRequired(true);
            add(notes);

            DropDownChoice group = new DropDownChoice("location");
            group.setChoices(new PropertyModel(model, "location") {
                public Object getObject() {
                    List<String> l = new ArrayList<String>(5);
                    l.add("Location 1");
                    l.add("Location 2");
                    l.add("Location 3");
                    l.add("Location 4");
                    return l;
                }
            });
            add(group);

            aform.setImageQuality((ImageQuality)model.getObject());

I am getting null when i try to get the model data.

     
Thanks in anticipation


-- 
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-can-I-capture-the-data-on
-one-panel-1-when-i-click-submit-button-on-panel-2-tp2531350p2531350.htm
l
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



==== The EFG Mail Gateway made the following annotation ====

This message is for the addressee only and may contain confidential or
privileged information. You must delete and not use it if you are not
the intended recipient. It may not be secure or error-free. All e-mail
communications to and from the EFG Financial Products Group may be monitored.
Processing of incoming e-mails cannot be guaranteed. Any views expressed
in this message are those of the individual sender. This message is for
information purposes only. All liability of the EFG Financial Products Group
and its entities for any damages resulting from e-mail use is excluded.
US persons are kindly requested to read the important legal information
presented at following URL: http://www.efgfp.com. If you suspect that the
message may have been intercepted or amended, please call the sender.
Should you require any further information, please contact the Compliance
Manager on complia...@efgfp.com.
============================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to