diff --git a/.classpath b/.classpath
index 51ca97e..63bece1 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
@@ -31,5 +31,5 @@
-
+
diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs
index 8e9f45b..f78db8d 100644
--- a/.settings/com.google.gdt.eclipse.core.prefs
+++ b/.settings/com.google.gdt.eclipse.core.prefs
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
-lastWarOutDir=/Users/massi/Documents/workspace/share-updates/target/share-updates-1.0.0-SNAPSHOT
+lastWarOutDir=/Users/massi/Documents/workspace/share-updates/target/share-updates-1.1.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/pom.xml b/pom.xml
index c934f59..78f0d95 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
org.gcube.portlets.user
share-updates
war
- 1.0.0-SNAPSHOT
+ 1.1.0-SNAPSHOT
gCube Share Updates Portlet
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.java b/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.java
index 5d23ed1..b0e7ec3 100644
--- a/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.java
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.java
@@ -16,25 +16,26 @@ import org.gcube.portlets.user.shareupdates.shared.LinkPreview;
import org.gcube.portlets.user.shareupdates.shared.UserSettings;
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEvent;
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEventHandler;
-import org.gcube.portlets.widgets.fileupload.client.view.FileSubmit;
-import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressDialog;
import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressPanel;
-import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressView;
import org.jsonmaker.gwt.client.Jsonizer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiFactory;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FileUpload;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
@@ -59,6 +60,7 @@ public class ShareUpdateForm extends Composite {
public static final String loading = GWT.getModuleBaseURL() + "../images/avatarLoader.gif";
public static final String avatar_default = GWT.getModuleBaseURL() + "../images/Avatar_default.png";
+ public static final String attach = GWT.getModuleBaseURL() + "../images/attach.png";
private HandlerManager eventBus = new HandlerManager(null);
@@ -86,7 +88,7 @@ public class ShareUpdateForm extends Composite {
Button submitButton;
@UiField
- Button attachButton;
+ HTML attachButton;
@UiField
Image avatarImage;
@@ -103,7 +105,11 @@ public class ShareUpdateForm extends Composite {
bind();
avatarImage.setUrl(loading);
shareTextArea.setText(SHARE_UPDATE_TEXT);
-
+
+ attachButton.getElement().getStyle().setDisplay(Display.INLINE);
+ attachButton.setHTML(" ");
+
+
shareupdateService.getUserSettings(new AsyncCallback() {
public void onFailure(Throwable caught) {
avatarImage.setSize("60px", "60px");
@@ -140,7 +146,7 @@ public class ShareUpdateForm extends Composite {
}
});
}
-
+
/** Used by UiBinder to instantiate UploadProgressView */
@UiFactory
UploadProgressPanel instatiateProgressView() {
@@ -170,15 +176,24 @@ public class ShareUpdateForm extends Composite {
@UiHandler("attachButton")
void onAttachClick(ClickEvent e) {
- GWT.log("aaa");
if (myLinkPreviewer == null) {
- uploadProgress.initialize();
+ FileUpload up = uploadProgress.initialize();
+ up.setVisible(false);
+ fileBrowse(up.getElement());
uploadProgress.setVisible(true);
- attachButton.setVisible(false);
+ attachButton.getElement().getStyle().setVisibility(Visibility.HIDDEN); //beacuse otherwise it looses the other properties setting
} else {
Window.alert("You cannot post two files, please remove the previous one first.");
}
}
+ /**
+ * this simulates the click on the hidden native GWT FileUpload Button
+ * @param el
+ */
+ public static native void fileBrowse(Element el) /*-{
+ el.click();
+ }-*/;
+
@UiHandler("submitButton")
void onClick(ClickEvent e) {
@@ -344,7 +359,7 @@ public class ShareUpdateForm extends Composite {
public void onFailure(Throwable caught) {
uploadProgress.showRegisteringResult(false);
preview.clear();
- attachButton.setVisible(true);
+ attachButton.getElement().getStyle().setVisibility(Visibility.VISIBLE); //beacuse otherwise it looses the other properties setting
}
public void onSuccess(LinkPreview result) {
@@ -389,6 +404,6 @@ public class ShareUpdateForm extends Composite {
protected void cancelPreview() {
preview.clear();
myLinkPreviewer = null;
- attachButton.setVisible(true);
+ attachButton.getElement().getStyle().setVisibility(Visibility.VISIBLE); //beacuse otherwise it looses the other properties setting
}
}
diff --git a/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.ui.xml b/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.ui.xml
index 2a20e0a..02a260c 100644
--- a/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.ui.xml
+++ b/src/main/java/org/gcube/portlets/user/shareupdates/client/form/ShareUpdateForm.ui.xml
@@ -39,9 +39,8 @@
|
- |
diff --git a/src/main/webapp/ShareUpdates.css b/src/main/webapp/ShareUpdates.css
index 6233234..bb394ed 100644
--- a/src/main/webapp/ShareUpdates.css
+++ b/src/main/webapp/ShareUpdates.css
@@ -1,11 +1,3 @@
-.FileSubmit input {
- width: 570px !important;
-}
-
-.bar-container {
- width: 600px !important;
- margin: 1px !important;
-}
/* Superpose TextArea and Highlight DIV trick starts here */
#supercontainer {
@@ -78,6 +70,7 @@
.gwt-Button {
text-shadow: none;
font-weight: normal;
+ padding: 5px 15px !important;
}
.darker-color {
@@ -100,7 +93,7 @@
font-size: 12px;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
cursor: pointer;
- padding: 3px 15px;
+ padding: 5px 15px;
}
.shareButton:hover, .shareButton:focus {
diff --git a/src/main/webapp/images/attach.png b/src/main/webapp/images/attach.png
new file mode 100644
index 0000000..c43bdb9
Binary files /dev/null and b/src/main/webapp/images/attach.png differ