You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2007/03/01 07:12:10 UTC
svn commit: r513158 - in /incubator/wicket/branches/wicket-1.x:
wicket-examples/src/main/java/wicket/examples/upload/
wicket-examples/src/main/webapp/
wicket-quickstart/src/main/java/wicket/quickstart/
Author: ivaynberg
Date: Wed Feb 28 22:12:09 2007
New Revision: 513158
URL: http://svn.apache.org/viewvc?view=rev&rev=513158
Log:
first cut on Multi File Upload Field
Modified:
incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadApplication.java
incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadPage.properties
incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/webapp/index.html
incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.html
incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.java
incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/QuickStartPage.java
Modified: incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadApplication.java?view=diff&rev=513158&r1=513157&r2=513158
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadApplication.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadApplication.java Wed Feb 28 22:12:09 2007
@@ -67,6 +67,10 @@
uploadFolder = new Folder(System.getProperty("java.io.tmpdir"), "wicket-uploads");
// Ensure folder exists
uploadFolder.mkdirs();
+
+ mountBookmarkablePage("/multi", MultiUploadPage.class);
+ mountBookmarkablePage("/single", UploadPage.class);
+
}
/**
Modified: incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadPage.properties
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadPage.properties?view=diff&rev=513158&r1=513157&r2=513158
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadPage.properties (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/java/wicket/examples/upload/UploadPage.properties Wed Feb 28 22:12:09 2007
@@ -1,3 +1,2 @@
-
simpleUpload.uploadTooLarge = File must be less than ${maxSize}.
simpleUpload.uploadFailed = File failed to upload: ${exception.localizedMessage}
Modified: incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/webapp/index.html?view=diff&rev=513158&r1=513157&r2=513158
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/webapp/index.html (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-examples/src/main/webapp/index.html Wed Feb 28 22:12:09 2007
@@ -33,7 +33,8 @@
<tr><td align="right"><a href="repeater">repeaters</a></td><td> - DataView, DataTable, GridView component examples</td></tr>
<tr><td align="right"><a href="signin">signin</a></td><td> - A simple sign-in page</td></tr>
<tr><td align="right"><a href="signin2">signin2</a></td><td> - An advanced sign-in page (using cookies)</td></tr>
- <tr><td align="right"><a href="upload">upload</a></td><td> - Upload files</td></tr>
+ <tr><td align="right"><a href="upload/single">upload</a></td><td> - Single file upload</td></tr>
+ <tr><td align="right"><a href="upload/multi">upload</a></td><td> - Multiple file upload</td></tr>
<tr><td align="right"><a href="template">template</a></td><td> - Templating example</td></tr>
<tr><td align="right"><a href="hellobrowser">hellobrowser</a></td><td> - Browser snooper</td></tr>
<tr><td align="right"><a href="ajax">ajax</a></td><td> - Ajax examples using wicket's builtin ajax</td></tr>
Modified: incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.html?view=diff&rev=513158&r1=513157&r2=513158
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.html (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.html Wed Feb 28 22:12:09 2007
@@ -5,6 +5,7 @@
<body>
<h1>QuickStart</h1>
<p>This is your first Wicket application.</p>
+ <form wicket:id="form"><div wicket:id="uploads"></div><input type="submit"/></form>
</body>
</html>
Modified: incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.java?view=diff&rev=513158&r1=513157&r2=513158
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/Index.java Wed Feb 28 22:12:09 2007
@@ -16,16 +16,38 @@
*/
package wicket.quickstart;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
import wicket.PageParameters;
+import wicket.extensions.markup.html.form.MultiFileUpload;
+import wicket.markup.html.form.Form;
+import wicket.markup.html.form.upload.FileUpload;
+import wicket.model.CompoundPropertyModel;
/**
* Basic bookmarkable index page.
*
- * NOTE: You can get session properties from QuickStartSession via getQuickStartSession()
+ * NOTE: You can get session properties from QuickStartSession via
+ * getQuickStartSession()
*/
-public class Index extends QuickStartPage
+public class Index extends QuickStartPage
{
- // TODO Add any page properties or variables here
+ Collection uploads = new ArrayList();
+
+
+ public Collection getUploads()
+ {
+ return uploads;
+ }
+
+
+ public void setUploads(Collection uploads)
+ {
+ this.uploads = uploads;
+ }
+
/**
* Constructor that is invoked when page is invoked without a session.
@@ -33,8 +55,25 @@
* @param parameters
* Page parameters
*/
- public Index(final PageParameters parameters)
- {
- // TODO Add your page's components here
+ public Index(final PageParameters parameters)
+ {
+ Form form = new Form("form", new CompoundPropertyModel(this))
+ {
+ protected void onSubmit()
+ {
+ System.out.println("UPLOADED: " + uploads.size() + " FILES");
+ Iterator it = uploads.iterator();
+ while (it.hasNext())
+ {
+ FileUpload upload = (FileUpload)it.next();
+ System.out.println("UPLOAD: " + upload.getClientFileName() + " SIZE: "
+ + upload.getSize());
+ }
+
+ }
+ };
+ add(form);
+
+ form.add(new MultiFileUpload("uploads", 2));
}
}
Modified: incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/QuickStartPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/QuickStartPage.java?view=diff&rev=513158&r1=513157&r2=513158
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/QuickStartPage.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-quickstart/src/main/java/wicket/quickstart/QuickStartPage.java Wed Feb 28 22:12:09 2007
@@ -25,6 +25,7 @@
*/
public abstract class QuickStartPage extends WebPage
{
+
/**
* Get downcast session object for easy access by subclasses
*