Update SEBI :
authorBruno Sinou <bsinou@argeo.org>
Tue, 22 Mar 2011 19:38:36 +0000 (19:38 +0000)
committerBruno Sinou <bsinou@argeo.org>
Tue, 22 Mar 2011 19:38:36 +0000 (19:38 +0000)
+ finalize platform specific upload component
+ update rap launcher
+ finalize import wizard
+ some slight picture and grafical improvment

git-svn-id: https://svn.argeo.org/commons/trunk@4339 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/argeo-node-web.properties
eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/GenericUploadControl.java [new file with mode: 0644]
eclipse/runtime/org.argeo.eclipse.ui.rcp/pom.xml
eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/GenericUploadControl.java [new file with mode: 0644]

index cdc985398d9a760fd690c70cb908d88f9a3198d9..02070532d1bc6dbd3fb72902023ad1ca0b22bdf6 100644 (file)
@@ -9,13 +9,18 @@ org.argeo.security.services.admin,\
 org.argeo.security.equinox,\
 org.eclipse.core.runtime,\
 org.eclipse.equinox.common,\
+org.eclipse.equinox.http.registry,\
 org.eclipse.equinox.launcher,\
-org.springframework.osgi.web.extender,\
 org.argeo.dep.osgi.catalina.start,\
 org.argeo.jackrabbit.webapp,\
-org.eclipse.equinox.http.registry,\
-org.argeo.server.osgi.webapp,\
 org.argeo.jcr.ui.explorer,\
+org.argeo.node.repo.jackrabbit,\
+org.argeo.security.dao.ldap,\
+org.argeo.security.equinox,\
+org.argeo.security.services,\
+org.argeo.security.services.admin,\
+org.argeo.server.ads.server,\
+org.argeo.server.osgi.webapp,\
 
 org.argeo.security.ui.initialPerspective=org.argeo.jcr.ui.explorer.perspective
 
diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/GenericUploadControl.java b/eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/GenericUploadControl.java
new file mode 100644 (file)
index 0000000..6fcd21a
--- /dev/null
@@ -0,0 +1,97 @@
+package org.argeo.eclipse.ui.specific;
+
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.ArgeoException;
+import org.eclipse.rwt.widgets.Upload;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+public class GenericUploadControl extends Composite {
+       private final static Log log = LogFactory
+                       .getLog(GenericUploadControl.class);
+
+       private Upload upload;
+
+       public GenericUploadControl(Composite parent, int style, String browseLabel) {
+               super(parent, style);
+               createControl(this, browseLabel);
+
+       }
+
+       private void createControl(Composite parent, String browseLabel) {
+               parent.setLayout(new GridLayout(1, false));
+               parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+               upload = new Upload(parent, SWT.BORDER);
+               upload.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+               upload.setBrowseButtonText(browseLabel);
+               // upload.addModifyListener(new UploadListener());
+               parent.pack();
+       }
+
+       public boolean isControlEmpty() {
+               String path = upload.getPath();
+               if (log.isTraceEnabled())
+                       log.trace("UploadControl chosen path : " + path);
+               if (path == null || "".equals(path.trim()))
+                       return true;
+               else
+                       return false;
+       }
+
+       public byte[] performUpload() {
+               boolean success = upload.performUpload();
+               if (success) {
+                       InputStream inStream = null;
+                       byte[] fileBA = null;
+                       try {
+                               inStream = upload.getUploadItem().getFileInputStream();
+                               fileBA = IOUtils.toByteArray(inStream);
+                       } catch (Exception e) {
+                               throw new ArgeoException("Cannot read uploaded data", e);
+                       } finally {
+                               IOUtils.closeQuietly(inStream);
+                       }
+                       return fileBA;
+               }
+               return null;
+       }
+
+       public void addModifyListener(ModifyListener listener) {
+               upload.addModifyListener(listener);
+       }
+
+       // private class UploadManager extends UploadAdapter {
+       // private Upload upload;
+       //
+       // public UploadManager(Upload upload) {
+       // super();
+       // this.upload = upload;
+       // }
+       //
+       // public void uploadFinished(UploadEvent uploadEvent) {
+       // handleUploadFinished(upload);
+       // }
+       //
+       // public void uploadInProgress(UploadEvent uploadEvent) {
+       // }
+       //
+       // public void uploadException(UploadEvent uploadEvent) {
+       // Exception exc = uploadEvent.getUploadException();
+       // if (exc != null) {
+       // MessageDialog.openError(Display.getCurrent().getActiveShell(),
+       // "Error", exc.getMessage());
+       // }
+       // }
+       //
+       // }
+       //
+
+}
index 65f75a2175e98787d0b2420a8884e868b899cf5c..37f3977e9e628496596572e8a4b99ddb66f698c4 100644 (file)
                        <artifactId>com.springsource.org.apache.commons.io</artifactId>
                </dependency>
 
+               <!-- Logging -->
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
+               </dependency>
        </dependencies>
 </project>
\ No newline at end of file
diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/GenericUploadControl.java b/eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/GenericUploadControl.java
new file mode 100644 (file)
index 0000000..8393006
--- /dev/null
@@ -0,0 +1,113 @@
+package org.argeo.eclipse.ui.specific;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public class GenericUploadControl extends Composite {
+       private final static Log log = LogFactory
+                       .getLog(GenericUploadControl.class);
+
+       private FileDialog dialog;
+       private Text filePath;
+
+       public GenericUploadControl(Composite parent, int style, String browseLabel) {
+               super(parent, style);
+               createControl(this, browseLabel);
+
+       }
+
+       private void createControl(final Composite parent, String browseLabel) {
+               Composite composite = new Composite(parent, SWT.FILL);
+               composite.setLayout(new GridLayout(2, false));
+               composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+               filePath = new Text(parent, SWT.BORDER | SWT.SINGLE);
+               filePath.setEnabled(false);
+
+               // Execute button
+               Button execute = new Button(parent, SWT.PUSH);
+               GridData gridData = new GridData();
+               gridData.horizontalAlignment = GridData.BEGINNING;
+               execute.setLayoutData(gridData);
+               execute.setText(browseLabel);
+
+               // Button listener
+               Listener executeListener = new Listener() {
+                       public void handleEvent(Event event) {
+                               dialog = new FileDialog(parent.getShell());
+                               dialog.open();
+
+                       }
+               };
+
+               execute.addListener(SWT.Selection, executeListener);
+       }
+
+       public boolean isControlEmpty() {
+               String path = filePath.getText();
+               if (path == null || "".equals(path.trim()))
+                       return true;
+               else
+                       return false;
+       }
+
+       public byte[] performUpload() {
+               String path = filePath.getText();
+               if (path != null) {
+                       try {
+                               File file = new File(path);
+                               byte[] fileBA = FileUtils.readFileToByteArray(file);
+                               return fileBA;
+                       } catch (IOException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }
+               }
+               return null;
+       }
+
+       public void addModifyListener(ModifyListener listener) {
+               filePath.addModifyListener(listener);
+       }
+
+       // private class UploadManager extends UploadAdapter {
+       // private Upload upload;
+       //
+       // public UploadManager(Upload upload) {
+       // super();
+       // this.upload = upload;
+       // }
+       //
+       // public void uploadFinished(UploadEvent uploadEvent) {
+       // handleUploadFinished(upload);
+       // }
+       //
+       // public void uploadInProgress(UploadEvent uploadEvent) {
+       // }
+       //
+       // public void uploadException(UploadEvent uploadEvent) {
+       // Exception exc = uploadEvent.getUploadException();
+       // if (exc != null) {
+       // MessageDialog.openError(Display.getCurrent().getActiveShell(),
+       // "Error", exc.getMessage());
+       // }
+       // }
+       //
+       // }
+       //
+
+}