</ul>
<li><tt>TwinColSelect</tt> is always in multiselect mode</li>
<li><tt>ListSelect</tt> is always in multiselect mode</li>
- <li><tt>Upload</tt> has a separate immediate mode <tt>setImmediateMode(boolean immediateMode)</tt> replacing removed <tt>setImmediate</tt></li>
+ <li><tt>Upload</tt> has a separate immediate mode <tt>setImmediateMode(boolean)</tt> replacing <tt>setImmediate</tt> and is now by default in immediate mode</li>
<li><tt>RichTextArea</tt> no longer receives a special "v-richtextarea-readonly" class when readonly, only the standard "v-readonly" class</li>
<li><tt>Grid</tt> has been typed to the bean type it is using and its columns are specified with a value provider callback instead of "propertyId"</li>
<li><tt>Grid</tt> Editor now uses <tt>Binder</tt> instead of <tt>FieldGroup</tt>, and doesn't support a <tt>FieldFactory</tt></li>
/**
* Sets the immediate mode of the upload.
* <p>
- * If the upload is in immediate mode, it displays the browser file choosing
- * button immediately, whereas a non-immediate upload only shows a Vaadin
- * button.
+ * If the upload is in immediate mode, the file upload is started
+ * immediately after the user has selected the file.
* <p>
- * The default mode of an Upload component is non-immediate.
+ * If the upload is not in immediate mode, after selecting the file the user
+ * must click another button to start the upload.
+ * <p>
+ * The default mode of an Upload component is immediate.
*
* @param immediateMode
* {@code true} for immediate mode, {@code false} for not
/**
* Returns the immediate mode of the upload.
+ * <p>
+ * The default mode of an Upload component is immediate.
*
* @return {@code true} if the upload is in immediate mode, {@code false} if
* the upload is not in immediate mode
*/
package com.vaadin.tests.server.component.upload;
+import org.junit.Assert;
import org.junit.Test;
import com.vaadin.tests.design.DeclarativeTestBase;
public void testWriteEmpty() {
testWrite("<vaadin-upload />", new Upload());
}
+
+ @Test
+ public void testImmediateModeDefault() {
+ Assert.assertTrue(
+ testRead("<v-upload />", new Upload()).isImmediateMode());
+
+ Upload upload = new Upload();
+ upload.setImmediateMode(false);
+ Assert.assertFalse(testRead("<v-upload immediate-mode=false />", upload)
+ .isImmediateMode());
+ }
}
Assert.assertFalse(upload.isUploading());
}
+ @Test
+ public void setImmediateMode_defaultTrue() {
+ Upload upload = new Upload();
+
+ Assert.assertTrue("Upload should be in immediate mode by default",
+ upload.isImmediateMode());
+ }
+
@Test
public void getState_uploadHasCustomState() {
TestUpload upload = new TestUpload();
public class UploadState extends AbstractComponentState {
/** Is the upload component in immediate mode or not */
- public boolean immediateMode;
+ public boolean immediateMode = true;
{
primaryStyleName = "v-upload";
public UploadCssTest(TestSampler parent) {
Upload up = new Upload();
up.setId("upload" + debugIdCounter++);
+ up.setImmediateMode(false);
parent.addComponent(up);
up = new Upload();
up.setId("upload" + debugIdCounter++);
- up.setImmediateMode(true);
parent.addComponent(up);
}
}
Upload u = new Upload("Upload", this);
u.setId(UPLOAD_ID);
u.setSizeUndefined();
+ u.setImmediateMode(false);
addComponent(u);
protected void setup(VaadinRequest request) {
Upload upload = new Upload();
upload.setDescription("tootlip");
+ upload.setImmediateMode(false);
addComponent(upload);
}
e.printStackTrace();
continue;
}
+ if (c instanceof Upload) {
+ ((Upload) c).setImmediateMode(false);
+ }
c.setCaption(clazz.getSimpleName());
c.setIcon(icon);
gl.addComponent(c);
@Override
protected void setup(VaadinRequest request) {
- // by default is not in immediate mode
- Upload upload = new Upload();
- upload.setId("upload");
- addComponent(upload);
-
+ // by default is in immediate mode (since 8.0)
Upload immediateUpload = new Upload();
immediateUpload.setId("immediateupload");
- immediateUpload.setImmediateMode(true);
addComponent(immediateUpload);
+
+ Upload upload = new Upload();
+ upload.setId("upload");
+ upload.setImmediateMode(false);
+ addComponent(upload);
}
/*