task_21363 #1
|
@ -1,17 +1,9 @@
|
||||||
package org.gcube.portlets.widgets.ckancontentmoderator.client;
|
package org.gcube.portlets.widgets.ckancontentmoderator.client;
|
||||||
|
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ClickItemEvent;
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ClickItemEventHandler;
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorPaginatedView;
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorSystemBaseView;
|
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
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.event.shared.HandlerManager;
|
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,111 +15,53 @@ import com.google.gwt.user.client.ui.Composite;
|
||||||
*/
|
*/
|
||||||
public class CkanContentModeratorWidget {
|
public class CkanContentModeratorWidget {
|
||||||
|
|
||||||
public final static CkanContentModeratorServiceAsync contentModeratorService = GWT
|
CkanContentModeratorWidgetController cmsController;
|
||||||
.create(CkanContentModeratorService.class);
|
|
||||||
|
|
||||||
// private ItemsTable<CatalogueDataset> itemsTable;
|
|
||||||
private ContentModeratorSystemBaseView cmsPanel = new ContentModeratorSystemBaseView();
|
|
||||||
private Boolean isContentModeratorEnabled = null;
|
|
||||||
private ContentModeratorPaginatedView paginatedView;
|
|
||||||
public final static HandlerManager eventBus = new HandlerManager(null);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new ckan content moderator widget.
|
* Instantiates a new ckan content moderator widget.
|
||||||
*
|
*
|
||||||
|
* @param status the status
|
||||||
* @param displayFields the display fields
|
* @param displayFields the display fields
|
||||||
* @param sortByField the sort by field
|
* @param sortByField the sort by field
|
||||||
*/
|
*/
|
||||||
public CkanContentModeratorWidget(ItemStatus status, DISPLAY_FIELD[] displayFields, DISPLAY_FIELD sortByField) {
|
public CkanContentModeratorWidget(ItemStatus status, DISPLAY_FIELD[] displayFields, DISPLAY_FIELD sortByField) {
|
||||||
// itemsTable = new ItemsTable<CatalogueDataset>(null, displayFields, sortByField);
|
cmsController = new CkanContentModeratorWidgetController(status, displayFields, sortByField);
|
||||||
// itemsTable.initTable(null, null, new ListDataProvider<CatalogueDataset>());
|
|
||||||
// cmsPanel.add(itemsTable.getCellTable());
|
|
||||||
|
|
||||||
paginatedView = new ContentModeratorPaginatedView(eventBus, status, displayFields, sortByField);
|
|
||||||
//cmsPanel.addToTop(new LoadingPanel(new HTML("Loading...")));
|
|
||||||
cmsPanel.addToCenter(paginatedView.getCellPanel());
|
|
||||||
cmsPanel.addToBottom(paginatedView.getPagerPanel());
|
|
||||||
bindEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bindEvents() {
|
|
||||||
|
|
||||||
|
|
||||||
eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> void onClick(ClickItemEvent<T> clickItemEvent) {
|
|
||||||
|
|
||||||
if(clickItemEvent.getItem() instanceof CatalogueDataset) {
|
|
||||||
CatalogueDataset clickedDataset = (CatalogueDataset) clickItemEvent.getItem();
|
|
||||||
//Window.open(clickedDataset.getUrl(), null, "_blank");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
try {
|
||||||
// * Load items for status.
|
cmsController.checkContentModeratorConfiguration(null);
|
||||||
// *
|
} catch (Exception e) {
|
||||||
// * @param status the status
|
// TODO Auto-generated catch block
|
||||||
// * @throws Exception the exception
|
e.printStackTrace();
|
||||||
// */
|
}
|
||||||
// public void loadItemsForStatus(ItemStatus status) throws Exception {
|
}
|
||||||
//
|
|
||||||
// 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");
|
|
||||||
//
|
|
||||||
// cmsPanel.showLoading(true);
|
|
||||||
// contentModeratorService.getListItemsForStatus(status, ContentModeratorWidgetConstants.ITEMS_PER_PAGE,
|
|
||||||
// ContentModeratorWidgetConstants.ITEM_START_INDEX, new AsyncCallback<List<CatalogueDataset>>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(List<CatalogueDataset> result) {
|
|
||||||
// cmsPanel.showLoading(false);
|
|
||||||
// itemsTable.updateItems(result, true);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// cmsPanel.showLoading(false);
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is content moderator enabled.
|
* Checks if is content moderator enabled.
|
||||||
*
|
*
|
||||||
* @param onCompletation the on completation
|
* @return true, if is content moderator enabled
|
||||||
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public void isContentModeratorEnabled(final Command onCompletation) {
|
public boolean isContentModeratorEnabled() throws Exception {
|
||||||
|
return cmsController.isContentModeratorEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
contentModeratorService.isContentModeratorEnabled(new AsyncCallback<Boolean>() {
|
/**
|
||||||
|
* Check content moderator configuration.
|
||||||
@Override
|
*
|
||||||
public void onFailure(Throwable caught) {
|
* @param onSuccess the on success
|
||||||
onCompletation.execute();
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
}
|
public void checkContentModeratorConfiguration(final Command onSuccess) throws Exception {
|
||||||
|
cmsController.checkContentModeratorConfiguration(onSuccess);
|
||||||
@Override
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
isContentModeratorEnabled = result;
|
|
||||||
onCompletation.execute();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Composite getPanel(){
|
/**
|
||||||
return cmsPanel.getPanel();
|
* Gets the panel.
|
||||||
|
*
|
||||||
|
* @return the panel
|
||||||
|
*/
|
||||||
|
public Composite getPanel() {
|
||||||
|
return cmsController.getMainPanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client;
|
||||||
|
|
||||||
|
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ClickItemEvent;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ClickItemEventHandler;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.CkanFramePanel;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorPaginatedView;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorSystemBaseView;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.MainTabPanel;
|
||||||
|
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.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Anchor;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Frame;
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
|
/**
|
||||||
|
* The Class CkanContentModeratorWidget.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 15, 2021
|
||||||
|
*/
|
||||||
|
public class CkanContentModeratorWidgetController {
|
||||||
|
|
||||||
|
public final static CkanContentModeratorServiceAsync contentModeratorService = GWT
|
||||||
|
.create(CkanContentModeratorService.class);
|
||||||
|
|
||||||
|
// private ItemsTable<CatalogueDataset> itemsTable;
|
||||||
|
private ContentModeratorSystemBaseView cmsPanel = new ContentModeratorSystemBaseView();
|
||||||
|
private MainTabPanel mainTabPanel = new MainTabPanel();
|
||||||
|
private Boolean isContentModeratorEnabled = null;
|
||||||
|
private ContentModeratorPaginatedView paginatedView;
|
||||||
|
public final static HandlerManager eventBus = new HandlerManager(null);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new ckan content moderator widget.
|
||||||
|
*
|
||||||
|
* @param status the status
|
||||||
|
* @param displayFields the display fields
|
||||||
|
* @param sortByField the sort by field
|
||||||
|
*/
|
||||||
|
public CkanContentModeratorWidgetController(ItemStatus status, DISPLAY_FIELD[] displayFields,
|
||||||
|
DISPLAY_FIELD sortByField) {
|
||||||
|
// itemsTable = new ItemsTable<CatalogueDataset>(null, displayFields, sortByField);
|
||||||
|
// itemsTable.initTable(null, null, new ListDataProvider<CatalogueDataset>());
|
||||||
|
// cmsPanel.add(itemsTable.getCellTable());
|
||||||
|
|
||||||
|
paginatedView = new ContentModeratorPaginatedView(eventBus, status, displayFields, sortByField);
|
||||||
|
// cmsPanel.addToTop(new LoadingPanel(new HTML("Loading...")));
|
||||||
|
cmsPanel.addToCenter(paginatedView.getCellPanel());
|
||||||
|
cmsPanel.addToBottom(paginatedView.getPagerPanel());
|
||||||
|
mainTabPanel.addHomeWidget(cmsPanel.getPanel());
|
||||||
|
bindEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
|
private void bindEvents() {
|
||||||
|
|
||||||
|
eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> void onClick(ClickItemEvent<T> clickItemEvent) {
|
||||||
|
|
||||||
|
if (clickItemEvent.getItem() instanceof CatalogueDataset) {
|
||||||
|
CatalogueDataset clickedDataset = (CatalogueDataset) clickItemEvent.getItem();
|
||||||
|
CkanFramePanel cfp = new CkanFramePanel(eventBus);
|
||||||
|
cfp.instanceFrame(clickedDataset.getUrl(), null);
|
||||||
|
mainTabPanel.addTab(clickedDataset.getName(), cfp);
|
||||||
|
// Window.open(clickedDataset.getUrl(), null, "_blank");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is content moderator enabled.
|
||||||
|
*
|
||||||
|
* @return true, if is content moderator enabled
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public boolean isContentModeratorEnabled() throws Exception {
|
||||||
|
|
||||||
|
if (isContentModeratorEnabled == null)
|
||||||
|
throw new Exception("Please, first check if the content moderator is enabled in this context");
|
||||||
|
|
||||||
|
return isContentModeratorEnabled;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check content moderator configuration.
|
||||||
|
*
|
||||||
|
* @param whenDone the when done
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public void checkContentModeratorConfiguration(final Command whenDone) throws Exception {
|
||||||
|
|
||||||
|
contentModeratorService.isContentModeratorEnabled(new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
whenDone.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
isContentModeratorEnabled = result;
|
||||||
|
if(whenDone!=null)
|
||||||
|
whenDone.execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the main panel.
|
||||||
|
*
|
||||||
|
* @return the main panel
|
||||||
|
*/
|
||||||
|
public Composite getMainPanel() {
|
||||||
|
return mainTabPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.user.client.ui.Frame;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class NotifyLogoutEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 23, 2016
|
||||||
|
*/
|
||||||
|
public class IFrameInstanciedEvent extends GwtEvent<IFrameInstanciedEventHandler> {
|
||||||
|
public static Type<IFrameInstanciedEventHandler> TYPE = new Type<IFrameInstanciedEventHandler>();
|
||||||
|
private Frame iFrame;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new insert metadata event.
|
||||||
|
*/
|
||||||
|
public IFrameInstanciedEvent(Frame iFrame) {
|
||||||
|
this.iFrame = iFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<IFrameInstanciedEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(IFrameInstanciedEventHandler handler) {
|
||||||
|
handler.onNewInstance(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Frame getiFrame() {
|
||||||
|
return iFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface IFrameInstanciedEentHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 23, 2016
|
||||||
|
*/
|
||||||
|
public interface IFrameInstanciedEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On new instance.
|
||||||
|
*
|
||||||
|
* @param iFrameInstanciedEent the i frame instancied eent
|
||||||
|
*/
|
||||||
|
void onNewInstance(IFrameInstanciedEvent iFrameInstanciedEent);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,138 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.IFrameInstanciedEvent;
|
||||||
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.ContentModeratorWidgetResources;
|
||||||
|
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
import com.google.gwt.dom.client.Style.Display;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.event.dom.client.LoadEvent;
|
||||||
|
import com.google.gwt.event.dom.client.LoadHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.http.client.URL;
|
||||||
|
import com.google.gwt.user.client.Random;
|
||||||
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Frame;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.google.gwt.user.client.ui.NamedFrame;
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
|
/**
|
||||||
|
* The Class CkanFramePanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 9, 2016
|
||||||
|
*/
|
||||||
|
public class CkanFramePanel extends FlowPanel{
|
||||||
|
|
||||||
|
private NamedFrame frame;
|
||||||
|
//private static final String FRAME_NAME = "ckan-content-frame";
|
||||||
|
private HandlerManager eventBus;
|
||||||
|
private Image loading = new Image(ContentModeratorWidgetResources.ICONS.loading());
|
||||||
|
private String messageToSend;
|
||||||
|
private String iFrameRandomName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new ckan frame panel.
|
||||||
|
*
|
||||||
|
* @param eventBus the event bus
|
||||||
|
*/
|
||||||
|
public CkanFramePanel(HandlerManager eventBus) {
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
addLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post message.
|
||||||
|
*
|
||||||
|
* @param msg the msg (as json)
|
||||||
|
* @param frameName the frame name
|
||||||
|
*/
|
||||||
|
protected native void sendMessage(String msg, String frameName) /*-{
|
||||||
|
console.log("Sending message " + msg);
|
||||||
|
// $wnd.parent.postMessage(msg,'*');
|
||||||
|
//var f = $wnd.frames[frameName];
|
||||||
|
//console.log(f);
|
||||||
|
//f.contentWindow.postMessage(msg, "*");
|
||||||
|
$wnd.frames[frameName].postMessage(msg,"*")
|
||||||
|
console.log("Message sent");
|
||||||
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the.
|
||||||
|
*
|
||||||
|
* @param msg the msg
|
||||||
|
*/
|
||||||
|
private static native void print(String msg)/*-{
|
||||||
|
console.log(msg);
|
||||||
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance frame.
|
||||||
|
*
|
||||||
|
* @param datasetURL the dataset URL
|
||||||
|
* @param messageToSend the message to send
|
||||||
|
* @return the frame
|
||||||
|
*/
|
||||||
|
public Frame instanceFrame(String datasetURL, final String messageToSend) {
|
||||||
|
GWT.log("Instancing new IFRAME with uri: "+datasetURL);
|
||||||
|
try{
|
||||||
|
if(frame != null)
|
||||||
|
remove(frame);
|
||||||
|
}catch(Exception e){
|
||||||
|
print("Error " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
addLoading();
|
||||||
|
String urlEncoded = URL.encode(datasetURL);
|
||||||
|
GWT.log("Encoded url for instanciating frame is " + urlEncoded);
|
||||||
|
iFrameRandomName = Random.nextInt() + "dataset-iframe"+Random.nextInt();
|
||||||
|
frame = new NamedFrame(iFrameRandomName);
|
||||||
|
frame.setUrl(urlEncoded);
|
||||||
|
|
||||||
|
frame.getElement().setId(iFrameRandomName);
|
||||||
|
frame.setWidth("100%");
|
||||||
|
frame.setHeight("500px");
|
||||||
|
// frame.setHeight("100%");
|
||||||
|
// frame.getElement().getStyle().setOverflow(Overflow.HIDDEN);
|
||||||
|
// frame.getElement().setAttribute("scrolling", "no");
|
||||||
|
frame.getElement().getStyle().setBorderWidth(0, Unit.PX);
|
||||||
|
frame.addLoadHandler(new LoadHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad(LoadEvent arg0) {
|
||||||
|
|
||||||
|
CkanFramePanel.this.remove(loading);
|
||||||
|
if(messageToSend!=null)
|
||||||
|
sendMessage(messageToSend, iFrameRandomName);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(frame);
|
||||||
|
frame.setVisible(true);
|
||||||
|
eventBus.fireEvent(new IFrameInstanciedEvent(frame));
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the frame.
|
||||||
|
*
|
||||||
|
* @return the frame
|
||||||
|
*/
|
||||||
|
public Frame getFrame() {
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add loading image.
|
||||||
|
*/
|
||||||
|
private void addLoading(){
|
||||||
|
this.add(loading);
|
||||||
|
loading.getElement().getStyle().setProperty("margin", "auto");
|
||||||
|
loading.getElement().getStyle().setDisplay(Display.BLOCK);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidget;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidgetController;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWidgetConstants;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWidgetConstants;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable;
|
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.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
||||||
|
@ -215,7 +215,8 @@ public class ContentModeratorPaginatedView {
|
||||||
|
|
||||||
GWT.log("calling getDataForStatus with parameters [startIndex: " + offset + ", limit: " + limit
|
GWT.log("calling getDataForStatus with parameters [startIndex: " + offset + ", limit: " + limit
|
||||||
+ ", serverIndex:" + serverIndex + "]");
|
+ ", serverIndex:" + serverIndex + "]");
|
||||||
CkanContentModeratorWidget.contentModeratorService.getDataForStatus(status, offset, limit, serverIndex,
|
|
||||||
|
CkanContentModeratorWidgetController.contentModeratorService.getDataForStatus(status, offset, limit, serverIndex,
|
||||||
new AsyncCallback<SearchedData>() {
|
new AsyncCallback<SearchedData>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.core.client.Scheduler;
|
||||||
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
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.Widget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class MainTabPanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 18, 2021
|
||||||
|
*/
|
||||||
|
public class MainTabPanel extends Composite {
|
||||||
|
|
||||||
|
private static MainTabPanelUiBinder uiBinder = GWT.create(MainTabPanelUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface MainTabPanelUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Jun 18, 2021
|
||||||
|
*/
|
||||||
|
interface MainTabPanelUiBinder extends UiBinder<Widget, MainTabPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Tab> results = new ArrayList<Tab>();
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TabPanel mainTabPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Tab homeTab;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new main tab panel.
|
||||||
|
*/
|
||||||
|
public MainTabPanel() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
results.add(homeTab);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the home widget.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
*/
|
||||||
|
public void addHomeWidget(Widget w) {
|
||||||
|
homeTab.add(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the tab.
|
||||||
|
*
|
||||||
|
* @param heading the heading
|
||||||
|
* @param w the w
|
||||||
|
* @return the tab
|
||||||
|
*/
|
||||||
|
public Tab addTab(String heading, Widget w){
|
||||||
|
Tab tab = new Tab();
|
||||||
|
tab.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tab.setHeading(heading);
|
||||||
|
if(w!=null)
|
||||||
|
tab.add(w);
|
||||||
|
|
||||||
|
results.add(tab);
|
||||||
|
mainTabPanel.add(tab);
|
||||||
|
activeTabPanels(false);
|
||||||
|
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
mainTabPanel.selectTab(results.size()-1); //+1 because the first tab is "Home"
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active tab panels.
|
||||||
|
*
|
||||||
|
* @param bool the bool
|
||||||
|
*/
|
||||||
|
private void activeTabPanels(boolean bool) {
|
||||||
|
for (Tab tab : results) {
|
||||||
|
tab.setActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count tab.
|
||||||
|
*
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
public int countTab() {
|
||||||
|
|
||||||
|
return results.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!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">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:TabPanel tabPosition="above" ui:field="mainTabPanel">
|
||||||
|
<b:Tab icon="HOME" heading="Home" active="true" ui:field="homeTab">
|
||||||
|
</b:Tab>
|
||||||
|
</b:TabPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
Loading…
Reference in New Issue