2016-06-13 09:48:29 +02:00
/ * *
*
* /
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view ;
2022-05-18 16:40:15 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEvent ;
2024-02-19 13:07:50 +01:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.DeleteItemEvent ;
2016-06-22 16:23:51 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent ;
2016-06-13 09:48:29 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent ;
2019-12-09 12:33:01 +01:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.PublishOnZenodoEvent ;
2017-04-03 16:43:36 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEvent ;
2016-12-12 14:49:42 +01:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowDatasetsEvent ;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowGroupsEvent ;
2016-06-22 17:09:57 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowHomeEvent ;
2016-11-29 17:20:50 +01:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowManageProductWidgetEvent ;
2016-12-12 14:49:42 +01:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrganizationsEvent ;
2016-06-22 16:23:51 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent ;
2017-09-19 11:55:45 +02:00
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent ;
2016-06-13 09:48:29 +02:00
import com.github.gwtbootstrap.client.ui.Button ;
2024-02-19 13:07:50 +01:00
import com.github.gwtbootstrap.client.ui.DropdownButton ;
2023-03-02 16:52:59 +01:00
import com.github.gwtbootstrap.client.ui.Label ;
2024-02-19 13:07:50 +01:00
import com.github.gwtbootstrap.client.ui.NavLink ;
import com.github.gwtbootstrap.client.ui.Navbar ;
2016-06-13 09:48:29 +02:00
import com.github.gwtbootstrap.client.ui.constants.ButtonType ;
2016-06-22 16:23:51 +02:00
import com.github.gwtbootstrap.client.ui.constants.IconType ;
2024-02-05 17:30:15 +01:00
import com.google.gwt.core.client.GWT ;
2016-11-30 11:17:30 +01:00
import com.google.gwt.dom.client.Style.Float ;
2017-02-16 17:50:43 +01:00
import com.google.gwt.dom.client.Style.FontWeight ;
2016-06-13 09:48:29 +02:00
import com.google.gwt.dom.client.Style.Unit ;
import com.google.gwt.event.dom.client.ClickEvent ;
import com.google.gwt.event.dom.client.ClickHandler ;
import com.google.gwt.event.shared.HandlerManager ;
import com.google.gwt.user.client.ui.FlowPanel ;
2016-12-12 14:49:42 +01:00
import com.google.gwt.user.client.ui.InlineHTML ;
2016-06-13 09:48:29 +02:00
/ * *
* The Class CkanMetadataManagementPanel .
*
* @author Francesco Mangiacrapa francesco . mangiacrapa @isti.cnr.it
2021-10-05 11:10:13 +02:00
* @author Costantino Perciante costantino . perciante @isti.cnr.it Jun 9 , 2016
2022-05-18 16:40:15 +02:00
*
2016-06-13 09:48:29 +02:00
* /
2021-10-05 11:10:13 +02:00
public class CkanMetadataManagementPanel extends FlowPanel {
2016-06-13 09:48:29 +02:00
2023-03-02 16:52:59 +01:00
private static final String MESSAGE_MODERATED_CATALOGUE = " Moderation Enabled " ;
2023-01-27 16:35:35 +01:00
public static final String CATALOGUE_ITEMS_WERE_APPROVED_BY_CATALOGUE_MODERATOR_S = " Catalogue items were approved by Catalogue Moderator(s). " ;
2018-08-30 17:35:45 +02:00
private static final String MY_PREFIX = " My " ;
2022-05-18 16:40:15 +02:00
private static final String MANAGE_GRSF_ITEM_TOOLTIP = " By pushing on this button, you will be able to manage the item you are viewing. "
2017-02-16 17:50:43 +01:00
+ " Manageable items are the GRSF ones. " ;
2023-01-27 16:44:57 +01:00
private static final String MANAGE_CMS_ITEMS_TOOLTIP = " By pushing on this button, you will be able to manage (APPROVING or REJECTING) the item under approval. "
+ " Manageable items are not APPROVED and NOT PUBLISHED in the Catalogue. " ;
2022-05-18 16:40:15 +02:00
2024-02-19 13:07:50 +01:00
private Navbar nav = new Navbar ( ) ;
2016-12-12 14:49:42 +01:00
// generic
2016-06-22 17:09:57 +02:00
private Button home = new Button ( " Home " ) ;
2016-12-12 14:49:42 +01:00
private Button organizations = new Button ( " Organizations " ) ;
private Button groups = new Button ( " Groups " ) ;
2017-02-16 17:50:43 +01:00
private Button items = new Button ( " Items " ) ;
2017-09-19 11:55:45 +02:00
private Button types = new Button ( " Types " ) ;
2016-12-12 14:49:42 +01:00
// user's own
2024-02-23 15:30:05 +01:00
private InlineHTML pipe_MyInfo_start = null ;
private InlineHTML pipe_PublishItem_start = null ;
private InlineHTML pipe_SelectedItemOptions_start = null ;
2024-02-19 18:04:28 +01:00
private DropdownButton dropMyOptionButtons = new DropdownButton ( " My... " ) ;
2024-02-19 13:07:50 +01:00
private NavLink myDatasets = new NavLink ( " My Items " ) ;
private NavLink myOrganizations = new NavLink ( " My Organizations " ) ;
private NavLink myGroups = new NavLink ( " My Groups " ) ;
2016-12-12 14:49:42 +01:00
// statistics
2016-06-22 16:23:51 +02:00
private Button statistics = new Button ( " Statistics " ) ;
2016-12-12 14:49:42 +01:00
// other stuff
2017-04-04 16:31:21 +02:00
private Button shareLink = new Button ( " Share Link " ) ;
2020-01-21 17:12:29 +01:00
private Button uploadToZenodo = new Button ( " Upload to Zenodo " ) ;
2017-02-15 17:09:58 +01:00
private Button insertMeta = new Button ( " Publish Item " ) ;
2024-02-05 17:30:15 +01:00
private Button editMeta = new Button ( " Update Item " ) ;
2024-02-19 13:07:50 +01:00
private Button deleteItem = new Button ( " Delete Item " ) ;
2023-01-27 16:35:35 +01:00
private Button manageGRSFProduct = new Button ( " Manage GRSF Item " ) ; // GRSF Manage
private Button manageCModS = new Button ( " Manage Items " ) ; // Moderation
2023-03-02 16:52:59 +01:00
private Label messageModerationEnanbled = new Label ( ) ; // Moderation message
2023-01-27 16:35:35 +01:00
2016-06-13 09:48:29 +02:00
private HandlerManager eventBus ;
/ * *
* Instantiates a new ckan metadata management panel .
2018-08-30 17:35:45 +02:00
*
* @param eventBus the event bus
2016-06-13 09:48:29 +02:00
* /
2021-10-05 11:10:13 +02:00
public CkanMetadataManagementPanel ( HandlerManager eventBus ) {
2016-06-13 09:48:29 +02:00
this . eventBus = eventBus ;
2021-10-05 11:10:13 +02:00
// this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX);
// this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
2016-06-22 16:23:51 +02:00
// set link style buttons
2016-06-22 17:09:57 +02:00
home . setType ( ButtonType . LINK ) ;
2016-12-12 14:49:42 +01:00
organizations . setType ( ButtonType . LINK ) ;
groups . setType ( ButtonType . LINK ) ;
2017-02-16 17:50:43 +01:00
items . setType ( ButtonType . LINK ) ;
2017-09-19 11:55:45 +02:00
types . setType ( ButtonType . LINK ) ;
2017-04-11 16:04:27 +02:00
2016-12-12 14:49:42 +01:00
statistics . setType ( ButtonType . LINK ) ;
2017-04-11 16:04:27 +02:00
2017-04-04 16:31:21 +02:00
shareLink . setType ( ButtonType . LINK ) ;
2020-01-21 17:12:29 +01:00
uploadToZenodo . setType ( ButtonType . LINK ) ;
2016-06-13 09:48:29 +02:00
insertMeta . setType ( ButtonType . LINK ) ;
editMeta . setType ( ButtonType . LINK ) ;
2024-02-19 13:07:50 +01:00
deleteItem . setType ( ButtonType . LINK ) ;
2022-05-18 16:40:15 +02:00
manageGRSFProduct . setType ( ButtonType . PRIMARY ) ;
manageGRSFProduct . getElement ( ) . getStyle ( ) . setFloat ( Float . RIGHT ) ;
manageCModS . setType ( ButtonType . PRIMARY ) ;
manageCModS . getElement ( ) . getStyle ( ) . setFloat ( Float . RIGHT ) ;
manageCModS . getElement ( ) . getStyle ( ) . setMarginRight ( 20 , Unit . PX ) ;
2024-02-23 15:30:05 +01:00
2023-03-02 16:52:59 +01:00
messageModerationEnanbled . setTitle ( MESSAGE_MODERATED_CATALOGUE ) ;
messageModerationEnanbled . getElement ( ) . setInnerHTML ( " <i class='icon-user'></i> " + MESSAGE_MODERATED_CATALOGUE ) ;
messageModerationEnanbled . addStyleName ( " moderation-enabled-flag " ) ;
2016-06-22 16:23:51 +02:00
// set icons
2016-06-22 17:09:57 +02:00
home . setIcon ( IconType . HOME ) ;
2016-12-12 14:49:42 +01:00
organizations . setIcon ( IconType . BUILDING ) ;
groups . setIcon ( IconType . GROUP ) ;
2017-02-16 17:50:43 +01:00
items . setIcon ( IconType . SITEMAP ) ;
2017-09-19 11:55:45 +02:00
types . setIcon ( IconType . FILE_TEXT ) ;
2017-04-03 16:43:36 +02:00
shareLink . setIcon ( IconType . SHARE ) ;
2020-01-21 17:12:29 +01:00
uploadToZenodo . setIcon ( IconType . CIRCLE_ARROW_UP ) ;
2016-06-22 16:23:51 +02:00
myDatasets . setIcon ( IconType . SITEMAP ) ;
myOrganizations . setIcon ( IconType . BUILDING ) ;
2016-06-23 18:30:01 +02:00
myGroups . setIcon ( IconType . GROUP ) ;
2016-06-22 16:23:51 +02:00
insertMeta . setIcon ( IconType . FILE ) ;
editMeta . setIcon ( IconType . EDIT_SIGN ) ;
2024-02-19 13:07:50 +01:00
deleteItem . setIcon ( IconType . REMOVE_CIRCLE ) ;
2016-06-22 16:23:51 +02:00
statistics . setIcon ( IconType . BAR_CHART ) ;
2022-05-18 16:40:15 +02:00
manageGRSFProduct . setIcon ( IconType . CHECK_SIGN ) ;
manageCModS . setIcon ( IconType . CHECK_SIGN ) ;
2016-12-12 14:49:42 +01:00
2024-02-19 17:41:28 +01:00
// disabling share and upload
2017-04-04 16:31:21 +02:00
shareLink . setEnabled ( false ) ;
2020-01-21 17:12:29 +01:00
uploadToZenodo . setEnabled ( false ) ;
2024-02-23 15:30:05 +01:00
// hide upload to zenodo
uploadToZenodo . setVisible ( false ) ;
2024-02-19 17:41:28 +01:00
// hide publish/update/delete
editMeta . setVisible ( false ) ;
deleteItem . setVisible ( false ) ;
2016-06-22 16:23:51 +02:00
insertMeta . setVisible ( false ) ;
2024-02-23 15:30:05 +01:00
// hide manage GRSF product and Moderation
2022-05-18 16:40:15 +02:00
manageGRSFProduct . setVisible ( false ) ;
manageGRSFProduct . setEnabled ( false ) ;
manageCModS . setVisible ( false ) ;
manageCModS . setEnabled ( false ) ;
2023-01-27 16:35:35 +01:00
messageModerationEnanbled . setVisible ( false ) ;
2022-05-18 16:40:15 +02:00
// manage GRSF item info
manageGRSFProduct . setTitle ( MANAGE_GRSF_ITEM_TOOLTIP ) ;
manageGRSFProduct . getElement ( ) . getStyle ( ) . setFontWeight ( FontWeight . BOLD ) ;
2017-04-11 16:04:27 +02:00
2022-05-18 16:40:15 +02:00
// manage CMS item info
manageCModS . setTitle ( MANAGE_CMS_ITEMS_TOOLTIP ) ;
manageCModS . getElement ( ) . getStyle ( ) . setFontWeight ( FontWeight . BOLD ) ;
2016-06-22 16:23:51 +02:00
2023-01-27 16:35:35 +01:00
nav . add ( messageModerationEnanbled ) ;
2024-02-19 13:07:50 +01:00
2024-02-23 15:30:05 +01:00
nav . setId ( " the_catalogue_nav_bar " ) ;
2024-02-19 13:07:50 +01:00
nav . addStyleName ( " nav_bar_catalogue " ) ;
2016-06-22 16:23:51 +02:00
// add to navigation bar
2016-06-22 17:09:57 +02:00
nav . add ( home ) ;
2016-12-12 14:49:42 +01:00
nav . add ( organizations ) ;
nav . add ( groups ) ;
2017-02-16 17:50:43 +01:00
nav . add ( items ) ;
2017-09-19 11:55:45 +02:00
nav . add ( types ) ;
2016-12-12 14:49:42 +01:00
nav . add ( statistics ) ;
2024-02-23 15:30:05 +01:00
pipe_MyInfo_start = new InlineHTML (
2024-02-19 13:07:50 +01:00
" <span style= \" font-weight:bold;vertical-alignment:middle;margin:0 5px; \" >|</span> " ) ;
2024-02-23 15:30:05 +01:00
pipe_MyInfo_start . setVisible ( true ) ;
nav . add ( pipe_MyInfo_start ) ;
2024-02-19 13:07:50 +01:00
2024-02-19 18:04:28 +01:00
dropMyOptionButtons . setBaseIcon ( IconType . USER ) ;
dropMyOptionButtons . add ( myOrganizations ) ;
dropMyOptionButtons . add ( myGroups ) ;
dropMyOptionButtons . add ( myDatasets ) ;
dropMyOptionButtons . setType ( ButtonType . LINK ) ;
nav . add ( dropMyOptionButtons ) ;
2024-02-19 13:07:50 +01:00
2024-02-23 15:30:05 +01:00
pipe_PublishItem_start = new InlineHTML (
" <span style= \" font-weight:bold;vertical-alignment:middle;margin:0 5px; \" >|</span> " ) ;
pipe_PublishItem_start . setVisible ( false ) ;
nav . add ( pipe_PublishItem_start ) ;
2016-06-13 09:48:29 +02:00
nav . add ( insertMeta ) ;
2024-02-23 15:30:05 +01:00
pipe_SelectedItemOptions_start = new InlineHTML (
" <span style= \" font-weight:bold;vertical-alignment:middle;margin:0 5px; \" >|</span> " ) ;
pipe_SelectedItemOptions_start . setVisible ( true ) ;
nav . add ( pipe_SelectedItemOptions_start ) ;
2016-06-13 09:48:29 +02:00
nav . add ( editMeta ) ;
2024-02-19 13:07:50 +01:00
nav . add ( deleteItem ) ;
nav . add ( shareLink ) ;
nav . add ( uploadToZenodo ) ;
2022-05-18 16:40:15 +02:00
nav . add ( manageGRSFProduct ) ;
nav . add ( manageCModS ) ;
2024-02-23 15:30:05 +01:00
2016-06-13 09:48:29 +02:00
addHandlers ( ) ;
add ( nav ) ;
}
/ * *
2018-08-30 17:35:45 +02:00
* Adds the handlers .
2016-06-13 09:48:29 +02:00
* /
2018-08-30 15:19:49 +02:00
private void addHandlers ( ) {
2016-06-23 18:30:01 +02:00
2016-06-22 17:09:57 +02:00
home . addClickHandler ( new ClickHandler ( ) {
2016-06-23 18:30:01 +02:00
2016-06-22 17:09:57 +02:00
@Override
public void onClick ( ClickEvent event ) {
2016-06-23 18:30:01 +02:00
2016-06-22 17:09:57 +02:00
eventBus . fireEvent ( new ShowHomeEvent ( ) ) ;
2016-06-23 18:30:01 +02:00
2016-06-22 17:09:57 +02:00
}
} ) ;
2016-06-13 09:48:29 +02:00
2016-12-12 14:49:42 +01:00
organizations . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
eventBus . fireEvent ( new ShowOrganizationsEvent ( false ) ) ;
}
} ) ;
groups . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
eventBus . fireEvent ( new ShowGroupsEvent ( false ) ) ;
}
} ) ;
2017-02-16 17:50:43 +01:00
items . addClickHandler ( new ClickHandler ( ) {
2016-12-12 14:49:42 +01:00
@Override
public void onClick ( ClickEvent event ) {
eventBus . fireEvent ( new ShowDatasetsEvent ( false ) ) ;
}
} ) ;
2018-08-30 15:19:49 +02:00
2017-09-19 11:55:45 +02:00
types . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
eventBus . fireEvent ( new ShowTypesEvent ( false ) ) ;
}
} ) ;
2016-12-12 14:49:42 +01:00
2016-06-13 09:48:29 +02:00
insertMeta . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
eventBus . fireEvent ( new InsertMetadataEvent ( ) ) ;
}
} ) ;
editMeta . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
2024-02-19 13:07:50 +01:00
GWT . log ( " Edit Meta clicked " ) ;
eventBus . fireEvent (
new EditMetadataEvent ( GCubeCkanDataCatalogPanel . getLatestSelectedProductIdentifier ( ) ) ) ;
}
} ) ;
deleteItem . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
GWT . log ( " Delete item clicked " ) ;
eventBus . fireEvent ( new DeleteItemEvent ( GCubeCkanDataCatalogPanel . getLatestSelectedProductIdentifier ( ) ) ) ;
2016-06-22 16:23:51 +02:00
}
} ) ;
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
myDatasets . addClickHandler ( new ClickHandler ( ) {
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
@Override
public void onClick ( ClickEvent event ) {
2016-06-23 18:30:01 +02:00
2016-12-12 14:49:42 +01:00
eventBus . fireEvent ( new ShowDatasetsEvent ( true ) ) ;
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
}
} ) ;
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
myOrganizations . addClickHandler ( new ClickHandler ( ) {
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
@Override
public void onClick ( ClickEvent event ) {
2016-06-23 18:30:01 +02:00
2016-12-12 14:49:42 +01:00
eventBus . fireEvent ( new ShowOrganizationsEvent ( true ) ) ;
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
}
} ) ;
2016-06-23 18:30:01 +02:00
myGroups . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
2016-12-12 14:49:42 +01:00
eventBus . fireEvent ( new ShowGroupsEvent ( true ) ) ;
2016-06-23 18:30:01 +02:00
}
} ) ;
2016-06-22 16:23:51 +02:00
statistics . addClickHandler ( new ClickHandler ( ) {
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
@Override
public void onClick ( ClickEvent event ) {
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
eventBus . fireEvent ( new ShowStatisticsEvent ( ) ) ;
2016-06-23 18:30:01 +02:00
2016-06-13 09:48:29 +02:00
}
} ) ;
2022-05-18 16:40:15 +02:00
manageGRSFProduct . addClickHandler ( new ClickHandler ( ) {
2016-11-29 17:20:50 +01:00
@Override
public void onClick ( ClickEvent event ) {
2021-10-05 11:10:13 +02:00
eventBus . fireEvent ( new ShowManageProductWidgetEvent (
GCubeCkanDataCatalogPanel . getLatestSelectedProductIdentifier ( ) ) ) ;
2016-11-29 17:20:50 +01:00
}
} ) ;
2017-04-11 16:04:27 +02:00
2022-05-18 16:40:15 +02:00
manageCModS . addClickHandler ( new ClickHandler ( ) {
@Override
public void onClick ( ClickEvent event ) {
eventBus . fireEvent ( new ClickedCMSManageProductButtonEvent ( ) ) ;
}
} ) ;
2017-04-03 16:43:36 +02:00
shareLink . addClickHandler ( new ClickHandler ( ) {
2017-04-11 16:04:27 +02:00
2017-04-03 16:43:36 +02:00
@Override
public void onClick ( ClickEvent event ) {
2017-04-11 16:04:27 +02:00
2017-04-03 16:43:36 +02:00
eventBus . fireEvent ( new ShareLinkEvent ( GCubeCkanDataCatalogPanel . getLatestSelectedProductIdentifier ( ) ) ) ;
2017-04-11 16:04:27 +02:00
2017-04-03 16:43:36 +02:00
}
} ) ;
2021-10-05 11:10:13 +02:00
2020-01-21 17:12:29 +01:00
uploadToZenodo . addClickHandler ( new ClickHandler ( ) {
2021-10-05 11:10:13 +02:00
2019-12-09 12:03:51 +01:00
@Override
public void onClick ( ClickEvent event ) {
2021-10-05 11:10:13 +02:00
eventBus . fireEvent (
new PublishOnZenodoEvent ( GCubeCkanDataCatalogPanel . getLatestSelectedProductIdentifier ( ) ) ) ;
2019-12-09 12:03:51 +01:00
}
} ) ;
2016-06-13 09:48:29 +02:00
}
/ * *
* Gets the current height .
*
* @return the current height
* /
2021-10-05 11:10:13 +02:00
public int getCurrentHeight ( ) {
2016-06-13 09:48:29 +02:00
return this . getOffsetHeight ( ) ;
}
2016-06-23 18:30:01 +02:00
2016-06-22 16:23:51 +02:00
/ * *
2024-02-23 15:30:05 +01:00
* Enable publish button .
2018-08-30 17:35:45 +02:00
*
2024-02-23 15:30:05 +01:00
* @param enable the enable
2016-06-22 16:23:51 +02:00
* /
2024-02-23 15:30:05 +01:00
public void enablePublishItemButton ( boolean enable ) {
insertMeta . setEnabled ( enable ) ;
2016-06-22 16:23:51 +02:00
}
2016-06-29 18:35:01 +02:00
2016-11-29 17:20:50 +01:00
/ * *
2022-05-18 16:40:15 +02:00
* Button to manage the GRSF product . . for example in grsf case
2018-08-30 17:35:45 +02:00
*
2016-11-29 17:20:50 +01:00
* @param value true or false
* /
2022-05-18 16:40:15 +02:00
public void showManageGRSFProductButton ( boolean value ) {
manageGRSFProduct . setVisible ( value ) ;
2016-11-29 17:20:50 +01:00
}
2016-12-12 14:49:42 +01:00
2016-11-30 11:17:30 +01:00
/ * *
2018-08-30 17:35:45 +02:00
* Enable or disable the manage product button .
*
* @param value the value
2016-11-30 11:17:30 +01:00
* /
2022-05-18 16:40:15 +02:00
public void enableManageGRSFProductButton ( boolean value ) {
manageGRSFProduct . setEnabled ( value ) ;
}
/ * *
2023-01-27 16:35:35 +01:00
* Button to manage the products under moderation via Content Moderation System
2024-02-05 17:30:15 +01:00
* ( CMS ) .
2022-05-18 16:40:15 +02:00
*
* @param value true or false
* /
public void showManageCMSProductsButton ( boolean value ) {
manageCModS . setVisible ( value ) ;
}
2023-01-27 16:35:35 +01:00
/ * *
* Show message catalogue is moderated .
*
* @param isContentModerationEnabled the is content moderation enabled
* /
public void showMessageCatalogueIsModerated ( boolean isContentModerationEnabled ) {
messageModerationEnanbled . setVisible ( isContentModerationEnabled ) ;
}
2022-05-18 16:40:15 +02:00
/ * *
* Enable manage CMS products button .
*
* @param value the value
* /
public void enableManageCMSProductsButton ( boolean value ) {
manageCModS . setEnabled ( value ) ;
2016-11-30 11:17:30 +01:00
}
2017-04-11 16:04:27 +02:00
2017-04-03 16:43:36 +02:00
/ * *
2018-08-30 17:35:45 +02:00
* Enable or disable the share link button .
*
* @param value the value
2017-04-03 16:43:36 +02:00
* /
2021-10-05 11:10:13 +02:00
public void enableShareItemButton ( boolean value ) {
2017-04-03 16:43:36 +02:00
shareLink . setEnabled ( value ) ;
}
2016-12-12 14:49:42 +01:00
2019-12-09 12:33:01 +01:00
/ * *
* Enable publish on zenodo button .
*
* @param value the value
* /
2021-10-05 11:10:13 +02:00
public void enablePublishOnZenodoButton ( boolean value ) {
2020-01-21 17:12:29 +01:00
uploadToZenodo . setEnabled ( value ) ;
2019-12-09 12:33:01 +01:00
}
2023-01-27 16:35:35 +01:00
2024-02-05 17:30:15 +01:00
/ * *
* Enable edit item button .
*
* @param value the value
* /
public void enableEditItemButton ( boolean value ) {
editMeta . setEnabled ( value ) ;
}
2024-02-19 13:07:50 +01:00
/ * *
* Enable delete item button .
*
* @param value the value
* /
public void enableDeleteItemButton ( boolean value ) {
deleteItem . setEnabled ( value ) ;
}
2021-10-05 11:10:13 +02:00
/ * *
* Visibility publish on zenodo button .
*
* @param value the value
* /
public void visibilityPublishOnZenodoButton ( boolean value ) {
uploadToZenodo . setVisible ( value ) ;
}
2024-02-05 17:30:15 +01:00
2024-02-23 15:30:05 +01:00
/ * *
* Visibility publish item button .
*
* @param value the value
* @param alsoThePipe the also the pipe . If true set bool value also the related
* pipe ' pipe_PublishItem_start '
* /
public void visibilityPublishItemButton ( boolean bool , boolean alsoThePipe ) {
insertMeta . setVisible ( bool ) ;
if ( alsoThePipe ) {
pipe_PublishItem_start . setVisible ( bool ) ;
}
}
2024-02-05 17:30:15 +01:00
/ * *
* Visibility edit item button .
*
* @param value the value
* /
public void visibilityEditItemButton ( boolean value ) {
editMeta . setVisible ( value ) ;
}
2019-12-09 12:33:01 +01:00
2024-02-19 13:07:50 +01:00
/ * *
* Visibility delete item button .
*
* @param value the value
* /
public void visibilityDeleteItemButton ( boolean value ) {
deleteItem . setVisible ( value ) ;
}
2016-06-29 18:35:01 +02:00
/ * *
2018-08-30 17:35:45 +02:00
* Show only home / statistics buttons .
2016-06-29 18:35:01 +02:00
* /
2021-10-05 11:10:13 +02:00
public void doNotShowUserRelatedInfo ( ) {
2016-06-29 18:35:01 +02:00
2024-02-23 15:30:05 +01:00
pipe_MyInfo_start . setVisible ( false ) ;
pipe_PublishItem_start . setVisible ( false ) ;
pipe_SelectedItemOptions_start . setVisible ( false ) ;
2017-04-11 16:04:27 +02:00
shareLink . setVisible ( false ) ;
2020-01-21 17:12:29 +01:00
uploadToZenodo . setVisible ( false ) ;
2016-06-29 18:35:01 +02:00
insertMeta . setVisible ( false ) ;
editMeta . setVisible ( false ) ;
2024-02-19 13:07:50 +01:00
deleteItem . setVisible ( false ) ;
2024-02-19 18:04:28 +01:00
dropMyOptionButtons . setVisible ( false ) ;
// myDatasets.setVisible(false);
// myOrganizations.setVisible(false);
// myGroups.setVisible(false);
2022-05-18 16:40:15 +02:00
manageGRSFProduct . setVisible ( false ) ;
manageCModS . setVisible ( false ) ;
2016-06-29 18:35:01 +02:00
}
2017-11-28 14:41:53 +01:00
2018-08-30 17:35:45 +02:00
/ * *
* Removes the generic management buttons .
* /
2017-11-28 14:41:53 +01:00
public void removeGenericManagementButtons ( ) {
2017-11-30 17:00:49 +01:00
home . setVisible ( true ) ;
2017-11-28 14:41:53 +01:00
organizations . setVisible ( false ) ;
groups . setVisible ( false ) ;
items . setVisible ( false ) ;
types . setVisible ( false ) ;
2024-02-23 15:30:05 +01:00
pipe_MyInfo_start . setVisible ( false ) ;
pipe_PublishItem_start . setVisible ( false ) ;
2024-02-19 18:04:28 +01:00
dropMyOptionButtons . setVisible ( false ) ;
// myDatasets.setVisible(false);
// myOrganizations.setVisible(false);
// myGroups.setVisible(false);
2017-11-28 14:41:53 +01:00
statistics . setVisible ( false ) ;
2022-05-18 16:40:15 +02:00
manageGRSFProduct . setVisible ( false ) ;
manageCModS . setVisible ( false ) ;
2018-08-30 15:19:49 +02:00
}
/ * *
* Customize label according translate .
*
2021-10-05 11:10:13 +02:00
* @param labelName the label name
2018-08-30 15:19:49 +02:00
* @param translateValue the translate value
* /
2021-10-05 11:10:13 +02:00
public void customizeLabelAccordingTranslate ( String labelName , String translateValue ) {
2018-08-30 15:19:49 +02:00
2021-10-05 11:10:13 +02:00
if ( labelName = = null | | labelName . isEmpty ( ) | | translateValue = = null | | translateValue . isEmpty ( ) )
2018-08-30 15:19:49 +02:00
return ;
2018-08-30 17:35:45 +02:00
// GWT.log("labelName "+labelName);
// GWT.log("translateValue "+translateValue);
// GWT.log("organizations "+organizations.getText());
2021-10-05 11:10:13 +02:00
if ( labelName . compareToIgnoreCase ( organizations . getText ( ) . trim ( ) ) = = 0 ) {
2018-08-30 15:19:49 +02:00
organizations . setText ( translateValue ) ;
2021-10-05 11:10:13 +02:00
// return;
} else if ( labelName . compareToIgnoreCase ( groups . getText ( ) . trim ( ) ) = = 0 ) {
2018-08-30 15:19:49 +02:00
groups . setText ( translateValue ) ;
2021-10-05 11:10:13 +02:00
// return;
} else if ( labelName . compareToIgnoreCase ( items . getText ( ) . trim ( ) ) = = 0 ) {
2018-08-30 15:19:49 +02:00
items . setText ( translateValue ) ;
2021-10-05 11:10:13 +02:00
// return;
} else if ( labelName . compareToIgnoreCase ( types . getText ( ) . trim ( ) ) = = 0 ) {
2018-08-30 15:19:49 +02:00
types . setText ( translateValue ) ;
2021-10-05 11:10:13 +02:00
// return;
2018-08-30 17:35:45 +02:00
}
2021-10-05 11:10:13 +02:00
String mylabelName = MY_PREFIX + labelName ;
2018-08-30 17:35:45 +02:00
// GWT.log("mylabelName "+mylabelName);
// GWT.log("myDatasets.getText() "+myDatasets.getText());
2021-10-05 11:10:13 +02:00
if ( mylabelName . compareToIgnoreCase ( myDatasets . getText ( ) . trim ( ) ) = = 0 ) {
myDatasets . setText ( MY_PREFIX + translateValue ) ;
// return;
} else if ( mylabelName . compareToIgnoreCase ( myOrganizations . getText ( ) . trim ( ) ) = = 0 ) {
myOrganizations . setText ( MY_PREFIX + translateValue ) ;
// return;
} else if ( mylabelName . compareToIgnoreCase ( myGroups . getText ( ) . trim ( ) ) = = 0 ) {
myGroups . setText ( MY_PREFIX + translateValue ) ;
// return;
2018-08-30 15:19:49 +02:00
}
2017-11-28 14:41:53 +01:00
}
2018-08-30 17:35:45 +02:00
/ * *
* Capitalize .
*
* @param stringValue the translate value
* @return the string
* /
2021-10-05 11:10:13 +02:00
public static String capitalize ( String stringValue ) {
return stringValue . substring ( 0 , 1 ) . toUpperCase ( ) + stringValue . substring ( 1 , stringValue . length ( ) ) ;
2018-08-30 17:35:45 +02:00
}
2016-06-13 09:48:29 +02:00
}