99 lines
3.1 KiB
Java
99 lines
3.1 KiB
Java
/**
|
|
*
|
|
*/
|
|
|
|
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
|
|
|
import com.google.gwt.core.client.EntryPoint;
|
|
import com.google.gwt.core.client.GWT;
|
|
import com.google.gwt.dom.client.Element;
|
|
import com.google.gwt.dom.client.Style.Unit;
|
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
|
import com.google.gwt.user.client.DOM;
|
|
import com.google.gwt.user.client.Window;
|
|
import com.google.gwt.user.client.ui.RootPanel;
|
|
|
|
/**
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2016
|
|
*/
|
|
public class WorkspaceExplorerApp implements EntryPoint {
|
|
|
|
|
|
private WorkspaceExplorerAppController appController;
|
|
|
|
/**
|
|
* This is the entry point method.
|
|
*/
|
|
public void onModuleLoad() {
|
|
|
|
|
|
boolean jQueryLoaded = isjQueryLoaded();
|
|
// GWT.log("Injected : "+Resources.RESOURCES.jquery().getText());
|
|
GWT.log("jQueryLoaded: "+jQueryLoaded);
|
|
|
|
/*if (!jQueryLoaded) {
|
|
ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
|
|
.setWindow(ScriptInjector.TOP_WINDOW)
|
|
.inject();
|
|
}*/
|
|
|
|
/*ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
|
|
.setWindow(ScriptInjector.TOP_WINDOW)
|
|
.inject();*/
|
|
|
|
appController = new WorkspaceExplorerAppController();
|
|
appController.go(RootPanel.get(WorkspaceExplorerAppConstants.APPLICATION_DIV));
|
|
Window.addResizeHandler(new ResizeHandler() {
|
|
|
|
@Override
|
|
public void onResize(ResizeEvent event) {
|
|
updateSize();
|
|
}
|
|
});
|
|
|
|
WorkspaceExplorerAppMainPanel mainPanel = new WorkspaceExplorerAppMainPanel(appController.getMainPanel(), appController.getEventBus(), appController.getDisplayFields());
|
|
RootPanel.get(WorkspaceExplorerAppConstants.APPLICATION_DIV).add(mainPanel);
|
|
|
|
// WorkspaceExplorerFoooterPanel footerPanel = new WorkspaceExplorerFoooterPanel();
|
|
// RootPanel.get("footer_we").add(footerPanel);
|
|
|
|
updateSize();
|
|
}
|
|
|
|
/**
|
|
* Checks if is j query loaded.
|
|
*
|
|
* @return true, if is j query loaded
|
|
*/
|
|
private native boolean isjQueryLoaded() /*-{
|
|
return (typeof $wnd['jQuery'] !== 'undefined');
|
|
}-*/;
|
|
|
|
/**
|
|
* Update window size
|
|
*/
|
|
public static void updateSize() {
|
|
|
|
int headerH = DOM.getElementById("we_nav_bar").getClientHeight();
|
|
GWT.log("headerH " + headerH);
|
|
int footerH = DOM.getElementById("footer_we").getClientHeight();
|
|
GWT.log("footerH " + footerH);
|
|
int breadcrumbsH = DOM.getElementById("breadcrumbs_we").getClientHeight();
|
|
GWT.log("breadcrumbs_we " + breadcrumbsH);
|
|
int windowHeight = Window.getClientHeight();
|
|
GWT.log("rootHeight " + windowHeight);
|
|
int diff = windowHeight - (headerH+footerH+breadcrumbsH)-10;
|
|
int containerH = diff>0?diff:50;
|
|
DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getElementsByTagName("main").getItem(0).getStyle().setHeight(containerH, Unit.PX);
|
|
// DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getStyle().setHeight(containerH, Unit.PX);
|
|
GWT.log("containerH " + containerH);
|
|
|
|
Element table = DOM.getElementById("data_grid_explorer");
|
|
if(table!=null){
|
|
int headerTableH = 0;
|
|
table.getStyle().setHeight(containerH-headerTableH, Unit.PX);
|
|
}
|
|
}
|
|
}
|