just a fix to height in order to display the pager correctly

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@158446 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-11-14 13:01:15 +00:00
parent 7fae20fb28
commit 667b81b080
5 changed files with 46 additions and 13 deletions

View File

@ -130,4 +130,9 @@ public class Util {
}
}
public static native void console(String text)
/*-{
//console.log(text);
}-*/;
}

View File

@ -14,6 +14,7 @@ import com.google.gwt.core.client.GWT;
* Jul 11, 2017
*/
public class WorkspaceExplorerConstants {
public static final String SPECIAL_FOLDERS_NAME = "MySpecialFolders";
public static final String VRE_FOLDERS_LABEL = "My VRE Folders";

View File

@ -6,6 +6,7 @@ package org.gcube.portlets.widgets.wsexplorer.client.explore;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.widgets.wsexplorer.client.Util;
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEvent;
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEventHandler;
@ -69,23 +70,23 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
super.onLoad();
Element parent = getParent().getElement();
if(parent==null){
GWT.log("WorkspaceResourcesExplorerPanel parent is null");
Util.console("WorkspaceResourcesExplorerPanel parent is null");
}else{
GWT.log("WorkspaceResourcesExplorerPanel parent exists");
Util.console("WorkspaceResourcesExplorerPanel parent exists");
Style style = parent.getStyle();
if(style==null){
GWT.log("WorkspaceResourcesExplorerPanel style is null");
Util.console("WorkspaceResourcesExplorerPanel style is null");
}else{
GWT.log("WorkspaceResourcesExplorerPanel style exists");
Util.console("WorkspaceResourcesExplorerPanel style exists");
String height = style.getHeight();
GWT.log("WorkspaceResourcesExplorerPanel read height from parent: "+height);
Util.console("WorkspaceResourcesExplorerPanel read height from parent: "+height);
if(height!=null && !height.isEmpty() && height.contains("px")){
String purgedHeight = height.replaceAll("px", "");
int heightToInt = Integer.parseInt(purgedHeight);
int nh = getNewHeightForContainer(heightToInt);
if(nh>0){
parentHeight = nh;
GWT.log("WorkspaceResourcesExplorerPanel Set new height to center panel: "+nh);
Util.console("WorkspaceResourcesExplorerPanel Set new height to center panel: "+nh);
wsExplorer.getPanel().setHeight(nh+"px");
}
}else
@ -96,6 +97,32 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
}
/**
* Gets the valid parent height.
*
* @param ele the ele
* @return the valid parent height
*/
public int getValidParentHeight(Element ele){
if (ele == null)
return -1;
Element parent = ele.getParentElement();
if(parent==null){
return -1;
}
String height = parent.getStyle().getHeight();
if(height!=null && !height.isEmpty() && height.contains("px")){
String purgedHeight = height.replaceAll("px", "");
return Integer.parseInt(purgedHeight);
}
return getValidParentHeight(ele.getParentElement());
}
/**
* Instantiates a new workspace resources explorer panel.
*/
@ -547,7 +574,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
int nh = getNewHeightForContainer(height);
if(nh>0){
GWT.log("Set new height to center panel: "+nh);
Util.console("Set new height to center panel: "+nh);
wsExplorer.getPanel().setHeight(nh+"px");
}
}

View File

@ -5,6 +5,7 @@ package org.gcube.portlets.widgets.wsexplorer.client.explore;
import java.util.List;
import org.gcube.portlets.widgets.wsexplorer.client.Util;
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEvent;
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEventHandler;
import org.gcube.portlets.widgets.wsexplorer.client.event.ClickItemEvent;
@ -42,10 +43,9 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
//centerPanel = new FlowPanel();
// TODO Auto-generated method stub
super.onLoad();
GWT.log("WorkspaceResourcesExplorerPanelPaginated set new height....");
Util.console("WorkspaceResourcesExplorerPanelPaginated set new height to centerDock panel: "+parentHeight);
if(parentHeight>0){
GWT.log("WorkspaceResourcesExplorerPanelPaginated set new height to centerDock panel: "+parentHeight);
centerDock.setHeight(parentHeight+"px");
setHeightToInternalScroll(parentHeight);
}
}
@ -235,9 +235,9 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
public void setHeightToInternalScroll(int height){
super.setHeightToInternalScroll(height-southPanelSize);
int nh = super.getNewHeightForContainer(height);
int nh = super.getNewHeightForContainer(height-southPanelSize);
if(nh>0){
GWT.log("Set new height to center Dock panel: "+nh);
Util.console("Set new height to center Dock panel: "+nh);
centerDock.setHeight(nh+"px");
}
}

View File

@ -193,7 +193,7 @@
.we-dock-center-panel {
overflow-y: auto !important;
border: 1px solid #DDD;
/* border: 1px solid #DDD; */
}