How Does Checkbox Know To Store To My Data Object

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How Does Checkbox Know To Store To My Data Object

dhongyt
I have a Data Object called DownloadBagService which works as a place to hold the checked files the a user selects.

I have a page that the user are able to select files from and add it to the DownloadBagService.
        Form<DownloadBagService> form = new Form<DownloadBagService>("dataForm")
        {
            @Override
            protected void onSubmit()
            {
//            	System.out.println("Size"+downloadBag.getDownloadBag().size());
//            	for (File f: downloadBag.getDownloadBag()) {
//            		System.out.println(f);
//            	}
//            	System.out.println("Size"+session.getDownloadBag().getDownloadBag().size());
//            	for (File f: session.getDownloadBag().getDownloadBag()) {
//            		System.out.println(f);
//            	}


//                //super.onSubmit();
//                FileListDisplayPanel list = (FileListDisplayPanel)lazyLoad.get(AjaxLazyLoadPanel.LAZY_LOAD_COMPONENT_ID);
//                List<File> checkedFiles = list.getChecked();
//                
//                for(File file : checkedFiles)
//                {
//                    downloadBag.addToDownloadBag(file);
//                }
//                
//                checkedFiles.clear();
//                list.setChecked(checkedFiles);
//                
//                setResponsePage(new HomePage(parameters));
            }
            
        };

When the user checks on files and hits submit. The files appear in the DownloadBagService "magically".
As you can see my onSubmit contains code that is commented out. How does Wicket know to put those files in the DownloadBagService?
Reply | Threaded
Open this post in threaded view
|

Re: How Does Checkbox Know To Store To My Data Object

Per Newgro
Hi david,

there is no code in your email.

Cheers
Per

Am 18.10.2013 22:39, schrieb dhongyt:

> I have a Data Object called DownloadBagService which works as a place to hold
> the checked files the a user selects.
>
> I have a page that the user are able to select files from and add it to the
> DownloadBagService.
>
>
> When the user checks on files and hits submit. The files appear in the
> DownloadBagService "magically".
> As you can see my onSubmit contains code that is commented out. How does
> Wicket know to put those files in the DownloadBagService?
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-Does-Checkbox-Know-To-Store-To-My-Data-Object-tp4661879.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How Does Checkbox Know To Store To My Data Object

dhongyt
Sorry I'm using the  tag

        Form<DownloadBagService> form = new Form<DownloadBagService>("dataForm")
        {
            @Override
            protected void onSubmit()
            {
            }
        };

Basically looks like this.
Reply | Threaded
Open this post in threaded view
|

Re: How Does Checkbox Know To Store To My Data Object

dhongyt
In reply to this post by Per Newgro
I think its an object in my Model?
Reply | Threaded
Open this post in threaded view
|

Re: How Does Checkbox Know To Store To My Data Object

meduolis
This post was updated on .
Try to add something like this onSubmit:
System.out.println("It's up to date compiled code running here")
 and check console if you get this output :).
I think you need to recompile your sources and application. Because this code snipped does nothing.
I might be wrong, we all do mistakes :)
Reply | Threaded
Open this post in threaded view
|

Re: How Does Checkbox Know To Store To My Data Object

Paul Bors
In reply to this post by dhongyt
Read section 10.2 "Models and JavaBeans" of the Wicket Guide at:
http://wicket.apache.org/guide/guide/chapter10.html#chapter10_2

From the code snipet you posted I take it your form or parent of your form has a CompondPropertyModel which must be feeding your checkbox. Either that, or you have a model tight to your checkbox.
~ Thank you,
    Paul@Bors.ws