task_21363 #1

Closed
francesco.mangiacrapa wants to merge 53 commits from task_21363 into master
3 changed files with 13 additions and 27 deletions
Showing only changes of commit 97fff2c428 - Show all commits

View File

@ -20,7 +20,7 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ShowMessage
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.ShowMessageEventHandler;
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.TableRangeViewChangedEvent;
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.TableRangeViewChangedEventHandler;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.CkanFramePanel;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.CkanInternalFramePanel;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.ContentModeratorToolbar;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.HomeView;
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.MainTabPanel;
@ -109,7 +109,7 @@ public class CkanContentModeratorWidgetController {
for (T t : items) {
CatalogueDataset clickedDataset = (CatalogueDataset) t;
CkanFramePanel cfp = new CkanFramePanel(eventBus);
CkanInternalFramePanel cfp = new CkanInternalFramePanel(eventBus);
cfp.instanceFrame(clickedDataset.getUrl());
mainTabPanel.addTab(clickedDataset.getTitle(), cfp);

View File

@ -21,16 +21,15 @@ import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.NamedFrame;
/**
* The Class CkanFramePanel.
* The Class CkanInternalFramePanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 23, 2021
* Feb 25, 2022
*/
public class CkanFramePanel extends FlowPanel{
public class CkanInternalFramePanel 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;
@ -41,23 +40,20 @@ public class CkanFramePanel extends FlowPanel{
*
* @param eventBus the event bus
*/
public CkanFramePanel(HandlerManager eventBus) {
public CkanInternalFramePanel(HandlerManager eventBus) {
this.eventBus = eventBus;
addLoading();
}
/**
* Prints the.
*
* @param msg the msg
*/
private static native void print(String msg)/*-{
console.log(msg);
console.log(msg);
}-*/;
/**
* Instance frame.
*
@ -65,34 +61,24 @@ public class CkanFramePanel extends FlowPanel{
* @return the frame
*/
public Frame instanceFrame(String datasetURL) {
GWT.log("Instancing new IFRAME with uri: "+datasetURL);
try{
if(frame != null)
remove(frame);
}catch(Exception e){
print("Error " + e);
}
GWT.log("Instancing new IFRAME with uri: " + datasetURL);
addLoading();
String urlEncoded = URL.encode(datasetURL);
GWT.log("Encoded url for instanciating frame is " + urlEncoded);
iFrameRandomName = Random.nextInt() + "dataset-iframe"+Random.nextInt();
iFrameRandomName = Random.nextInt() + "dataset-iframe" + Random.nextInt();
frame = new NamedFrame(iFrameRandomName);
frame.setUrl(urlEncoded);
frame.getElement().setId(iFrameRandomName);
frame.setWidth("100%");
frame.setHeight("580px");
// 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);
CkanInternalFramePanel.this.remove(loading);
eventBus.fireEvent(new IFrameInstanciedEvent(frame, OPERATION.ONLOAD));
}
});
@ -114,7 +100,7 @@ public class CkanFramePanel extends FlowPanel{
/**
* add loading image.
*/
private void addLoading(){
private void addLoading() {
this.add(loading);
loading.getElement().getStyle().setProperty("margin", "auto");
loading.getElement().getStyle().setDisplay(Display.BLOCK);

View File

@ -78,9 +78,9 @@ public class MainTabPanel extends Composite {
public Tab addTab(String heading, Widget w) {
final Tab tab = new Tab();
if (w instanceof CkanFramePanel) {
if (w instanceof CkanInternalFramePanel) {
tab.setCustomIconStyle("icon-rotate-right icon-spin");
CkanFramePanel ckanFramePanel = (CkanFramePanel) w;
CkanInternalFramePanel ckanFramePanel = (CkanInternalFramePanel) w;
ckanFramePanel.getFrame().addLoadHandler(new LoadHandler() {
@Override