]> git.argeo.org Git - lgpl/argeo-commons.git/blob - UploadFileWizardPage.java
17d4e22f3f0c2df1c16065ab8f98fedfed875e6b
[lgpl/argeo-commons.git] / UploadFileWizardPage.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.eclipse.ui.specific;
17
18 import java.io.InputStream;
19
20 import org.eclipse.jface.wizard.WizardPage;
21 import org.eclipse.rap.rwt.widgets.FileUpload;
22 import org.eclipse.swt.SWT;
23 import org.eclipse.swt.layout.GridData;
24 import org.eclipse.swt.layout.GridLayout;
25 import org.eclipse.swt.widgets.Composite;
26 import org.eclipse.swt.widgets.Label;
27
28 public class UploadFileWizardPage extends WizardPage {
29 // private final static Log log = LogFactory
30 // .getLog(UploadFileWizardPage.class);
31 private static final long serialVersionUID = 8251354244542973179L;
32 public final static String FILE_ITEM_TYPE = "FILE";
33 public final static String FOLDER_ITEM_TYPE = "FOLDER";
34
35 private FileUpload fileUpload;
36
37 public UploadFileWizardPage() {
38 super("Import from file system");
39 setDescription("Import files from the local file system to the server");
40 }
41
42 public void createControl(Composite parent) {
43 Composite composite = new Composite(parent, SWT.NONE);
44 composite.setLayout(new GridLayout(2, false));
45 composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
46 new Label(composite, SWT.NONE).setText("Pick up a file");
47 fileUpload = new FileUpload(composite, SWT.BORDER);
48 fileUpload.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
49 fileUpload.setText("Browse");
50 setControl(composite);
51 }
52
53 public String getObjectPath() {
54 // NOTE Returns the full file name of the last uploaded file including
55 // the file path as selected by the user on his local machine.
56 // The full path including the directory and file drive are only
57 // returned, if the browser supports reading this properties. In Firefox
58 // 3, only the filename is returned.
59 return null;
60 }
61
62 public String getObjectName() {
63 return fileUpload.getFileName();
64 }
65
66 public String getObjectType() {
67 return FILE_ITEM_TYPE;
68 }
69
70 public void performFinish() {
71 // boolean success = uploadFile.performUpload();
72 // if (!success)
73 // throw new ArgeoException("Cannot upload file named "
74 // + uploadFile.getPath());
75 }
76
77 // protected void handleUploadFinished(final Upload upload) {
78 // }
79
80 public InputStream getFileInputStream() {
81 return null;
82 }
83
84 public boolean getNeedsProgressMonitor() {
85 return false;
86 }
87
88 }