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
This commit is contained in:
Francesco Mangiacrapa 2015-11-06 14:18:06 +00:00
parent add1120bd3
commit bc05dbcbe9
9 changed files with 235 additions and 60 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/workspace-6.9.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/workspace-6.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -26,5 +26,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/workspace-6.9.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/workspace-6.10.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -8,7 +8,7 @@
<dependent-module archiveName="workspace-tree-widget-6.10.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-tree-widget-TRUNK/workspace-tree-widget-TRUNK">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="workspace-uploader-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-uploader-1.0.0-SNAPSHOT-TRUNK/workspace-uploader-1.0.0-SNAPSHOT-TRUNK">
<dependent-module archiveName="workspace-uploader-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-uploader-1.0.0-SNAPSHOT-TRUNK/workspace-uploader-1.0.0-SNAPSHOT-TRUNK">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -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);
}

View File

@ -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;

View File

@ -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<Widget, WorkspaceFeatures> {
UiBinder<Widget, WorkspaceFeaturesView> {
}
/**
* 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<AlertBase>() {
@Override
public void onClosed(ClosedEvent<AlertBase> 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 = "<span style=\"margin-right:5px\">"+Resources.getIconShareFolder().getSafeHtml().asString()+"</span>";
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.<br/>");
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 = "<span style=\"margin-right:5px\">"+Resources.getIconPublicLink().getSafeHtml().asString()+"</span>";
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);
}
}

View File

@ -2,22 +2,27 @@
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<g:FlowPanel>
<b:Alert close="false" animation="false">
<b:Alert animation="false" ui:field="alert_ws_features">
<g:HorizontalPanel ui:field="hp_feautures" width="100%">
<g:FlowPanel ui:field="fp1">
<b:Label ui:field="ws_quote" type="INFO"></b:Label>
<g:HorizontalPanel ui:field="info_features">
<g:Label ui:field="how_to">How-to</g:Label>
</g:HorizontalPanel>
</g:FlowPanel>
<g:FlowPanel ui:field="fp2">
</g:FlowPanel>
<g:FlowPanel ui:field="fp3">
<g:HorizontalPanel ui:field="ws_features" verticalAlignment="middle">
<g:Label ui:field="how_to">How-to:</g:Label>
<g:HorizontalPanel ui:field="ws_features"
verticalAlignment="middle">
<b:Label ui:field="shf" text="Share"></b:Label>
<b:Label ui:field="plk" text="Public Link"></b:Label>
<b:Label ui:field="upl" text="Upload"></b:Label>
<!-- <b:Label ui:field="upa" text="Upload Archive"></b:Label> -->
<!-- <b:Label ui:field="upa" text="Upload Archive"></b:Label> -->
</g:HorizontalPanel>
</g:FlowPanel>
<g:FlowPanel ui:field="fp3">
<b:CheckBox checked="false" text="Do not show again"
ui:field="ck_features_show_again"></b:CheckBox>
</g:FlowPanel>
</g:HorizontalPanel>
</b:Alert>
</g:FlowPanel>

View File

@ -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<Widget, WorkspaceQuotesView> {
}
/**
* 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);
}
}

View File

@ -0,0 +1,9 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<g:FlowPanel>
<g:HorizontalPanel ui:field="hp_quotes" width="100%">
<b:Label ui:field="ws_quote" type="INFO"></b:Label>
</g:HorizontalPanel>
</g:FlowPanel>
</ui:UiBinder>

View File

@ -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;
}