diff options
author | Marko Gronroos <magi@vaadin.com> | 2016-05-20 14:44:42 +0300 |
---|---|---|
committer | Marko Grönroos <magi@vaadin.com> | 2016-06-30 11:13:20 +0000 |
commit | 93767cf76b2fb14c65b758066c67fc8b48cc2eeb (patch) | |
tree | 958ddb8c45271e9a505280ef750ae07ebeda170f /documentation/components/components-upload.asciidoc | |
parent | edad7348bb8eba807225bfa72d4b0a4342426c71 (diff) | |
download | vaadin-framework-93767cf76b2fb14c65b758066c67fc8b48cc2eeb.tar.gz vaadin-framework-93767cf76b2fb14c65b758066c67fc8b48cc2eeb.zip |
Scaled images for print edition and fixed errors up to the beginning of layouts chapter (#19835). Also major revision of Tree, CustomField, and layouts overview.
Change-Id: I19f5e9511b83f953ce4707f324d81c2821ebb69d
Diffstat (limited to 'documentation/components/components-upload.asciidoc')
-rw-r--r-- | documentation/components/components-upload.asciidoc | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/documentation/components/components-upload.asciidoc b/documentation/components/components-upload.asciidoc index bf5713943f..bb46228398 100644 --- a/documentation/components/components-upload.asciidoc +++ b/documentation/components/components-upload.asciidoc @@ -21,15 +21,14 @@ user sends the file by clicking the upload submit button. Uploading requires a receiver that implements [interfacename]#Upload.Receiver# to provide an output stream to which the upload is written by the server. - [source, java] ---- Upload upload = new Upload("Upload it here", receiver); ---- [[figure.ui.upload]] -.Upload Component -image::img/upload.png[] +.The [classname]#Upload# component +image::img/upload.png[width=60%, scaledwidth=80%] You can set the text of the upload button with [methodname]#setButtonCaption()#. Note that it is difficult to change the caption or look of the @@ -38,7 +37,6 @@ language of the [guibutton]#Browse# button is determined by the browser, so if you wish to have the language of the [classname]#Upload# component consistent, you will have to use the same language in your application. - [source, java] ---- upload.setButtonCaption("Upload Now"); @@ -88,7 +86,6 @@ The following example uploads images to [filename]#/tmp/uploads# directory in (UNIX) filesystem (the directory must exist or the upload fails). The component displays the uploaded image in an [classname]#Image# component. - [source, java] ---- // Show uploaded file in this placeholder @@ -99,7 +96,7 @@ image.setVisible(false); // listener for successful upload class ImageUploader implements Receiver, SucceededListener { public File file; - + public OutputStream receiveUpload(String filename, String mimeType) { // Create upload stream @@ -124,13 +121,13 @@ class ImageUploader implements Receiver, SucceededListener { image.setSource(new FileResource(file)); } }; -ImageUploader receiver = new ImageUploader(); +ImageUploader receiver = new ImageUploader(); // Create the upload with a caption and set receiver later Upload upload = new Upload("Upload Image Here", receiver); upload.setButtonCaption("Start Upload"); upload.addSucceededListener(receiver); - + // Put the components in a panel Panel panel = new Panel("Cool Image Storage"); Layout panelContent = new VerticalLayout(); @@ -147,8 +144,7 @@ shown in <<figure.ui.upload.example>>. [[figure.ui.upload.example]] .Image Upload Example -image::img/upload-example.png[] - +image::img/upload-example.png[width=60%, scaledwidth=80%] [[components.upload.css]] == CSS Style Rules @@ -166,7 +162,3 @@ image::img/upload-example.png[] The [classname]#Upload# component has an overall [literal]#++v-upload++# style. The upload button has the same structure and style as a regular [classname]#Button# component. - - - - |