You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jb...@apache.org on 2007/03/12 23:02:17 UTC
svn commit: r517420 - in /incubator/wicket/branches/wicket-1.x:
jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/
jdk-1.4/wicket-examples/src/test/java/wicket/examples/
jdk-1.4/wicket/src/main/java/wicket/ jdk-1.4/wicket/src/main/java/wicke...
Author: jbq
Date: Mon Mar 12 15:02:15 2007
New Revision: 517420
URL: http://svn.apache.org/viewvc?view=rev&rev=517420
Log:
Line endings cleanup. Some people still have bad SVN client configuration.
Modified:
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.html (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.java (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/test/java/wicket/examples/JettyTestCaseDecorator.java (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/IClusterable.java (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.html (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.java (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.js (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/protocol/http/MemorySessionStore.java (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/value/CopyOnWriteValueMap.java (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/value/IValueMap.java (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/BlockedResourceLinkPage.html (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/MockResourceLinkPage.html (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/MockResourceLinkPage.java (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/test.html (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/LICENSE.txt (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/NOTICE.txt (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/pom.xml (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java (props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/ObjectSizeOfAgent.java (contents, props changed)
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/test/wicket/util/license/ApacheLicenceHeaderTest.java (props changed)
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.html?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.html (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.html Mon Mar 12 15:02:15 2007
@@ -1,48 +1,48 @@
-<html xmlns:wicket="http://wicket.sourceforge.net/">
-<head>
- <title>Wicket Examples - upload</title>
- <link rel="stylesheet" type="text/css" href="style.css"/>
- <style>
- legend { border: 1px solid #e9601a; background-color: #bbb; color: #fff; padding: 4px;}
- fieldset { border: 1px solid #e9601a; padding: 10px; margin-top: 10px;}
- .mfuex { padding:5px;margin:5px;background:#eee; }
- .mfuex .wicket-mfu-container { padding: 5px; margin-top: 3px; background-color: white; border:1px solid black; font-size: xx-small; }
- .mfuex .wicket-mfu-caption { font-weight: bold; }
- .mfuex .wicket-mfu-container input { margin-left: 5px; font-size: xx-small; }
- </style>
-</head>
-<body>
- <span wicket:id="mainNavigation"/>
-
- The multi upload field is based on javascript found <a target="_blank" href="http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/">here</a>.<br/>
-
- <form wicket:id="simpleUpload">
- <fieldset>
- <legend>Upload form</legend>
- <p>
- <div wicket:id="fileInput" class="mfuex"/>
- </p>
- <input type="submit" value="Upload!"/>
- </fieldset>
- </form>
-
-
- <div>
- <span wicket:id="uploadFeedback"/>
- </div>
-
- <div>
- <h4>Current files in <span wicket:id="dir">(dir)</span>:</h4>
- <table>
- <tr wicket:id="fileList">
- <td width="200"><span wicket:id="file">(file)</span></td>
- <td><a href="#" wicket:id="delete"><img src="delete.gif" border="0"/></a></td>
- </tr>
- </table>
- </div>
-
-
-
-
-</body>
-</html>
+<html xmlns:wicket="http://wicket.sourceforge.net/">
+<head>
+ <title>Wicket Examples - upload</title>
+ <link rel="stylesheet" type="text/css" href="style.css"/>
+ <style>
+ legend { border: 1px solid #e9601a; background-color: #bbb; color: #fff; padding: 4px;}
+ fieldset { border: 1px solid #e9601a; padding: 10px; margin-top: 10px;}
+ .mfuex { padding:5px;margin:5px;background:#eee; }
+ .mfuex .wicket-mfu-container { padding: 5px; margin-top: 3px; background-color: white; border:1px solid black; font-size: xx-small; }
+ .mfuex .wicket-mfu-caption { font-weight: bold; }
+ .mfuex .wicket-mfu-container input { margin-left: 5px; font-size: xx-small; }
+ </style>
+</head>
+<body>
+ <span wicket:id="mainNavigation"/>
+
+ The multi upload field is based on javascript found <a target="_blank" href="http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/">here</a>.<br/>
+
+ <form wicket:id="simpleUpload">
+ <fieldset>
+ <legend>Upload form</legend>
+ <p>
+ <div wicket:id="fileInput" class="mfuex"/>
+ </p>
+ <input type="submit" value="Upload!"/>
+ </fieldset>
+ </form>
+
+
+ <div>
+ <span wicket:id="uploadFeedback"/>
+ </div>
+
+ <div>
+ <h4>Current files in <span wicket:id="dir">(dir)</span>:</h4>
+ <table>
+ <tr wicket:id="fileList">
+ <td width="200"><span wicket:id="file">(file)</span></td>
+ <td><a href="#" wicket:id="delete"><img src="delete.gif" border="0"/></a></td>
+ </tr>
+ </table>
+ </div>
+
+
+
+
+</body>
+</html>
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.java?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.java Mon Mar 12 15:02:15 2007
@@ -14,203 +14,203 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package wicket.examples.upload;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import wicket.Application;
-import wicket.PageParameters;
-import wicket.examples.WicketExamplePage;
-import wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
-import wicket.markup.html.basic.Label;
-import wicket.markup.html.form.Form;
-import wicket.markup.html.form.upload.FileUpload;
-import wicket.markup.html.form.upload.FileUploadField;
-import wicket.markup.html.form.upload.MultiFileUploadField;
-import wicket.markup.html.link.Link;
-import wicket.markup.html.list.ListItem;
-import wicket.markup.html.list.ListView;
-import wicket.markup.html.panel.FeedbackPanel;
-import wicket.model.IModel;
-import wicket.model.LoadableDetachableModel;
-import wicket.model.PropertyModel;
-import wicket.util.file.Files;
-import wicket.util.file.Folder;
-import wicket.util.lang.Bytes;
-
-/**
- * Upload example.
- *
- * @author Eelco Hillenius
- */
-public class MultiUploadPage extends WicketExamplePage
-{
- /**
- * List view for files in upload folder.
- */
- private class FileListView extends ListView
- {
- /**
- * Construct.
- *
- * @param name
- * Component name
- * @param files
- * The file list model
- */
- public FileListView(String name, final IModel files)
- {
- super(name, files);
- }
-
- /**
- * @see ListView#populateItem(ListItem)
- */
- protected void populateItem(ListItem listItem)
- {
- final File file = (File)listItem.getModelObject();
- listItem.add(new Label("file", file.getName()));
- listItem.add(new Link("delete")
- {
- public void onClick()
- {
- Files.remove(file);
- MultiUploadPage.this.info("Deleted " + file);
- }
- });
- }
- }
-
- /**
- * Form for uploads.
- */
- private class FileUploadForm extends Form
- {
- // collection that will hold uploaded FileUpload objects
- private final Collection uploads = new ArrayList();
-
- public Collection getUploads()
- {
- return uploads;
- }
-
- /**
- * Construct.
- *
- * @param name
- * Component name
- */
- public FileUploadForm(String name)
- {
- super(name);
-
- // set this form to multipart mode (allways needed for uploads!)
- setMultiPart(true);
-
- // Add one multi-file upload field
- add(new MultiFileUploadField("fileInput", new PropertyModel(this, "uploads"), 5));
-
- // Set maximum size to 100K for demo purposes
- setMaxSize(Bytes.kilobytes(100));
- }
-
- /**
- * @see wicket.markup.html.form.Form#onSubmit()
- */
- protected void onSubmit()
- {
- Iterator it = uploads.iterator();
- while (it.hasNext())
- {
- final FileUpload upload = (FileUpload)it.next();
- // Create a new file
- File newFile = new File(getUploadFolder(), upload.getClientFileName());
-
- // Check new file, delete if it allready existed
- checkFileExists(newFile);
- try
- {
- // Save to new file
- newFile.createNewFile();
- upload.writeTo(newFile);
-
- MultiUploadPage.this.info("saved file: " + upload.getClientFileName());
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Unable to write file");
- }
- }
- }
- }
-
- /** Log. */
- private static final Log log = LogFactory.getLog(MultiUploadPage.class);
-
- /** Reference to listview for easy access. */
- private FileListView fileListView;
-
- /**
- * Constructor.
- *
- * @param parameters
- * Page parameters
- */
- public MultiUploadPage(final PageParameters parameters)
- {
- Folder uploadFolder = getUploadFolder();
-
- // Create feedback panels
- final FeedbackPanel uploadFeedback = new FeedbackPanel("uploadFeedback");
-
- // Add uploadFeedback to the page itself
- add(uploadFeedback);
-
- // Add simple upload form, which is hooked up to its feedback panel by
- // virtue of that panel being nested in the form.
- final FileUploadForm simpleUploadForm = new FileUploadForm("simpleUpload");
- add(simpleUploadForm);
-
- // Add folder view
- add(new Label("dir", uploadFolder.getAbsolutePath()));
- fileListView = new FileListView("fileList", new LoadableDetachableModel()
- {
- protected Object load()
- {
- return Arrays.asList(getUploadFolder().listFiles());
- }
- });
- add(fileListView);
-
- }
-
- /**
- * Check whether the file allready exists, and if so, try to delete it.
- *
- * @param newFile
- * the file to check
- */
- private void checkFileExists(File newFile)
- {
- if (newFile.exists())
- {
- // Try to delete the file
- if (!Files.remove(newFile))
- {
- throw new IllegalStateException("Unable to overwrite " + newFile.getAbsolutePath());
- }
- }
- }
-
- private Folder getUploadFolder()
- {
- return ((UploadApplication)Application.get()).getUploadFolder();
- }
-}
\ No newline at end of file
+package wicket.examples.upload;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import wicket.Application;
+import wicket.PageParameters;
+import wicket.examples.WicketExamplePage;
+import wicket.extensions.ajax.markup.html.form.upload.UploadProgressBar;
+import wicket.markup.html.basic.Label;
+import wicket.markup.html.form.Form;
+import wicket.markup.html.form.upload.FileUpload;
+import wicket.markup.html.form.upload.FileUploadField;
+import wicket.markup.html.form.upload.MultiFileUploadField;
+import wicket.markup.html.link.Link;
+import wicket.markup.html.list.ListItem;
+import wicket.markup.html.list.ListView;
+import wicket.markup.html.panel.FeedbackPanel;
+import wicket.model.IModel;
+import wicket.model.LoadableDetachableModel;
+import wicket.model.PropertyModel;
+import wicket.util.file.Files;
+import wicket.util.file.Folder;
+import wicket.util.lang.Bytes;
+
+/**
+ * Upload example.
+ *
+ * @author Eelco Hillenius
+ */
+public class MultiUploadPage extends WicketExamplePage
+{
+ /**
+ * List view for files in upload folder.
+ */
+ private class FileListView extends ListView
+ {
+ /**
+ * Construct.
+ *
+ * @param name
+ * Component name
+ * @param files
+ * The file list model
+ */
+ public FileListView(String name, final IModel files)
+ {
+ super(name, files);
+ }
+
+ /**
+ * @see ListView#populateItem(ListItem)
+ */
+ protected void populateItem(ListItem listItem)
+ {
+ final File file = (File)listItem.getModelObject();
+ listItem.add(new Label("file", file.getName()));
+ listItem.add(new Link("delete")
+ {
+ public void onClick()
+ {
+ Files.remove(file);
+ MultiUploadPage.this.info("Deleted " + file);
+ }
+ });
+ }
+ }
+
+ /**
+ * Form for uploads.
+ */
+ private class FileUploadForm extends Form
+ {
+ // collection that will hold uploaded FileUpload objects
+ private final Collection uploads = new ArrayList();
+
+ public Collection getUploads()
+ {
+ return uploads;
+ }
+
+ /**
+ * Construct.
+ *
+ * @param name
+ * Component name
+ */
+ public FileUploadForm(String name)
+ {
+ super(name);
+
+ // set this form to multipart mode (allways needed for uploads!)
+ setMultiPart(true);
+
+ // Add one multi-file upload field
+ add(new MultiFileUploadField("fileInput", new PropertyModel(this, "uploads"), 5));
+
+ // Set maximum size to 100K for demo purposes
+ setMaxSize(Bytes.kilobytes(100));
+ }
+
+ /**
+ * @see wicket.markup.html.form.Form#onSubmit()
+ */
+ protected void onSubmit()
+ {
+ Iterator it = uploads.iterator();
+ while (it.hasNext())
+ {
+ final FileUpload upload = (FileUpload)it.next();
+ // Create a new file
+ File newFile = new File(getUploadFolder(), upload.getClientFileName());
+
+ // Check new file, delete if it allready existed
+ checkFileExists(newFile);
+ try
+ {
+ // Save to new file
+ newFile.createNewFile();
+ upload.writeTo(newFile);
+
+ MultiUploadPage.this.info("saved file: " + upload.getClientFileName());
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Unable to write file");
+ }
+ }
+ }
+ }
+
+ /** Log. */
+ private static final Log log = LogFactory.getLog(MultiUploadPage.class);
+
+ /** Reference to listview for easy access. */
+ private FileListView fileListView;
+
+ /**
+ * Constructor.
+ *
+ * @param parameters
+ * Page parameters
+ */
+ public MultiUploadPage(final PageParameters parameters)
+ {
+ Folder uploadFolder = getUploadFolder();
+
+ // Create feedback panels
+ final FeedbackPanel uploadFeedback = new FeedbackPanel("uploadFeedback");
+
+ // Add uploadFeedback to the page itself
+ add(uploadFeedback);
+
+ // Add simple upload form, which is hooked up to its feedback panel by
+ // virtue of that panel being nested in the form.
+ final FileUploadForm simpleUploadForm = new FileUploadForm("simpleUpload");
+ add(simpleUploadForm);
+
+ // Add folder view
+ add(new Label("dir", uploadFolder.getAbsolutePath()));
+ fileListView = new FileListView("fileList", new LoadableDetachableModel()
+ {
+ protected Object load()
+ {
+ return Arrays.asList(getUploadFolder().listFiles());
+ }
+ });
+ add(fileListView);
+
+ }
+
+ /**
+ * Check whether the file allready exists, and if so, try to delete it.
+ *
+ * @param newFile
+ * the file to check
+ */
+ private void checkFileExists(File newFile)
+ {
+ if (newFile.exists())
+ {
+ // Try to delete the file
+ if (!Files.remove(newFile))
+ {
+ throw new IllegalStateException("Unable to overwrite " + newFile.getAbsolutePath());
+ }
+ }
+ }
+
+ private Folder getUploadFolder()
+ {
+ return ((UploadApplication)Application.get()).getUploadFolder();
+ }
+}
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/main/java/wicket/examples/upload/MultiUploadPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/test/java/wicket/examples/JettyTestCaseDecorator.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/test/java/wicket/examples/JettyTestCaseDecorator.java?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/test/java/wicket/examples/JettyTestCaseDecorator.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/test/java/wicket/examples/JettyTestCaseDecorator.java Mon Mar 12 15:02:15 2007
@@ -1,77 +1,77 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package wicket.examples;
-
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.webapp.WebAppContext;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
-/**
- * Test decorator that starts a jetty instance
- *
- * @author ivaynberg
- *
- */
-public class JettyTestCaseDecorator extends TestSetup
-{
-
- private Server server;
-
- /**
- * @param test
- */
- public JettyTestCaseDecorator(Test test)
- {
- super(test);
- }
-
- protected void setUp() throws Exception
- {
- server = new Server();
- SelectChannelConnector connector = new SelectChannelConnector();
- connector.setPort(8098);
- server.setConnectors(new Connector[] { connector });
-
- WebAppContext web = new WebAppContext();
- web.setContextPath("/wicket-examples");
-
- String basedir = System.getProperty("basedir");
- String path = "";
- if (basedir != null)
- path = basedir + "/";
- path += "src/main/webapp";
-
- web.setWar(path);
- server.addHandler(web);
-
- server.start();
-
- super.setUp();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- server.stop();
- server.join();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.examples;
+
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+/**
+ * Test decorator that starts a jetty instance
+ *
+ * @author ivaynberg
+ *
+ */
+public class JettyTestCaseDecorator extends TestSetup
+{
+
+ private Server server;
+
+ /**
+ * @param test
+ */
+ public JettyTestCaseDecorator(Test test)
+ {
+ super(test);
+ }
+
+ protected void setUp() throws Exception
+ {
+ server = new Server();
+ SelectChannelConnector connector = new SelectChannelConnector();
+ connector.setPort(8098);
+ server.setConnectors(new Connector[] { connector });
+
+ WebAppContext web = new WebAppContext();
+ web.setContextPath("/wicket-examples");
+
+ String basedir = System.getProperty("basedir");
+ String path = "";
+ if (basedir != null)
+ path = basedir + "/";
+ path += "src/main/webapp";
+
+ web.setWar(path);
+ server.addHandler(web);
+
+ server.start();
+
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ server.stop();
+ server.join();
+ }
+
+}
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket-examples/src/test/java/wicket/examples/JettyTestCaseDecorator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/IClusterable.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.html?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.html (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.html Mon Mar 12 15:02:15 2007
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<wicket:panel>
-<input wicket:id="upload" type="file" class="wicket-mfu-field"/>
-<div wicket:id="container" class="wicket-mfu-container">
-<div wicket:id="caption" class="wicket-mfu-caption"></div>
-</div>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<wicket:panel>
+<input wicket:id="upload" type="file" class="wicket-mfu-field"/>
+<div wicket:id="container" class="wicket-mfu-container">
+<div wicket:id="caption" class="wicket-mfu-caption"></div>
+</div>
</wicket:panel>
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.java?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.java Mon Mar 12 15:02:15 2007
@@ -1,390 +1,390 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package wicket.markup.html.form.upload;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import wicket.Component;
-import wicket.Request;
-import wicket.ResourceReference;
-import wicket.markup.ComponentTag;
-import wicket.markup.html.IHeaderContributor;
-import wicket.markup.html.IHeaderResponse;
-import wicket.markup.html.WebComponent;
-import wicket.markup.html.WebMarkupContainer;
-import wicket.markup.html.basic.Label;
-import wicket.markup.html.form.Form;
-import wicket.markup.html.form.FormComponentPanel;
-import wicket.markup.html.form.upload.FileUpload;
-import wicket.markup.html.resources.JavascriptResourceReference;
-import wicket.model.AbstractReadOnlyModel;
-import wicket.model.IModel;
-import wicket.model.Model;
-import wicket.protocol.http.IMultipartWebRequest;
-import wicket.util.convert.ConversionException;
-import wicket.util.string.Strings;
-import wicket.util.upload.FileItem;
-
-/**
- * Form component that allows the user to select multiple files to upload via a
- * single <input type="file"/> field.
- *
- * Notice that this component clears its model at the end of the request, so the
- * uploaded files MUST be processed within the request they were uploaded.
- *
- * Uses javascript implementation from
- * http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/
- *
- * For customizing caption text see {@link #RESOURCE_LIMITED} and
- * {@link #RESOURCE_UNLIMITED}
- *
- * For an example of styling using CSS see the upload example in wicket-examples
- *
- * @author Igor Vaynberg (ivaynberg)
- */
-public class MultiFileUploadField extends FormComponentPanel implements IHeaderContributor
-{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Represents an unlimited max count of uploads
- */
- public static final int UNLIMITED = 1;
-
- /**
- * Resource key used to retrieve caption message for when a limit on the
- * number of uploads is specfied. The limit is represented via ${max}
- * variable.
- *
- * Example: wicket.mfu.caption.limited=Files (maximum ${max}):
- */
- public static final String RESOURCE_LIMITED = "wicket.mfu.caption.limited";
-
- /**
- * Resource key used to retrieve caption message for when no limit on the
- * number of uploads is specfied.
- *
- * Example: wicket.mfu.caption.unlimited=Files:
- */
- public static final String RESOURCE_UNLIMITED = "wicket.mfu.caption.unlimited";
-
-
- private static final String NAME_ATTR = "name";
-
- private static final String MAGIC_SEPARATOR = "_mf_";
-
-
- private static final ResourceReference JS = new JavascriptResourceReference(
- MultiFileUploadField.class, "MultiFileUploadField.js");
-
-
- private final WebComponent upload;
- private final WebMarkupContainer container;
-
- private final int max;
-
- private transient String[] inputArrayCache = null;
-
- /**
- * Constructor
- *
- * @param id
- * @param model
- */
- public MultiFileUploadField(String id)
- {
- this(id, null, -1);
- }
-
- /**
- * Constructor
- *
- * @param id
- * @param model
- * @param max
- * max number of files a user can upload
- */
- public MultiFileUploadField(String id, int max)
- {
- this(id, null, max);
- }
-
- /**
- * Constructor
- *
- * @param id
- * @param model
- */
- public MultiFileUploadField(String id, IModel model)
- {
- this(id, model, UNLIMITED);
- }
-
- /**
- * Constructor
- *
- * @param id
- * @param model
- * @param max
- * max number of files a user can upload
- *
- */
- public MultiFileUploadField(String id, IModel model, int max)
- {
- super(id, model);
-
- this.max = max;
-
- upload = new WebComponent("upload");
- upload.setOutputMarkupId(true);
- add(upload);
-
- container = new WebMarkupContainer("container");
- container.setOutputMarkupId(true);
- add(container);
-
- container.add(new Label("caption", new CaptionModel()));
- }
-
- /**
- * @see wicket.markup.html.form.FormComponentPanel#onComponentTag(wicket.markup.ComponentTag)
- */
- protected void onComponentTag(ComponentTag tag)
- {
- super.onComponentTag(tag);
- // remove the name attribute added by the FormComponent
- if (tag.getAttributes().containsKey(NAME_ATTR))
- {
- tag.getAttributes().remove(NAME_ATTR);
- }
- }
-
- /**
- * @see wicket.Component#internalOnAttach()
- */
- protected void internalOnAttach()
- {
- super.internalOnAttach();
-
- // auto toggle form's multipart property
- Form form = (Form)findParent(Form.class);
- if (form == null)
- {
- // woops
- throw new IllegalStateException("Component " + getClass().getName() + " must have a "
- + Form.class.getName() + " component above in the hierarchy");
- }
- form.setMultiPart(true);
- }
-
-
- /**
- * @see wicket.markup.html.IHeaderContributor#renderHead(wicket.markup.html.IHeaderResponse)
- */
- public void renderHead(IHeaderResponse response)
- {
- // initialize the javascript library
- response.renderJavascriptReference(JS);
- response.renderOnDomReadyJavascript("new MultiSelector('" + getInputName()
- + "', document.getElementById('" + container.getMarkupId() + "'), " + max
- + ").addElement(document.getElementById('" + upload.getMarkupId() + "'));");
- }
-
- /**
- * @see wicket.markup.html.form.FormComponent#getInputAsArray()
- */
- public String[] getInputAsArray()
- {
- // fake the input array as if it contained an array of all uploaded file
- // names
-
- if (inputArrayCache == null)
- {
- // this array will aggregate all input names
- ArrayList names = null;
-
- final Request request = getRequest();
- if (request instanceof IMultipartWebRequest)
- {
- // retrieve the filename->FileItem map from request
- final Map itemNameToItem = ((IMultipartWebRequest)request).getFiles();
- Iterator it = itemNameToItem.entrySet().iterator();
- while (it.hasNext())
- {
- // iterate over the map and build the list of filenames
-
- final Entry entry = (Entry)it.next();
- final String name = (String)entry.getKey();
- final FileItem item = (FileItem)entry.getValue();
-
- if (!Strings.isEmpty(name) && name.startsWith(getInputName() + MAGIC_SEPARATOR)
- && !Strings.isEmpty(item.getName()))
- {
-
- // make sure the fileitem belongs to this component and
- // is not empty
-
- names = (names != null) ? names : new ArrayList();
- names.add(name);
- }
- }
- }
-
- if (names != null)
- {
- inputArrayCache = (String[])names.toArray(new String[names.size()]);
- }
- }
- return inputArrayCache;
-
- }
-
- /**
- * @see wicket.markup.html.form.FormComponent#convertValue(java.lang.String[])
- */
- protected Object convertValue(String[] value) throws ConversionException
- {
- // convert the array of filenames into a collection of FileItems
-
- Collection uploads = null;
-
- final String[] filenames = getInputAsArray();
-
- if (filenames != null)
- {
- final IMultipartWebRequest request = (IMultipartWebRequest)getRequest();
-
- uploads = new ArrayList(filenames.length);
-
- for (int i = 0; i < filenames.length; i++)
- {
- uploads.add(new FileUpload(request.getFile(filenames[i])));
- }
- }
-
- return uploads;
-
- }
-
- /**
- * @see wicket.markup.html.form.FormComponent#updateModel()
- */
- public void updateModel()
- {
- final Object object = getModelObject();
-
- // figure out if there is an existing model object collection for us to
- // reuse
- if (object == null)
- {
- // no existing collection, push the one we created
- setModelObject(getConvertedInput());
- }
- else
- {
- if (!(object instanceof Collection))
- {
- // fail early if there is something interesting in the model
- throw new IllegalStateException("Model object of " + getClass().getName()
- + " component must be of type `" + Collection.class.getName() + "<"
- + FileUpload.class.getName() + ">` but is of type `"
- + object.getClass().getName() + "`");
- }
- else
- {
- // refresh the existing collection
- Collection collection = (Collection)object;
- collection.clear();
- if (getConvertedInput() != null)
- {
- collection.addAll((Collection)getConvertedInput());
- }
-
- // push the collection in case the model is listening to
- // setobject calls
- setModelObject(collection);
- }
- }
- }
-
- /**
- * @see wicket.Component#internalOnDetach()
- */
- protected void internalOnDetach()
- {
- // cleanup any opened filestreams
- Collection uploads = (Collection)getConvertedInput();
- if (uploads != null)
- {
- Iterator it = uploads.iterator();
- while (it.hasNext())
- {
- final FileUpload upload = (FileUpload)it.next();
- upload.closeStreams();
- }
- }
-
- // cleanup any caches
- inputArrayCache = null;
-
- // clean up the model because we dont want FileUpload objects in session
- Object modelObject = getModelObject();
- if (modelObject != null && (modelObject instanceof Collection))
- {
- ((Collection)modelObject).clear();
- }
-
- super.internalOnDetach();
- }
-
- /**
- * Model that will construct the caption string
- *
- * @author ivaynberg
- */
- private class CaptionModel extends AbstractReadOnlyModel
- {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * @see wicket.model.AbstractReadOnlyModel#getObject(wicket.Component)
- */
- public Object getObject(Component component)
- {
- if (max == UNLIMITED)
- {
- return getString(RESOURCE_UNLIMITED);
- }
- else
- {
- return getString(RESOURCE_LIMITED, Model.valueOf(Collections.singletonMap("max",
- new Integer(max))));
- }
- }
-
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.markup.html.form.upload;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import wicket.Component;
+import wicket.Request;
+import wicket.ResourceReference;
+import wicket.markup.ComponentTag;
+import wicket.markup.html.IHeaderContributor;
+import wicket.markup.html.IHeaderResponse;
+import wicket.markup.html.WebComponent;
+import wicket.markup.html.WebMarkupContainer;
+import wicket.markup.html.basic.Label;
+import wicket.markup.html.form.Form;
+import wicket.markup.html.form.FormComponentPanel;
+import wicket.markup.html.form.upload.FileUpload;
+import wicket.markup.html.resources.JavascriptResourceReference;
+import wicket.model.AbstractReadOnlyModel;
+import wicket.model.IModel;
+import wicket.model.Model;
+import wicket.protocol.http.IMultipartWebRequest;
+import wicket.util.convert.ConversionException;
+import wicket.util.string.Strings;
+import wicket.util.upload.FileItem;
+
+/**
+ * Form component that allows the user to select multiple files to upload via a
+ * single <input type="file"/> field.
+ *
+ * Notice that this component clears its model at the end of the request, so the
+ * uploaded files MUST be processed within the request they were uploaded.
+ *
+ * Uses javascript implementation from
+ * http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/
+ *
+ * For customizing caption text see {@link #RESOURCE_LIMITED} and
+ * {@link #RESOURCE_UNLIMITED}
+ *
+ * For an example of styling using CSS see the upload example in wicket-examples
+ *
+ * @author Igor Vaynberg (ivaynberg)
+ */
+public class MultiFileUploadField extends FormComponentPanel implements IHeaderContributor
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Represents an unlimited max count of uploads
+ */
+ public static final int UNLIMITED = 1;
+
+ /**
+ * Resource key used to retrieve caption message for when a limit on the
+ * number of uploads is specfied. The limit is represented via ${max}
+ * variable.
+ *
+ * Example: wicket.mfu.caption.limited=Files (maximum ${max}):
+ */
+ public static final String RESOURCE_LIMITED = "wicket.mfu.caption.limited";
+
+ /**
+ * Resource key used to retrieve caption message for when no limit on the
+ * number of uploads is specfied.
+ *
+ * Example: wicket.mfu.caption.unlimited=Files:
+ */
+ public static final String RESOURCE_UNLIMITED = "wicket.mfu.caption.unlimited";
+
+
+ private static final String NAME_ATTR = "name";
+
+ private static final String MAGIC_SEPARATOR = "_mf_";
+
+
+ private static final ResourceReference JS = new JavascriptResourceReference(
+ MultiFileUploadField.class, "MultiFileUploadField.js");
+
+
+ private final WebComponent upload;
+ private final WebMarkupContainer container;
+
+ private final int max;
+
+ private transient String[] inputArrayCache = null;
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * @param model
+ */
+ public MultiFileUploadField(String id)
+ {
+ this(id, null, -1);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * @param model
+ * @param max
+ * max number of files a user can upload
+ */
+ public MultiFileUploadField(String id, int max)
+ {
+ this(id, null, max);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * @param model
+ */
+ public MultiFileUploadField(String id, IModel model)
+ {
+ this(id, model, UNLIMITED);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id
+ * @param model
+ * @param max
+ * max number of files a user can upload
+ *
+ */
+ public MultiFileUploadField(String id, IModel model, int max)
+ {
+ super(id, model);
+
+ this.max = max;
+
+ upload = new WebComponent("upload");
+ upload.setOutputMarkupId(true);
+ add(upload);
+
+ container = new WebMarkupContainer("container");
+ container.setOutputMarkupId(true);
+ add(container);
+
+ container.add(new Label("caption", new CaptionModel()));
+ }
+
+ /**
+ * @see wicket.markup.html.form.FormComponentPanel#onComponentTag(wicket.markup.ComponentTag)
+ */
+ protected void onComponentTag(ComponentTag tag)
+ {
+ super.onComponentTag(tag);
+ // remove the name attribute added by the FormComponent
+ if (tag.getAttributes().containsKey(NAME_ATTR))
+ {
+ tag.getAttributes().remove(NAME_ATTR);
+ }
+ }
+
+ /**
+ * @see wicket.Component#internalOnAttach()
+ */
+ protected void internalOnAttach()
+ {
+ super.internalOnAttach();
+
+ // auto toggle form's multipart property
+ Form form = (Form)findParent(Form.class);
+ if (form == null)
+ {
+ // woops
+ throw new IllegalStateException("Component " + getClass().getName() + " must have a "
+ + Form.class.getName() + " component above in the hierarchy");
+ }
+ form.setMultiPart(true);
+ }
+
+
+ /**
+ * @see wicket.markup.html.IHeaderContributor#renderHead(wicket.markup.html.IHeaderResponse)
+ */
+ public void renderHead(IHeaderResponse response)
+ {
+ // initialize the javascript library
+ response.renderJavascriptReference(JS);
+ response.renderOnDomReadyJavascript("new MultiSelector('" + getInputName()
+ + "', document.getElementById('" + container.getMarkupId() + "'), " + max
+ + ").addElement(document.getElementById('" + upload.getMarkupId() + "'));");
+ }
+
+ /**
+ * @see wicket.markup.html.form.FormComponent#getInputAsArray()
+ */
+ public String[] getInputAsArray()
+ {
+ // fake the input array as if it contained an array of all uploaded file
+ // names
+
+ if (inputArrayCache == null)
+ {
+ // this array will aggregate all input names
+ ArrayList names = null;
+
+ final Request request = getRequest();
+ if (request instanceof IMultipartWebRequest)
+ {
+ // retrieve the filename->FileItem map from request
+ final Map itemNameToItem = ((IMultipartWebRequest)request).getFiles();
+ Iterator it = itemNameToItem.entrySet().iterator();
+ while (it.hasNext())
+ {
+ // iterate over the map and build the list of filenames
+
+ final Entry entry = (Entry)it.next();
+ final String name = (String)entry.getKey();
+ final FileItem item = (FileItem)entry.getValue();
+
+ if (!Strings.isEmpty(name) && name.startsWith(getInputName() + MAGIC_SEPARATOR)
+ && !Strings.isEmpty(item.getName()))
+ {
+
+ // make sure the fileitem belongs to this component and
+ // is not empty
+
+ names = (names != null) ? names : new ArrayList();
+ names.add(name);
+ }
+ }
+ }
+
+ if (names != null)
+ {
+ inputArrayCache = (String[])names.toArray(new String[names.size()]);
+ }
+ }
+ return inputArrayCache;
+
+ }
+
+ /**
+ * @see wicket.markup.html.form.FormComponent#convertValue(java.lang.String[])
+ */
+ protected Object convertValue(String[] value) throws ConversionException
+ {
+ // convert the array of filenames into a collection of FileItems
+
+ Collection uploads = null;
+
+ final String[] filenames = getInputAsArray();
+
+ if (filenames != null)
+ {
+ final IMultipartWebRequest request = (IMultipartWebRequest)getRequest();
+
+ uploads = new ArrayList(filenames.length);
+
+ for (int i = 0; i < filenames.length; i++)
+ {
+ uploads.add(new FileUpload(request.getFile(filenames[i])));
+ }
+ }
+
+ return uploads;
+
+ }
+
+ /**
+ * @see wicket.markup.html.form.FormComponent#updateModel()
+ */
+ public void updateModel()
+ {
+ final Object object = getModelObject();
+
+ // figure out if there is an existing model object collection for us to
+ // reuse
+ if (object == null)
+ {
+ // no existing collection, push the one we created
+ setModelObject(getConvertedInput());
+ }
+ else
+ {
+ if (!(object instanceof Collection))
+ {
+ // fail early if there is something interesting in the model
+ throw new IllegalStateException("Model object of " + getClass().getName()
+ + " component must be of type `" + Collection.class.getName() + "<"
+ + FileUpload.class.getName() + ">` but is of type `"
+ + object.getClass().getName() + "`");
+ }
+ else
+ {
+ // refresh the existing collection
+ Collection collection = (Collection)object;
+ collection.clear();
+ if (getConvertedInput() != null)
+ {
+ collection.addAll((Collection)getConvertedInput());
+ }
+
+ // push the collection in case the model is listening to
+ // setobject calls
+ setModelObject(collection);
+ }
+ }
+ }
+
+ /**
+ * @see wicket.Component#internalOnDetach()
+ */
+ protected void internalOnDetach()
+ {
+ // cleanup any opened filestreams
+ Collection uploads = (Collection)getConvertedInput();
+ if (uploads != null)
+ {
+ Iterator it = uploads.iterator();
+ while (it.hasNext())
+ {
+ final FileUpload upload = (FileUpload)it.next();
+ upload.closeStreams();
+ }
+ }
+
+ // cleanup any caches
+ inputArrayCache = null;
+
+ // clean up the model because we dont want FileUpload objects in session
+ Object modelObject = getModelObject();
+ if (modelObject != null && (modelObject instanceof Collection))
+ {
+ ((Collection)modelObject).clear();
+ }
+
+ super.internalOnDetach();
+ }
+
+ /**
+ * Model that will construct the caption string
+ *
+ * @author ivaynberg
+ */
+ private class CaptionModel extends AbstractReadOnlyModel
+ {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @see wicket.model.AbstractReadOnlyModel#getObject(wicket.Component)
+ */
+ public Object getObject(Component component)
+ {
+ if (max == UNLIMITED)
+ {
+ return getString(RESOURCE_UNLIMITED);
+ }
+ else
+ {
+ return getString(RESOURCE_LIMITED, Model.valueOf(Collections.singletonMap("max",
+ new Integer(max))));
+ }
+ }
+
+ }
+}
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/upload/MultiFileUploadField.js
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/protocol/http/MemorySessionStore.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/protocol/http/MemorySessionStore.java?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/protocol/http/MemorySessionStore.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/protocol/http/MemorySessionStore.java Mon Mar 12 15:02:15 2007
@@ -1,192 +1,192 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package wicket.protocol.http;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import wicket.AccessStackPageMap;
-import wicket.IPageMap;
-import wicket.Request;
-import wicket.Session;
-import wicket.session.ISessionStore;
-import wicket.util.concurrent.ConcurrentHashMap;
-
-/**
- * Session store that keeps attributes in memory instead of putting them in the
- * {@link HttpSession}. This should be a good match when you use <a
- * href="www.terracotta.org">Terracotta</a> to manage a cluster.
- *
- * @author eelcohillenius
- */
-public class MemorySessionStore extends AbstractHttpSessionStore
-{
- /** Log. */
- private static final Log log = LogFactory.getLog(MemorySessionStore.class);
-
- /**
- * Map of session ids to store objects.
- */
- private final Map sessionIdToStore = new ConcurrentHashMap();
-
- /**
- * Construct.
- */
- public MemorySessionStore()
- {
- }
-
- /**
- * @see wicket.session.ISessionStore#createPageMap(java.lang.String,
- * wicket.Session)
- */
- public IPageMap createPageMap(String name, Session session)
- {
- return new AccessStackPageMap(name, session);
- }
-
- /**
- * @see ISessionStore#getAttribute(Request, String)
- */
- public Object getAttribute(Request request, String name)
- {
- Map store = getStore(request);
- return store.get(name);
- }
-
- /**
- * @see ISessionStore#getAttributeNames(Request)
- */
- public List getAttributeNames(Request request)
- {
- Map store = getStore(request);
- return new ArrayList(store.keySet());
- }
-
- /**
- * @return The number of sessions.
- */
- public int getNumberOfSessions()
- {
- return sessionIdToStore.size();
- }
-
- /**
- * Gets the internal store (for integration purposes).
- *
- * @return The internal store
- */
- public Map getSessionIdToStore()
- {
- return sessionIdToStore;
- }
-
- /**
- * @see wicket.protocol.http.AbstractHttpSessionStore#lookup(wicket.Request)
- */
- public Session lookup(Request request)
- {
- Map store = getStoreUnsafe(request);
- if (store != null)
- {
- return (Session)store.get(Session.SESSION_ATTRIBUTE_NAME);
- }
- return null;
- }
-
- /**
- * @see ISessionStore#removeAttribute(Request, String)
- */
- public void removeAttribute(Request request, String name)
- {
- Map store = getStore(request);
- store.remove(name);
- }
-
- /**
- * @see ISessionStore#setAttribute(Request, String, Object)
- */
- public void setAttribute(Request request, String name, Object value)
- {
- Map store = getStore(request);
- store.put(name, (Serializable)value);
- }
-
- /**
- * Gets the store for the session of the provided request, returning null
- * and log a warning when the store was not found.
- *
- * @param request
- *
- * @return The store
- */
- private final Map getStore(Request request)
- {
- String sessionId = getSessionId(request, true);
- Map store = (Map)sessionIdToStore.get(sessionId);
- if (store == null)
- {
- log.warn("no store found for session with id " + sessionId + " (request=" + request
- + ")");
- // return a dummy
- return new HashMap();
- }
- return store;
- }
-
- /**
- * Gets the store for the session of the provided request, returning null
- * when the store was not found.
- *
- * @param request
- *
- * @return The store
- */
- private final Map getStoreUnsafe(Request request)
- {
- String sessionId = getSessionId(request, true);
- return (Map)sessionIdToStore.get(sessionId);
- }
-
- /**
- * @see AbstractHttpSessionStore#onBind(Request, Session)
- */
- protected void onBind(Request request, Session newSession)
- {
- String sessionId = getSessionId(request, true);
- sessionIdToStore.put(sessionId, new HashMap());
- log.info("new session " + sessionId + " bound to session store");
- }
-
- /**
- * @see AbstractHttpSessionStore#onUnbind(String)
- */
- protected void onUnbind(String sessionId)
- {
- Map store = (Map)sessionIdToStore.remove(sessionId);
- log.info("session " + sessionId + " unbound from session store; cleaning up "
- + store.size() + " entries");
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.protocol.http;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import wicket.AccessStackPageMap;
+import wicket.IPageMap;
+import wicket.Request;
+import wicket.Session;
+import wicket.session.ISessionStore;
+import wicket.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Session store that keeps attributes in memory instead of putting them in the
+ * {@link HttpSession}. This should be a good match when you use <a
+ * href="www.terracotta.org">Terracotta</a> to manage a cluster.
+ *
+ * @author eelcohillenius
+ */
+public class MemorySessionStore extends AbstractHttpSessionStore
+{
+ /** Log. */
+ private static final Log log = LogFactory.getLog(MemorySessionStore.class);
+
+ /**
+ * Map of session ids to store objects.
+ */
+ private final Map sessionIdToStore = new ConcurrentHashMap();
+
+ /**
+ * Construct.
+ */
+ public MemorySessionStore()
+ {
+ }
+
+ /**
+ * @see wicket.session.ISessionStore#createPageMap(java.lang.String,
+ * wicket.Session)
+ */
+ public IPageMap createPageMap(String name, Session session)
+ {
+ return new AccessStackPageMap(name, session);
+ }
+
+ /**
+ * @see ISessionStore#getAttribute(Request, String)
+ */
+ public Object getAttribute(Request request, String name)
+ {
+ Map store = getStore(request);
+ return store.get(name);
+ }
+
+ /**
+ * @see ISessionStore#getAttributeNames(Request)
+ */
+ public List getAttributeNames(Request request)
+ {
+ Map store = getStore(request);
+ return new ArrayList(store.keySet());
+ }
+
+ /**
+ * @return The number of sessions.
+ */
+ public int getNumberOfSessions()
+ {
+ return sessionIdToStore.size();
+ }
+
+ /**
+ * Gets the internal store (for integration purposes).
+ *
+ * @return The internal store
+ */
+ public Map getSessionIdToStore()
+ {
+ return sessionIdToStore;
+ }
+
+ /**
+ * @see wicket.protocol.http.AbstractHttpSessionStore#lookup(wicket.Request)
+ */
+ public Session lookup(Request request)
+ {
+ Map store = getStoreUnsafe(request);
+ if (store != null)
+ {
+ return (Session)store.get(Session.SESSION_ATTRIBUTE_NAME);
+ }
+ return null;
+ }
+
+ /**
+ * @see ISessionStore#removeAttribute(Request, String)
+ */
+ public void removeAttribute(Request request, String name)
+ {
+ Map store = getStore(request);
+ store.remove(name);
+ }
+
+ /**
+ * @see ISessionStore#setAttribute(Request, String, Object)
+ */
+ public void setAttribute(Request request, String name, Object value)
+ {
+ Map store = getStore(request);
+ store.put(name, (Serializable)value);
+ }
+
+ /**
+ * Gets the store for the session of the provided request, returning null
+ * and log a warning when the store was not found.
+ *
+ * @param request
+ *
+ * @return The store
+ */
+ private final Map getStore(Request request)
+ {
+ String sessionId = getSessionId(request, true);
+ Map store = (Map)sessionIdToStore.get(sessionId);
+ if (store == null)
+ {
+ log.warn("no store found for session with id " + sessionId + " (request=" + request
+ + ")");
+ // return a dummy
+ return new HashMap();
+ }
+ return store;
+ }
+
+ /**
+ * Gets the store for the session of the provided request, returning null
+ * when the store was not found.
+ *
+ * @param request
+ *
+ * @return The store
+ */
+ private final Map getStoreUnsafe(Request request)
+ {
+ String sessionId = getSessionId(request, true);
+ return (Map)sessionIdToStore.get(sessionId);
+ }
+
+ /**
+ * @see AbstractHttpSessionStore#onBind(Request, Session)
+ */
+ protected void onBind(Request request, Session newSession)
+ {
+ String sessionId = getSessionId(request, true);
+ sessionIdToStore.put(sessionId, new HashMap());
+ log.info("new session " + sessionId + " bound to session store");
+ }
+
+ /**
+ * @see AbstractHttpSessionStore#onUnbind(String)
+ */
+ protected void onUnbind(String sessionId)
+ {
+ Map store = (Map)sessionIdToStore.remove(sessionId);
+ log.info("session " + sessionId + " unbound from session store; cleaning up "
+ + store.size() + " entries");
+ }
}
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/protocol/http/MemorySessionStore.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/value/CopyOnWriteValueMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/value/IValueMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/BlockedResourceLinkPage.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/MockResourceLinkPage.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/MockResourceLinkPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/test.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/InstrumentationObjectSizeOfStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/ObjectSizeOfAgent.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/ObjectSizeOfAgent.java?view=diff&rev=517420&r1=517419&r2=517420
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/ObjectSizeOfAgent.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/ObjectSizeOfAgent.java Mon Mar 12 15:02:15 2007
@@ -1,70 +1,70 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package wicket.util.instrument;
-
-import java.lang.instrument.Instrumentation;
-
-import wicket.util.lang.Objects;
-import wicket.util.lang.Objects.IObjectSizeOfStrategy;
-
-/**
- * Instrumentation agent for calculating object sizes using Java's
- * instrumentation API. To use it, have the jar somewhere we you can access it
- * (just having this class on the classpath is not enough) and startup your
- * application with a -javaagent argument like e.g:
- * '-javaagent:/mydir/wicket-objectsizeof-agent-1.3-incubating-SNAPSHOT.jar'.
- * When the application starts up, this agent will register an
- * {@link IObjectSizeOfStrategy} at
- * {@link Objects#setObjectSizeOfStrategy(IObjectSizeOfStrategy)}. Note that
- * this is a static registration.
- *
- * @author eelcohillenius
- */
-public class ObjectSizeOfAgent {
-
- /**
- * Initializes agent when it is attached to an already running JVM.
- *
- * @param agentArgs
- * Arguments passed in to the agent
- * @param instrumentation
- * The instrumentation class
- */
- public static void agentmain(String agentArgs,
- Instrumentation instrumentation) {
-
- InstrumentationObjectSizeOfStrategy strategy = new InstrumentationObjectSizeOfStrategy(
- instrumentation);
- Objects.setObjectSizeOfStrategy(strategy);
- }
-
- /**
- * Initializes agent before the main function of the application is
- * executed.
- *
- * @param agentArgs
- * Arguments passed in to the agent
- * @param instrumentation
- * The instrumentation class
- */
- public static void premain(String agentArgs, Instrumentation instrumentation) {
-
- InstrumentationObjectSizeOfStrategy strategy = new InstrumentationObjectSizeOfStrategy(
- instrumentation);
- Objects.setObjectSizeOfStrategy(strategy);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.util.instrument;
+
+import java.lang.instrument.Instrumentation;
+
+import wicket.util.lang.Objects;
+import wicket.util.lang.Objects.IObjectSizeOfStrategy;
+
+/**
+ * Instrumentation agent for calculating object sizes using Java's
+ * instrumentation API. To use it, have the jar somewhere we you can access it
+ * (just having this class on the classpath is not enough) and startup your
+ * application with a -javaagent argument like e.g:
+ * '-javaagent:/mydir/wicket-objectsizeof-agent-1.3-incubating-SNAPSHOT.jar'.
+ * When the application starts up, this agent will register an
+ * {@link IObjectSizeOfStrategy} at
+ * {@link Objects#setObjectSizeOfStrategy(IObjectSizeOfStrategy)}. Note that
+ * this is a static registration.
+ *
+ * @author eelcohillenius
+ */
+public class ObjectSizeOfAgent {
+
+ /**
+ * Initializes agent when it is attached to an already running JVM.
+ *
+ * @param agentArgs
+ * Arguments passed in to the agent
+ * @param instrumentation
+ * The instrumentation class
+ */
+ public static void agentmain(String agentArgs,
+ Instrumentation instrumentation) {
+
+ InstrumentationObjectSizeOfStrategy strategy = new InstrumentationObjectSizeOfStrategy(
+ instrumentation);
+ Objects.setObjectSizeOfStrategy(strategy);
+ }
+
+ /**
+ * Initializes agent before the main function of the application is
+ * executed.
+ *
+ * @param agentArgs
+ * Arguments passed in to the agent
+ * @param instrumentation
+ * The instrumentation class
+ */
+ public static void premain(String agentArgs, Instrumentation instrumentation) {
+
+ InstrumentationObjectSizeOfStrategy strategy = new InstrumentationObjectSizeOfStrategy(
+ instrumentation);
+ Objects.setObjectSizeOfStrategy(strategy);
+ }
+}
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/main/java/wicket/util/instrument/ObjectSizeOfAgent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-objectssizeof-agent/src/test/wicket/util/license/ApacheLicenceHeaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native