reverted to gwt 2.7

This commit is contained in:
Francesco Mangiacrapa 2021-06-15 16:52:27 +02:00
parent cfa3484421
commit 2ea8dee474
5 changed files with 111 additions and 27 deletions

View File

@ -30,11 +30,11 @@
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.8.2</gwtVersion>
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<gwt-material.version>2.4.0</gwt-material.version>

View File

@ -3,31 +3,61 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorSystemPanel;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.view.client.ListDataProvider;
/**
* Entry point classes define <code>onModuleLoad()</code>.
* The Class CkanContentModeratorWidget.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
*/
public class CkanContentModeratorWidget {
public final CkanContentModeratorServiceAsync contentModeratorService = GWT.create(CkanContentModeratorService.class);
public final CkanContentModeratorServiceAsync contentModeratorService = GWT
.create(CkanContentModeratorService.class);
ItemsTable<CatalogueDataset> itemsTable;
private ItemsTable<CatalogueDataset> itemsTable;
private ContentModeratorSystemPanel cmsPanel = new ContentModeratorSystemPanel();
private Boolean isContentModeratorEnabled = null;
CkanContentModeratorWidget(DISPLAY_FIELD[] displayFields, DISPLAY_FIELD sortByField){
/**
* Instantiates a new ckan content moderator widget.
*
* @param displayFields the display fields
* @param sortByField the sort by field
*/
public CkanContentModeratorWidget(DISPLAY_FIELD[] displayFields, DISPLAY_FIELD sortByField) {
itemsTable = new ItemsTable<CatalogueDataset>(null, displayFields, sortByField);
itemsTable.initTable(null, null, new ListDataProvider<CatalogueDataset>());
cmsPanel.add(itemsTable.getCellTable());
}
/**
* Load items for status.
*
* @param status the status
* @throws Exception the exception
*/
public void loadItemsForStatus(ItemStatus status) throws Exception {
public void loadItemsForStatus(ItemStatus status){
if (isContentModeratorEnabled == null)
throw new Exception("Please, first check if the content moderator is enabled in this context");
if (!isContentModeratorEnabled)
throw new Exception("Content Moderator is not enabled in this context");
contentModeratorService.getListItemsForStatus(status, ContentModeratorWidgetConstants.ITEMS_PER_PAGE, ContentModeratorWidgetConstants.ITEM_START_INDEX, new AsyncCallback<List<CatalogueDataset>>() {
contentModeratorService.getListItemsForStatus(status, ContentModeratorWidgetConstants.ITEMS_PER_PAGE,
ContentModeratorWidgetConstants.ITEM_START_INDEX, new AsyncCallback<List<CatalogueDataset>>() {
@Override
public void onSuccess(List<CatalogueDataset> result) {
@ -43,4 +73,37 @@ public class CkanContentModeratorWidget {
});
}
/**
* Checks if is content moderator enabled.
*
* @param onCompletation the on completation
*/
public void isContentModeratorEnabled(final Command onCompletation) {
contentModeratorService.isContentModeratorEnabled(new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
onCompletation.execute();
}
@Override
public void onSuccess(Boolean result) {
isContentModeratorEnabled = result;
onCompletation.execute();
}
});
}
public ItemsTable<CatalogueDataset> getItemsTable() {
return itemsTable;
}
public ScrollPanel getPanel(){
return cmsPanel;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
import com.google.gwt.user.client.ui.ScrollPanel;
/**
* The Class ContentModeratorSystemPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
*/
public class ContentModeratorSystemPanel extends ScrollPanel {
public ContentModeratorSystemPanel(){
}
}

View File

@ -33,7 +33,7 @@ import com.google.gwt.user.client.ui.Label;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.ListDataProvider;
// TODO: Auto-generated Javadoc
/**
* The Class ItemsTable.
*

View File

@ -26,8 +26,9 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
@Override
public boolean isContentModeratorEnabled() {
// TODO Auto-generated method stub
return false;
LOG.info("called isContentModeratorEnabled");
LOG.warn("isContentModeratorEnabled METHOD MUST BE IMPLEMENTED!!!");
return true;
}
@Override