]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - base/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/UploadFileWizardPage.java
2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.eclipse
.ui
.specific
;
18 import java
.io
.InputStream
;
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
;
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";
35 private FileUpload fileUpload
;
37 public UploadFileWizardPage() {
38 super("Import from file system");
39 setDescription("Import files from the local file system to the server");
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
);
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.
62 public String
getObjectName() {
63 return fileUpload
.getFileName();
66 public String
getObjectType() {
67 return FILE_ITEM_TYPE
;
70 public void performFinish() {
71 // boolean success = uploadFile.performUpload();
73 // throw new ArgeoException("Cannot upload file named "
74 // + uploadFile.getPath());
77 // protected void handleUploadFinished(final Upload upload) {
80 public InputStream
getFileInputStream() {
84 public boolean getNeedsProgressMonitor() {