Added set height for iFrame in order to have only internal scroll
Disabled Window scroll git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@130449 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
60f784cd04
commit
420ee338f4
|
@ -21,6 +21,8 @@
|
|||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
|
||||
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
|
|||
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.CKanLeaveFrame;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel;
|
||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -30,6 +29,7 @@ public class GCubeCkanDataCatalog implements EntryPoint {
|
|||
private CKanLeaveFrame frame;
|
||||
public static final String GET_PATH_PARAMETER = "path";
|
||||
public static final String GET_QUERY_PARAMETER = "query";
|
||||
public static final String GCUBE_CKAN_IFRAME = "gcube-ckan-iframe";
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
|
||||
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.IFrameInstanciedEvent;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
|
@ -61,24 +62,15 @@ public class CkanFramePanel extends FlowPanel{
|
|||
}
|
||||
|
||||
frame = new Frame(ckanUrlConnector);
|
||||
frame.getElement().setId(GCubeCkanDataCatalog.GCUBE_CKAN_IFRAME);
|
||||
frame.setWidth("100%");
|
||||
// frame.getElement().getStyle().setOverflow(Overflow.HIDDEN);
|
||||
// frame.getElement().setAttribute("scrolling", "no");
|
||||
frame.getElement().getStyle().setBorderWidth(0, Unit.PX);
|
||||
// frame.getElement().setPropertyString("frameBorder", "0");
|
||||
frame.addLoadHandler(new LoadHandler() {
|
||||
|
||||
@Override
|
||||
public void onLoad(LoadEvent arg0) {
|
||||
|
||||
/*NodeList<Element> listHeaders = Document.get().getElementsByTagName("header");
|
||||
|
||||
if(listHeaders!=null){
|
||||
GWT.log("List Header by tag name is/are: "+listHeaders.getLength() +", hidden..");
|
||||
for (int i = 0; i < listHeaders.getLength(); i++) {
|
||||
Element header = listHeaders.getItem(i);
|
||||
header.getStyle().setVisibility(Visibility.HIDDEN);
|
||||
}
|
||||
}else
|
||||
GWT.log("List Header by tag name is null");*/
|
||||
|
||||
}
|
||||
});
|
||||
add(frame);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -23,14 +24,12 @@ import com.google.gwt.user.client.ui.RootPanel;
|
|||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
|
||||
/**
|
||||
* The Class GCubeCkanDataCatalogPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jun 9, 2016
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 9, 2016
|
||||
*/
|
||||
public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
||||
public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||
|
||||
private CkanMetadataManagementPanel managementPanel;
|
||||
private ScrollPanel centerScrollable = new ScrollPanel();
|
||||
|
@ -40,14 +39,19 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
private RootPanel rootPanel;
|
||||
private HandlerManager eventBus;
|
||||
private CkanConnectorAccessPoint ckanAccessPoint;
|
||||
public static final int IFRAME_FIX_HEIGHT = 1800;
|
||||
|
||||
/**
|
||||
* Instantiates a new g cube ckan data catalog panel.
|
||||
*
|
||||
* @param rootPanel the root panel
|
||||
* @param eventManager the event manager
|
||||
* @param rootPanel
|
||||
* the root panel
|
||||
* @param eventManager
|
||||
* the event manager
|
||||
*/
|
||||
public GCubeCkanDataCatalogPanel(RootPanel rootPanel, HandlerManager eventManager){
|
||||
public GCubeCkanDataCatalogPanel(
|
||||
RootPanel rootPanel, HandlerManager eventManager) {
|
||||
|
||||
this.rootPanel = rootPanel;
|
||||
this.eventBus = eventManager;
|
||||
ckanFramePanel = new CkanFramePanel(eventBus);
|
||||
|
@ -55,61 +59,64 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
ckanOrganizationsPanel = new CkanOrganizationsPanel(this);
|
||||
initPanel();
|
||||
setTopPanelVisible(true);
|
||||
String pathParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
|
||||
String queryParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
|
||||
String pathParameter =
|
||||
Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
|
||||
String queryParameter =
|
||||
Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
|
||||
GCubeCkanDataCatalog.service.getCKanConnector(
|
||||
pathParameter, queryParameter,
|
||||
new AsyncCallback<CkanConnectorAccessPoint>() {
|
||||
|
||||
GCubeCkanDataCatalog.service.getCKanConnector(pathParameter, queryParameter, new AsyncCallback<CkanConnectorAccessPoint>() {
|
||||
@Override
|
||||
public void onSuccess(CkanConnectorAccessPoint ckan) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(CkanConnectorAccessPoint ckan) {
|
||||
ckanAccessPoint = ckan;
|
||||
instanceCkanFrame(ckan.buildURI());
|
||||
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
|
||||
}
|
||||
ckanAccessPoint = ckan;
|
||||
instanceCkanFrame(ckan.buildURI());
|
||||
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
|
||||
Window.alert("Sorry, An error occurred during contacting Gcube Ckan Data Catalogue!");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
|
||||
Window.alert("Sorry, An error occurred during contacting Gcube Ckan Data Catalogue!");
|
||||
}
|
||||
});
|
||||
GCubeCkanDataCatalog.service.outsidePortal(new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
|
||||
if(result){
|
||||
// the portlet is outside the portal and no user is logged in
|
||||
if (result) {
|
||||
// the portlet is outside the portal and no user is logged
|
||||
// in
|
||||
// show only home and statistics
|
||||
managementPanel.doNotShowUserRelatedInfo();
|
||||
|
||||
}else{
|
||||
|
||||
//polling for session expired check
|
||||
}
|
||||
else {
|
||||
// polling for session expired check
|
||||
CheckSession.getInstance().startPolling();
|
||||
|
||||
// RETRIEVE USER'S ORGANIZATIONS
|
||||
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<Map<String,String>>() {
|
||||
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<Map<String, String>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, String> result) {
|
||||
|
||||
if(result != null)
|
||||
if (result != null)
|
||||
ckanOrganizationsPanel.setOrganizations(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
|
||||
// MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
|
||||
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<CkanRole>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,9 +140,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,23 +149,25 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
// the portlet is outside the portal and no user is logged in
|
||||
// show only home and statistics
|
||||
managementPanel.doNotShowUserRelatedInfo();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
|
||||
GWT.log("onWindowResized width: " + event.getWidth() + " height: " + event.getHeight());
|
||||
GWT.log("onWindowResized width: " + event.getWidth() +
|
||||
" height: " + event.getHeight());
|
||||
updateSize();
|
||||
}
|
||||
});
|
||||
|
||||
Window.enableScrolling(false);
|
||||
rootPanel.add(loading);
|
||||
rootPanel.add(this);
|
||||
updateSize();
|
||||
|
||||
// listenForPostMessage();
|
||||
// postMessage("Un messaggio");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,20 +175,21 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
*
|
||||
* @return the top panel height
|
||||
*/
|
||||
public int getTopPanelHeight(){
|
||||
public int getTopPanelHeight() {
|
||||
|
||||
if(managementPanel.isVisible())
|
||||
if (managementPanel.isVisible())
|
||||
return managementPanel.getCurrentHeight();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the top panel visible.
|
||||
*
|
||||
* @param bool the new top panel visible
|
||||
* @param bool
|
||||
* the new top panel visible
|
||||
*/
|
||||
public void setTopPanelVisible(boolean bool){
|
||||
public void setTopPanelVisible(boolean bool) {
|
||||
|
||||
managementPanel.setVisible(bool);
|
||||
updateSize();
|
||||
}
|
||||
|
@ -189,30 +197,33 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
/**
|
||||
* show or hide edit/insert buttons according to the role.
|
||||
*
|
||||
* @param show the show
|
||||
* @param show
|
||||
* the show
|
||||
*/
|
||||
public void showEditInsertButtons(boolean show){
|
||||
public void showEditInsertButtons(boolean show) {
|
||||
|
||||
managementPanel.showInsertAndEditProductButtons(show);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance ckan frame.
|
||||
*
|
||||
* @param ckanUrlConnector the ckan url connector
|
||||
* @param ckanUrlConnector
|
||||
* the ckan url connector
|
||||
* @return the frame
|
||||
*/
|
||||
public Frame instanceCkanFrame(String ckanUrlConnector){
|
||||
public Frame instanceCkanFrame(String ckanUrlConnector) {
|
||||
|
||||
ckanFramePanel.setVisible(true);
|
||||
ckanOrganizationsPanel.setVisible(false);
|
||||
return ckanFramePanel.instanceFrame(ckanUrlConnector);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the panel.
|
||||
*/
|
||||
private void initPanel() {
|
||||
|
||||
setTopPanelVisible(false);
|
||||
addToTop(managementPanel);
|
||||
VerticalPanel containerIntoScrollPanel = new VerticalPanel();
|
||||
|
@ -227,28 +238,29 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
/**
|
||||
* Update window size.
|
||||
*/
|
||||
public void updateSize(){
|
||||
|
||||
RootPanel workspace = rootPanel;
|
||||
public void updateSize() {
|
||||
/*RootPanel workspace = rootPanel;
|
||||
int topBorder = workspace.getAbsoluteTop();
|
||||
int leftBorder = workspace.getAbsoluteLeft();
|
||||
int footer = 0; //85 footer is bottombar + sponsor
|
||||
int rightScrollBar = 0;
|
||||
int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;// - ((footer == null)?0:(footer.getOffsetHeight()-15));
|
||||
int rootWidth = Window.getClientWidth() - 2* leftBorder - rightScrollBar;
|
||||
GWT.log("New iFrame size w: "+rootWidth + " h: "+rootHeight);
|
||||
this.setSize(rootWidth+"px",rootHeight+"px");
|
||||
GWT.log("top: "+topBorder);
|
||||
int footer = 30; // 85 footer is bottombar + sponsor
|
||||
int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;
|
||||
int height = rootHeight - getTopPanelHeight();
|
||||
// if(height<2000)
|
||||
// height = 2000;
|
||||
if(ckanFramePanel.getFrame()!=null){
|
||||
ckanFramePanel.getFrame().setSize(rootWidth+"px", height+"px");
|
||||
int newH = managementPanel!=null && managementPanel.getCurrentHeight()>0?managementPanel.getOffsetHeight()+height:height;
|
||||
// managementPanel.setHeight(height+50+"px");
|
||||
this.setHeight(newH+"px");
|
||||
}
|
||||
}
|
||||
if (ckanFramePanel.getFrame() != null) {
|
||||
int newH =managementPanel != null && managementPanel.getCurrentHeight() > 0 ? managementPanel.getOffsetHeight() + height : height;
|
||||
ckanFramePanel.getFrame().setHeight(2000+"px");
|
||||
}*/
|
||||
|
||||
RootPanel workspace = this.rootPanel;
|
||||
int topBorder = workspace.getAbsoluteTop();
|
||||
int footer = 55;
|
||||
int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;
|
||||
int height = rootHeight - getTopPanelHeight();
|
||||
if (this.ckanFramePanel.getFrame() != null) {
|
||||
int newH = this.managementPanel != null &&this.managementPanel.getCurrentHeight() > 0? this.managementPanel.getOffsetHeight() + height : height;
|
||||
this.ckanFramePanel.getFrame().setHeight(newH + "px");
|
||||
}
|
||||
// workspace.setHeight(height+"px");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base urlckan connector.
|
||||
|
@ -256,16 +268,17 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
* @return the base urlckan connector
|
||||
*/
|
||||
public String getBaseURLCKANConnector() {
|
||||
|
||||
return ckanAccessPoint.getBaseUrlWithContext();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the gcube token value to ckan connector.
|
||||
*
|
||||
* @return the gcube token value to ckan connector
|
||||
*/
|
||||
public String getGcubeTokenValueToCKANConnector() {
|
||||
|
||||
return ckanAccessPoint.getGcubeTokenValue();
|
||||
}
|
||||
|
||||
|
@ -275,16 +288,16 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate{
|
|||
* @return the path info
|
||||
*/
|
||||
public String getPathInfo() {
|
||||
|
||||
return ckanAccessPoint.getPathInfoParameter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the organizations panel
|
||||
* Show the organizations panel.
|
||||
*/
|
||||
public void showOrganizations() {
|
||||
|
||||
ckanOrganizationsPanel.setVisible(true);
|
||||
ckanFramePanel.setVisible(false);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue