You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ben <be...@yahoo.com> on 2010/09/08 16:15:06 UTC

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.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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


Re: How can I capture the data on one panel 1 when i click submit button on panel 2

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Is there a Wicket form wrapping both panels? If so, it will work, even if
both panels also have a form in them.

Jeremy Thomerson
http://wickettraining.com
-- sent from my "smart" phone, so please excuse spelling, formatting, or
compiler errors

On Sep 8, 2010 9:15 AM, "Ben" <be...@yahoo.com> wrote:


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.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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

Re: How can I capture the data on one panel 1 when i click submit button on panel 2

Posted by Andrea Del Bene <an...@libero.it>.
Ben <benarjee_g <at> yahoo.com> writes:

> Here is my panel1
>...
>         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);
...
> 
>             aform.setImageQuality((ImageQuality)model.getObject());
> 
> I am getting null when i try to get the model data.
> 
>      
> Thanks in anticipation
> 


Hi Ben!
I've seen your code and I have a couple of questions.
Why do you pass a CompoundPropertyModel to ImageQualityForm form and then you
build form components assigning a specific model to each of them? 

How do get the model data in your code?

Bye.


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


Re: How can I capture the data on one panel 1 when i click submit button on panel 2

Posted by jcgarciam <jc...@gmail.com>.
Jose, Check this out

https://issues.apache.org/jira/browse/WICKET-1312
<https://issues.apache.org/jira/browse/WICKET-1312>

On Wed, Sep 8, 2010 at 12:38 PM, MONZON Jose [via Apache Wicket] <
ml-node+2531520-6845597-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> 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:[hidden email]<http://user/SendEmail.jtp?type=node&node=2531520&i=0>]
>
> Sent: Mittwoch, 8. September 2010 16:15
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=2531520&i=1>
> 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<http://apache-wicket.1842946.n4.nabble.com/How-can-I-capture-the-data-on?by-user=t>
> -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: [hidden email]<http://user/SendEmail.jtp?type=node&node=2531520&i=2>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2531520&i=3>
>
>
>
> ==== 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<http://www.efgfp.com?by-user=t>.
> 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 [hidden email]<http://user/SendEmail.jtp?type=node&node=2531520&i=4>.
>
> ============================================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2531520&i=5>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2531520&i=6>
>
>
>
> ------------------------------
>  View message @
> 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-tp2531350p2531520.html
> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
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-tp2531350p2531697.html
Sent from the Wicket - User mailing list archive at Nabble.com.

RE: How can I capture the data on one panel 1 when i click submit button on panel 2

Posted by MONZON Jose <jo...@efgfp.com>.
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:benarjee_g@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@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 compliance@efgfp.com.
============================================================

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