2015-10-30 18:13:02 +01:00
/ * *
2016-06-01 14:54:58 +02:00
*
2015-10-30 18:13:02 +01:00
* /
package org.gcube.portlets.user.workspace.client.view ;
2015-11-06 15:18:06 +01:00
import org.gcube.portlets.user.workspace.client.AppController ;
2017-04-12 18:16:47 +02:00
import org.gcube.portlets.user.workspace.client.ConstantsExplorer ;
2015-11-06 15:18:06 +01:00
import org.gcube.portlets.user.workspace.client.ConstantsPortlet ;
2015-11-03 16:36:20 +01:00
import org.gcube.portlets.user.workspace.client.resources.Resources ;
2019-09-18 12:39:40 +02:00
import org.gcube.portlets.user.workspace.client.resources.WsPortletResources ;
2015-11-03 16:36:20 +01:00
2015-11-06 15:18:06 +01:00
import com.github.gwtbootstrap.client.ui.Alert ;
2015-11-06 17:04:27 +01:00
import com.github.gwtbootstrap.client.ui.Button ;
2015-11-06 15:18:06 +01:00
import com.github.gwtbootstrap.client.ui.CheckBox ;
2015-10-30 18:13:02 +01:00
import com.github.gwtbootstrap.client.ui.Label ;
import com.github.gwtbootstrap.client.ui.Popover ;
2015-11-06 15:18:06 +01:00
import com.github.gwtbootstrap.client.ui.base.AlertBase ;
2015-10-30 18:13:02 +01:00
import com.github.gwtbootstrap.client.ui.constants.Placement ;
import com.github.gwtbootstrap.client.ui.constants.Trigger ;
2015-11-06 15:18:06 +01:00
import com.github.gwtbootstrap.client.ui.event.ClosedEvent ;
import com.github.gwtbootstrap.client.ui.event.ClosedHandler ;
2015-10-30 18:13:02 +01:00
import com.google.gwt.core.client.GWT ;
2015-11-06 17:04:27 +01:00
import com.google.gwt.event.dom.client.ClickEvent ;
import com.google.gwt.event.dom.client.ClickHandler ;
2015-10-30 18:13:02 +01:00
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 ;
2015-11-06 15:18:06 +01:00
import com.google.gwt.user.client.ui.HasHorizontalAlignment ;
2015-11-03 16:36:20 +01:00
import com.google.gwt.user.client.ui.HasVerticalAlignment ;
2015-10-30 18:13:02 +01:00
import com.google.gwt.user.client.ui.HorizontalPanel ;
2015-11-06 15:18:06 +01:00
import com.google.gwt.user.client.ui.Image ;
2015-10-30 18:13:02 +01:00
import com.google.gwt.user.client.ui.Widget ;
2015-11-06 15:18:06 +01:00
2015-10-30 18:13:02 +01:00
/ * *
2015-11-06 15:18:06 +01:00
* The Class WorkspaceFeaturesView .
2015-10-30 18:13:02 +01:00
*
2019-02-22 14:40:30 +01:00
* @author Francesco Mangiacrapa francesco . mangiacrapa { @literal @ } isti . cnr . it
2017-04-12 18:16:47 +02:00
* @author Massimiliano Assante , CNR - ISTI
2015-10-30 18:13:02 +01:00
* /
2015-11-06 15:18:06 +01:00
public class WorkspaceFeaturesView extends Composite {
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
@UiField
Alert alert_ws_features ;
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
@UiField
2015-11-03 16:36:20 +01:00
HorizontalPanel ws_features ;
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
@UiField
HorizontalPanel hp_feautures ;
2016-06-01 14:54:58 +02:00
2015-11-02 18:53:30 +01:00
@UiField
2015-11-06 15:18:06 +01:00
HorizontalPanel info_features ;
2016-06-01 14:54:58 +02:00
2015-11-02 18:53:30 +01:00
@UiField
2015-11-06 15:18:06 +01:00
com . google . gwt . user . client . ui . Label how_to ;
2016-06-01 14:54:58 +02:00
2017-04-12 18:16:47 +02:00
@UiField Label shf ; //Share Folders & Files
2016-06-01 14:54:58 +02:00
2015-11-03 16:36:20 +01:00
private Popover overShF = new Popover ( ) ;
2016-06-01 14:54:58 +02:00
2017-04-12 18:16:47 +02:00
@UiField Label upl ; //UPLOAD
2016-06-01 14:54:58 +02:00
2015-11-03 16:36:20 +01:00
private Popover overUpload = new Popover ( ) ;
2016-06-01 14:54:58 +02:00
2017-04-12 18:16:47 +02:00
@UiField Label plk ; //PUBLIC LINK
2015-11-03 16:36:20 +01:00
2015-11-02 18:53:30 +01:00
private Popover overPlk = new Popover ( ) ;
2016-06-01 14:54:58 +02:00
2017-04-12 18:16:47 +02:00
@UiField Label flk ; //FOLDER PUBLIC LINK
2016-09-14 12:20:44 +02:00
private Popover overFolderlk = new Popover ( ) ;
2016-06-01 14:54:58 +02:00
2017-04-12 18:16:47 +02:00
@UiField Label versioning ; //VERSIONING
private Popover overversioninglk = new Popover ( ) ;
2015-10-30 18:13:02 +01:00
@UiField
FlowPanel fp1 ;
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
@UiField
FlowPanel fp2 ;
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
@UiField
FlowPanel fp3 ;
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
@UiField
CheckBox ck_features_show_again ;
2016-06-01 14:54:58 +02:00
2015-11-06 17:04:27 +01:00
@UiField
Button btn_hide_ws_feautures_panel ;
2015-10-30 18:13:02 +01:00
private static WorkspaceFeaturesUiBinder uiBinder = GWT . create ( WorkspaceFeaturesUiBinder . class ) ;
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
/ * *
2015-11-06 15:18:06 +01:00
* The Interface WorkspaceFeaturesUiBinder .
2015-10-30 18:13:02 +01:00
*
2019-02-22 14:40:30 +01:00
* @author Francesco Mangiacrapa francesco . mangiacrapa { @literal @ } isti . cnr . it
2015-11-06 15:18:06 +01:00
* Nov 6 , 2015
2015-10-30 18:13:02 +01:00
* /
interface WorkspaceFeaturesUiBinder extends
2015-11-06 15:18:06 +01:00
UiBinder < Widget , WorkspaceFeaturesView > {
2015-10-30 18:13:02 +01:00
}
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
/ * *
2015-11-06 15:18:06 +01:00
* Instantiates a new workspace features view .
2015-10-30 18:13:02 +01:00
* /
2015-11-06 15:18:06 +01:00
public WorkspaceFeaturesView ( ) {
2015-10-30 18:13:02 +01:00
initWidget ( uiBinder . createAndBindUi ( this ) ) ;
2015-11-06 15:18:06 +01:00
alert_ws_features . addStyleName ( " alert_ws_features " ) ;
2015-11-03 16:36:20 +01:00
hp_feautures . setVerticalAlignment ( HasVerticalAlignment . ALIGN_MIDDLE ) ;
ws_features . setVerticalAlignment ( HasVerticalAlignment . ALIGN_MIDDLE ) ;
2015-10-30 18:13:02 +01:00
hp_feautures . setCellWidth ( fp1 , " 33% " ) ;
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
Image info = Resources . getIconInformation ( ) . createImage ( ) ;
info . setTitle ( " Workspace available features " ) ;
info_features . insert ( info , 0 ) ;
info_features . setCellVerticalAlignment ( how_to , HasVerticalAlignment . ALIGN_MIDDLE ) ;
2015-11-06 15:23:41 +01:00
how_to . addStyleName ( " margin-left-5 " ) ;
2015-11-06 15:18:06 +01:00
hp_feautures . setCellVerticalAlignment ( fp1 , HasVerticalAlignment . ALIGN_MIDDLE ) ;
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
hp_feautures . setCellWidth ( fp2 , " 33% " ) ;
2015-11-06 15:18:06 +01:00
hp_feautures . setCellHorizontalAlignment ( fp2 , HasHorizontalAlignment . ALIGN_CENTER ) ;
hp_feautures . setCellVerticalAlignment ( fp2 , HasVerticalAlignment . ALIGN_MIDDLE ) ;
2015-10-30 18:13:02 +01:00
hp_feautures . setCellWidth ( fp3 , " 33% " ) ;
2015-11-06 15:18:06 +01:00
hp_feautures . setCellHorizontalAlignment ( fp3 , HasHorizontalAlignment . ALIGN_RIGHT ) ;
hp_feautures . setCellVerticalAlignment ( fp3 , HasVerticalAlignment . ALIGN_MIDDLE ) ;
2016-06-01 14:54:58 +02:00
// ck_features_show_again.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
// ck_features_show_again.getElement().getFirstChildElement().setId("check_features_donotshowagain");
2015-11-06 17:04:27 +01:00
ck_features_show_again . addStyleName ( " margin-right-10 " ) ;
2015-11-03 16:36:20 +01:00
shf . addStyleName ( " margin-right-10 " ) ;
upl . addStyleName ( " margin-right-10 " ) ;
2016-09-14 12:20:44 +02:00
flk . addStyleName ( " margin-right-10 " ) ;
2015-11-03 16:36:20 +01:00
plk . addStyleName ( " margin-right-10 " ) ;
initPopupShareFeature ( ) ;
2016-09-14 12:20:44 +02:00
initPopupFlkFeature ( ) ;
2015-11-03 16:36:20 +01:00
initPopupUploadFeature ( ) ;
2015-11-02 18:53:30 +01:00
initPopupPlkFeature ( ) ;
2017-04-12 18:16:47 +02:00
initPopupVersioningFeature ( ) ;
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
alert_ws_features . addClosedHandler ( new ClosedHandler < AlertBase > ( ) {
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
@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 ) ;
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
}
} ) ;
2016-06-01 14:54:58 +02:00
2015-11-06 17:04:27 +01:00
btn_hide_ws_feautures_panel . addClickHandler ( new ClickHandler ( ) {
2016-06-01 14:54:58 +02:00
2015-11-06 17:04:27 +01:00
@Override
public void onClick ( ClickEvent 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 ) ;
WorkspaceFeaturesView . this . alert_ws_features . close ( ) ;
}
} ) ;
2015-11-03 16:36:20 +01:00
}
2016-06-01 14:54:58 +02:00
2017-04-12 18:16:47 +02:00
/ * *
* Inits the popup versioning feature .
* /
private void initPopupVersioningFeature ( ) {
overversioninglk . setAnimation ( false ) ;
overversioninglk . setWidget ( versioning ) ;
String icon = " <span style= \" margin-right:5px \" > " + Resources . getIconVersioning ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
2019-09-18 12:39:40 +02:00
overversioninglk . setHeading ( icon + " Workspace version control " ) ;
overversioninglk . setText ( " Workspace keeps track of any file version, transparently. <p>To see the other file versions, " +
2017-04-12 18:16:47 +02:00
" select a file, then right click on it and click \" " + ConstantsExplorer . FILE_VERSIONS + " \" .</p> " ) ;
overversioninglk . setHtml ( true ) ;
overversioninglk . setPlacement ( Placement . BOTTOM ) ;
overversioninglk . setTrigger ( Trigger . HOVER ) ;
overversioninglk . reconfigure ( ) ;
}
2016-09-14 12:20:44 +02:00
/ * *
*
* /
private void initPopupFlkFeature ( ) {
overFolderlk . setAnimation ( false ) ;
overFolderlk . setWidget ( flk ) ;
2019-09-18 12:39:40 +02:00
String icon = " <span style= \" margin-right:5px \" > " + Resources . getIconShareLink ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
overFolderlk . setHeading ( icon + " Workspace Share Link " ) ;
overFolderlk . setText ( WsPortletResources . INSTANCE . shareLinkkHowTo ( ) . getText ( ) ) ;
2016-09-14 12:20:44 +02:00
overFolderlk . setHtml ( true ) ;
overFolderlk . setPlacement ( Placement . BOTTOM ) ;
overFolderlk . setTrigger ( Trigger . HOVER ) ;
overFolderlk . reconfigure ( ) ;
}
2015-11-03 16:36:20 +01:00
/ * *
2015-11-06 15:18:06 +01:00
* Inits the popup share feature .
2015-11-03 16:36:20 +01:00
* /
private void initPopupShareFeature ( ) {
overShF . setAnimation ( false ) ;
overShF . setWidget ( shf ) ;
String icon = " <span style= \" margin-right:5px \" > " + Resources . getIconShareFolder ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
2019-09-18 12:39:40 +02:00
overShF . setHeading ( icon + " Workspace Share Folders and Files " ) ;
overShF . setText ( " 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' " ) ;
2015-11-03 16:36:20 +01:00
overShF . setHtml ( true ) ;
2015-11-06 15:18:06 +01:00
overShF . setPlacement ( Placement . BOTTOM ) ;
2015-11-03 16:36:20 +01:00
overShF . setTrigger ( Trigger . HOVER ) ;
overShF . reconfigure ( ) ;
2015-10-30 18:13:02 +01:00
}
/ * *
2015-11-06 15:18:06 +01:00
* Inits the popup upload feature .
2015-10-30 18:13:02 +01:00
* /
2015-11-03 16:36:20 +01:00
private void initPopupUploadFeature ( ) {
overUpload . setAnimation ( false ) ;
overUpload . setWidget ( upl ) ;
overUpload . setHeading ( " Workspace Upload Files and Archives " ) ;
String iconUploadDND = " <span style= \" margin-right:5px \" > " + Resources . getIconHand ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
String iconUploadFile = " <span style= \" margin-right:5px \" > " + Resources . getIconFileUpload ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
String iconUploadArchive = " <span style= \" margin-right:5px \" > " + Resources . getIconArchiveUpload ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
overUpload . setText ( " You can upload files in the Workspace in several ways:<br/> "
+ iconUploadDND + " 1 - Drop your files from Desktop;<br/> "
+ iconUploadFile + " 2 - Click 'Upload' and Browse Files;<br/> "
+ iconUploadArchive + " 3 - Upload a zip file to unzip directly its content in the Workspace.<br/> " ) ;
2016-06-01 14:54:58 +02:00
2015-11-03 16:36:20 +01:00
overUpload . setHtml ( true ) ;
2015-11-06 15:18:06 +01:00
overUpload . setPlacement ( Placement . BOTTOM ) ;
2015-11-03 16:36:20 +01:00
overUpload . setTrigger ( Trigger . HOVER ) ;
overUpload . reconfigure ( ) ;
2015-11-02 18:53:30 +01:00
}
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
/ * *
* Inits the popup plk feature .
* /
2015-11-02 18:53:30 +01:00
private void initPopupPlkFeature ( ) {
2015-11-03 16:36:20 +01:00
overPlk . setAnimation ( false ) ;
2015-11-02 18:53:30 +01:00
overPlk . setWidget ( plk ) ;
2015-11-03 16:36:20 +01:00
String icon = " <span style= \" margin-right:5px \" > " + Resources . getIconPublicLink ( ) . getSafeHtml ( ) . asString ( ) + " </span> " ;
2019-09-18 12:39:40 +02:00
overPlk . setHeading ( icon + " Workspace Public Link " ) ;
overPlk . setText ( WsPortletResources . INSTANCE . publicLinkHowTo ( ) . getText ( ) ) ;
2015-11-03 16:36:20 +01:00
overPlk . setHtml ( true ) ;
2015-11-06 15:18:06 +01:00
overPlk . setPlacement ( Placement . BOTTOM ) ;
2015-11-02 18:53:30 +01:00
overPlk . setTrigger ( Trigger . HOVER ) ;
overPlk . reconfigure ( ) ;
2015-10-30 18:13:02 +01:00
}
2016-06-01 14:54:58 +02:00
2015-11-06 15:18:06 +01:00
/ * ( non - Javadoc )
* @see com . google . gwt . user . client . ui . UIObject # setVisible ( boolean )
2015-10-30 18:13:02 +01:00
* /
2015-11-06 15:18:06 +01:00
public void setVisible ( boolean bool ) {
this . setVisible ( bool ) ;
2015-10-30 18:13:02 +01:00
}
2016-06-01 14:54:58 +02:00
2015-10-30 18:13:02 +01:00
}