From bc05dbcbe9131ae51101f401152e2cc1bae141be Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 6 Nov 2015 14:18:06 +0000 Subject: [PATCH] 1280: Workspace GUI: quote and available feature improvements Task-Url: https://support.d4science.org/issues/1280 Updated panel to show available features on top git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@120218 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 4 +- .settings/org.eclipse.wst.common.component | 2 +- .../user/workspace/client/AppController.java | 47 +++++-- .../workspace/client/ConstantsPortlet.java | 1 + ...atures.java => WorkspaceFeaturesView.java} | 119 +++++++++++------- ...es.ui.xml => WorkspaceFeaturesView.ui.xml} | 19 +-- .../client/view/WorkspaceQuotesView.java | 70 +++++++++++ .../client/view/WorkspaceQuotesView.ui.xml | 9 ++ src/main/webapp/workspaceportlet.css | 24 ++++ 9 files changed, 235 insertions(+), 60 deletions(-) rename src/main/java/org/gcube/portlets/user/workspace/client/view/{WorkspaceFeatures.java => WorkspaceFeaturesView.java} (60%) rename src/main/java/org/gcube/portlets/user/workspace/client/view/{WorkspaceFeatures.ui.xml => WorkspaceFeaturesView.ui.xml} (61%) create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.java create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.ui.xml diff --git a/.classpath b/.classpath index afbc978..994826f 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -26,5 +26,5 @@ - + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index e5db9a0..44d1798 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -8,7 +8,7 @@ uses - + uses diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java index 207809a..0813148 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java @@ -97,7 +97,8 @@ import org.gcube.portlets.user.workspace.client.model.FileGridModel; import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.model.FolderModel; import org.gcube.portlets.user.workspace.client.model.ScopeModel; -import org.gcube.portlets.user.workspace.client.view.WorkspaceFeatures; +import org.gcube.portlets.user.workspace.client.view.WorkspaceFeaturesView; +import org.gcube.portlets.user.workspace.client.view.WorkspaceQuotesView; import org.gcube.portlets.user.workspace.client.view.WorskpacePortlet; import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel; import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel; @@ -151,7 +152,8 @@ public class AppController implements SubscriberInterface { private String selectedSmartFolderId; private String selectedSmartFolderCategory; // private Alert alertFeatures = new Alert(); - private WorkspaceFeatures workspaceFeatures = new WorkspaceFeatures(); + private WorkspaceFeaturesView workspaceFeatures = new WorkspaceFeaturesView(); + private WorkspaceQuotesView wsQuotesView = new WorkspaceQuotesView(); public static final Logger logger = Logger.getLogger("WsAppController"); @@ -1322,7 +1324,12 @@ public class AppController implements SubscriberInterface { } private void initPortlet(final HasWidgets rootPanel, final boolean instanceWithGrouping, boolean isSearchForItemId, final String searchParameter, final String itemIdParameter, final String operationParameter){ - + + final boolean displayFeatures = readCookieWorkspaceAvailableFeatures(); + + if(displayFeatures) + rootPanel.add(workspaceFeatures); + rootPanel.add(wsPortlet.getBorderLayoutContainer()); //SET TOGGLE BUTTON GRID VIEW @@ -1369,8 +1376,7 @@ public class AppController implements SubscriberInterface { updateWorksapaceSize(false); } }); - - rootPanel.add(workspaceFeatures); + rootPanel.add(wsQuotesView); } private void setWorkspaceUserQuotes(String size, long totalItems){ @@ -1385,7 +1391,7 @@ public class AppController implements SubscriberInterface { } msg+= ", "+size; - workspaceFeatures.updateQuotes(msg); + wsQuotesView.updateQuotes(msg); } @@ -1409,6 +1415,27 @@ public class AppController implements SubscriberInterface { return false; } + + + /** + * + * @return true if exists a cookie with msg as true value (or not exists the cookie), false otherwise + */ + private boolean readCookieWorkspaceAvailableFeatures() { + + //get the cookie with name GCBUEWorkspaceGridViewSetting + String msg = Cookies.getCookie(ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_AVAILABLE_FEATURES); + //if null, there was no cookie + if(msg == null){ + setCookie(ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_AVAILABLE_FEATURES, "true", ConstantsPortlet.COOKIE_EXPIRE_DAYS); + return true; + } + + if(msg.compareTo("true")==0) + return true; + + return false; + } public static void setCookie(String name, String value, int days) { @@ -1424,7 +1451,7 @@ public class AppController implements SubscriberInterface { Cookies.setCookie(name, value, expiringDate); } - public static void setCookieGridViewSetting(String value) { + protected static void setCookieGridViewSetting(String value) { setCookie(ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING, value, ConstantsPortlet.COOKIE_EXPIRE_DAYS); } @@ -2033,7 +2060,11 @@ public class AppController implements SubscriberInterface { } private void setVisibleUserQuote(boolean bool){ - workspaceFeatures.setQuoteVisible(bool); + wsQuotesView.setQuoteVisible(bool); + } + + private void setVisibleWsAvailableFeatures(boolean bool){ + workspaceFeatures.setVisible(bool); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java index 6b7f7e6..362637f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java @@ -55,6 +55,7 @@ public class ConstantsPortlet { //COOKIE SETTINGS public static final String GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING = "GCUBE-Cookie-WorkspaceGridViewSetting"; + public static final String GCUBE_COOKIE_WORKSPACE_AVAILABLE_FEATURES = "GCUBE-Cookie-WorkspaceAvailableFeatures"; public static final int COOKIE_EXPIRE_DAYS = 30; public static final long MILLISECS_PER_DAY = 1000L * 60L * 60L * 24L; diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeatures.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java similarity index 60% rename from src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeatures.java rename to src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java index 145ea4a..65fe793 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeatures.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.java @@ -3,28 +3,42 @@ */ package org.gcube.portlets.user.workspace.client.view; +import org.gcube.portlets.user.workspace.client.AppController; +import org.gcube.portlets.user.workspace.client.ConstantsPortlet; import org.gcube.portlets.user.workspace.client.resources.Resources; +import com.github.gwtbootstrap.client.ui.Alert; +import com.github.gwtbootstrap.client.ui.CheckBox; import com.github.gwtbootstrap.client.ui.Label; import com.github.gwtbootstrap.client.ui.Popover; +import com.github.gwtbootstrap.client.ui.base.AlertBase; import com.github.gwtbootstrap.client.ui.constants.Placement; import com.github.gwtbootstrap.client.ui.constants.Trigger; +import com.github.gwtbootstrap.client.ui.event.ClosedEvent; +import com.github.gwtbootstrap.client.ui.event.ClosedHandler; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Widget; -/** - * The Class PageTemplate. - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2015 - */ -public class WorkspaceFeatures extends Composite { +/** + * The Class WorkspaceFeaturesView. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Nov 6, 2015 + */ +public class WorkspaceFeaturesView extends Composite { + + @UiField + Alert alert_ws_features; + @UiField HorizontalPanel ws_features; @@ -32,10 +46,10 @@ public class WorkspaceFeatures extends Composite { HorizontalPanel hp_feautures; @UiField - com.google.gwt.user.client.ui.Label how_to; + HorizontalPanel info_features; @UiField - Label ws_quote; + com.google.gwt.user.client.ui.Label how_to; @UiField Label shf; //Share Folders & Files @@ -43,7 +57,7 @@ public class WorkspaceFeatures extends Composite { private Popover overShF= new Popover(); @UiField - Label upl; //DRAG & DROP + Label upl; //UPLOAD private Popover overUpload = new Popover(); @@ -61,41 +75,73 @@ public class WorkspaceFeatures extends Composite { @UiField FlowPanel fp3; + + @UiField + CheckBox ck_features_show_again; private static WorkspaceFeaturesUiBinder uiBinder = GWT.create(WorkspaceFeaturesUiBinder.class); + /** - * The Interface PageTemplateUiBinder. + * The Interface WorkspaceFeaturesUiBinder. * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, - * 2015 + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Nov 6, 2015 */ interface WorkspaceFeaturesUiBinder extends - UiBinder { + UiBinder { } - + /** - * Instantiates a new page template. + * Instantiates a new workspace features view. */ - public WorkspaceFeatures() { + public WorkspaceFeaturesView() { initWidget(uiBinder.createAndBindUi(this)); + alert_ws_features.addStyleName("alert_ws_features"); hp_feautures.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); ws_features.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp_feautures.setCellWidth(fp1, "33%"); + + Image info = Resources.getIconInformation().createImage(); + info.setTitle("Workspace available features"); + info_features.insert(info, 0); + info_features.setCellVerticalAlignment(how_to, HasVerticalAlignment.ALIGN_MIDDLE); + how_to.addStyleName("margin-left-10"); + hp_feautures.setCellVerticalAlignment(fp1, HasVerticalAlignment.ALIGN_MIDDLE); + hp_feautures.setCellWidth(fp2, "33%"); + hp_feautures.setCellHorizontalAlignment(fp2, HasHorizontalAlignment.ALIGN_CENTER); + hp_feautures.setCellVerticalAlignment(fp2, HasVerticalAlignment.ALIGN_MIDDLE); hp_feautures.setCellWidth(fp3, "33%"); - how_to.addStyleName("margin-right-10"); + hp_feautures.setCellHorizontalAlignment(fp3, HasHorizontalAlignment.ALIGN_RIGHT); + hp_feautures.setCellVerticalAlignment(fp3, HasVerticalAlignment.ALIGN_MIDDLE); + + ck_features_show_again.getElement().getFirstChildElement().setId("check_features_donotshowagain"); + + shf.addStyleName("margin-right-10"); upl.addStyleName("margin-right-10"); plk.addStyleName("margin-right-10"); initPopupShareFeature(); initPopupUploadFeature(); initPopupPlkFeature(); + + alert_ws_features.addClosedHandler(new ClosedHandler() { + + @Override + public void onClosed(ClosedEvent event) { + Boolean isChecked = ck_features_show_again.getValue(); + Boolean showAgain = !isChecked; + GWT.log("Close alert_ws_features, show again? "+showAgain.toString().toLowerCase()); + AppController.setCookie(ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_AVAILABLE_FEATURES, showAgain.toString().toLowerCase(), ConstantsPortlet.COOKIE_EXPIRE_DAYS); + + } + }); } /** - * + * Inits the popup share feature. */ private void initPopupShareFeature() { overShF.setAnimation(false); @@ -104,13 +150,13 @@ public class WorkspaceFeatures extends Composite { String icon = ""+Resources.getIconShareFolder().getSafeHtml().asString()+""; overShF.setText(icon+"The quickest way to share something is using the Share Folder. Locate the folder with the files you want to share and then click 'Share'"); overShF.setHtml(true); - overShF.setPlacement(Placement.TOP); + overShF.setPlacement(Placement.BOTTOM); overShF.setTrigger(Trigger.HOVER); overShF.reconfigure(); } /** - * + * Inits the popup upload feature. */ private void initPopupUploadFeature() { overUpload.setAnimation(false); @@ -125,12 +171,14 @@ public class WorkspaceFeatures extends Composite { +iconUploadArchive+ "3 - Upload a zip file to unzip directly its content in the Workspace.
"); overUpload.setHtml(true); - overUpload.setPlacement(Placement.TOP); + overUpload.setPlacement(Placement.BOTTOM); overUpload.setTrigger(Trigger.HOVER); overUpload.reconfigure(); -// overImgUpload.show(); } + /** + * Inits the popup plk feature. + */ private void initPopupPlkFeature() { overPlk.setAnimation(false); overPlk.setWidget(plk); @@ -138,31 +186,18 @@ public class WorkspaceFeatures extends Composite { String icon = ""+Resources.getIconPublicLink().getSafeHtml().asString()+""; overPlk.setText(icon+"Create links to files in your Workspace to download them. You can send the links to anyone by pasting them into Workspace Message, your emails, instant messages, etc."); overPlk.setHtml(true); - overPlk.setPlacement(Placement.TOP); + overPlk.setPlacement(Placement.BOTTOM); overPlk.setTrigger(Trigger.HOVER); overPlk.reconfigure(); -// overImgUpload.show(); - } - - /** - * @param html - */ - public void updateQuotes(String html) { - ws_quote.setText(html); } - /** - * @param bool + /* (non-Javadoc) + * @see com.google.gwt.user.client.ui.UIObject#setVisible(boolean) */ - public void setQuoteVisible(boolean bool) { - ws_quote.setVisible(bool); - } - - /** - * @param bool - */ - public void setDndFeatureVisible(boolean bool) { - upl.setVisible(bool); + public void setVisible(boolean bool){ + this.setVisible(bool); } + + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeatures.ui.xml b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.ui.xml similarity index 61% rename from src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeatures.ui.xml rename to src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.ui.xml index e8c5407..84f58df 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeatures.ui.xml +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceFeaturesView.ui.xml @@ -2,22 +2,27 @@ - + - + + How-to + - - - - How-to: + + - + + + + diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.java new file mode 100644 index 0000000..33cfad0 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.java @@ -0,0 +1,70 @@ +/** + * + */ +package org.gcube.portlets.user.workspace.client.view; + +import com.github.gwtbootstrap.client.ui.Label; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HasVerticalAlignment; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Widget; + +/** + * The Class WorkspaceQuotes. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 6, 2015 + */ +public class WorkspaceQuotesView extends Composite { + + @UiField + HorizontalPanel hp_quotes; + + @UiField + Label ws_quote; + + private static WorkspaceFeaturesUiBinder uiBinder = GWT + .create(WorkspaceFeaturesUiBinder.class); + + /** + * The Interface PageTemplateUiBinder. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, + * 2015 + */ + interface WorkspaceFeaturesUiBinder extends + UiBinder { + } + + /** + * Instantiates a new workspace quotes. + */ + public WorkspaceQuotesView() { + + initWidget(uiBinder.createAndBindUi(this)); + hp_quotes.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); + hp_quotes.getElement().getStyle().setMarginTop(10, Unit.PX); + } + + /** + * Update quotes. + * + * @param html + * the html + */ + public void updateQuotes(String html) { + ws_quote.setText(html); + } + + /** + * @param bool + */ + public void setQuoteVisible(boolean bool) { + ws_quote.setVisible(bool); + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.ui.xml b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.ui.xml new file mode 100644 index 0000000..88c8e0e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorkspaceQuotesView.ui.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/workspaceportlet.css b/src/main/webapp/workspaceportlet.css index 310803c..2068b24 100644 --- a/src/main/webapp/workspaceportlet.css +++ b/src/main/webapp/workspaceportlet.css @@ -393,4 +393,28 @@ .margin-right-10{ margin-right: 10px; +} + +.margin-left-10{ + margin-left: 10px; +} + +.alert_ws_features{ + background: none repeat scroll 0 0 rgba(0, 0, 0, 0) !important; + border: 1px solid #99BBE8 !important; + color: #226599 !important; + margin-bottom: 5px !important; + margin-left: auto; + margin-right: auto; + margin-top: auto; + width: 95% +} + +.alert_ws_features .close{ + top: 4px !important; +} + +#check_features_donotshowagain{ + margin-right: 2px; + vertical-align: bottom; } \ No newline at end of file