Added code to calculate new height

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@128854 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-05-26 12:17:36 +00:00
parent 8bec622d36
commit fa171eeb28
1 changed files with 42 additions and 16 deletions

View File

@ -79,9 +79,11 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
if(height!=null && !height.isEmpty() && height.contains("px")){ if(height!=null && !height.isEmpty() && height.contains("px")){
String purgedHeight = height.replaceAll("px", ""); String purgedHeight = height.replaceAll("px", "");
int heightToInt = Integer.parseInt(purgedHeight); int heightToInt = Integer.parseInt(purgedHeight);
int newH = heightToInt-offsetBreadcrumb; int nh = getNewHeightForContainer(heightToInt);
GWT.log("Set new height to center panel: "+newH); if(nh>0){
wsExplorer.getPanel().setHeight(newH+"px"); GWT.log("Set new height to center panel: "+nh);
wsExplorer.getPanel().setHeight(nh+"px");
}
}else }else
GWT.log("WorkspaceResourcesExplorerPanel read invalid height from parent!"); GWT.log("WorkspaceResourcesExplorerPanel read invalid height from parent!");
@ -89,19 +91,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
} }
} }
/**
* Sets the height to internal scroll.
*
* @param height the new height to internal scroll
*/
public void setHeightToInternalScroll(int height){
if(height>0){
int newH = height-offsetBreadcrumb;
GWT.log("Set new height to center panel: "+newH);
wsExplorer.getPanel().setHeight(newH+"px");
}
}
/** /**
* Instantiates a new workspace folder explorer panel. * Instantiates a new workspace folder explorer panel.
* *
@ -315,6 +304,11 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
add(centerScrollable, DockPanel.CENTER); add(centerScrollable, DockPanel.CENTER);
} }
/**
* Gets the north panel height.
*
* @return the north panel height
*/
public void getNorthPanelHeight(){ public void getNorthPanelHeight(){
} }
@ -496,4 +490,36 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
return showProperties; return showProperties;
} }
/**
* Gets the new height for container.
*
* @param parentHeight the parent height
* @return the new height for container
*/
private int getNewHeightForContainer(int parentHeight){
if(parentHeight>0){
int bh = breadcrumbs.getHeight();
bh = bh>offsetBreadcrumb?bh:offsetBreadcrumb;
if(parentHeight>bh)
return parentHeight-bh;
}
return -1;
}
/**
* Sets the height to internal scroll.
*
* @param height the new height to internal scroll
*/
public void setHeightToInternalScroll(int height){
int nh = getNewHeightForContainer(height);
if(nh>0){
GWT.log("Set new height to center panel: "+nh);
wsExplorer.getPanel().setHeight(nh+"px");
}
}
} }