This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
vmereports-manager-portlet/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportGenerator.java

231 lines
5.3 KiB
Java

package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CellPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*
*
* <code> ReportGeneretor </code> class is the Entry point class, defines the main layout of the UI
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*/
public class ReportGenerator implements EntryPoint {
/**
*
*/
public static final int HEADER_HEIGHT = 25;
/**
*
*/
public static final int PAGE_LEFT = 5;
/**
*
*/
public static final int TOOLBOX_LEFT = 15;
/**
*
*/
public static final int TEMPLATE_LEFT = 230;
/**
*
*/
public static final int TEMPLATE_TOP = HEADER_HEIGHT + 60;
/**
*
*/
public static ReportGenerator singleton = null;
/**
*
* @return .
*/
public static ReportGenerator get() {
return singleton;
}
/**
* the controller
*/
private Presenter presenter;
private VerticalPanel mainLayout = new VerticalPanel();
private ToolboxPanel toolBoxPanel;
private Headerbar header;
private TitleBar titlebar;
private HorizontalPanel exportResultsPanel = new HorizontalPanel();
private WorkspacePanel workSpacePanel;
private VerticalPanel eastPanel = new VerticalPanel();
private VerticalPanel toolbarPanel = new VerticalPanel();
private ScrollPanel bottomScrollerPanel = new ScrollPanel();
private HTML divHidden = new HTML();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
singleton = this;
presenter = new Presenter();
mainLayout.setWidth("95%");
mainLayout.setHeight("100%");
//
workSpacePanel = new WorkspacePanel(presenter);
titlebar = new TitleBar(presenter);
header = new Headerbar(presenter);
toolBoxPanel = new ToolboxPanel();
presenter.setHeader(header);
presenter.setTitleBar(titlebar);
presenter.setWp(workSpacePanel);
presenter.setToolBoxPanel(toolBoxPanel);
presenter.setExportsPanel(exportResultsPanel);
mainLayout.add(titlebar);
mainLayout.add(header);
mainLayout.add(toolbarPanel);
toolbarPanel.setWidth("100%");
toolbarPanel.setHeight("40");
CellPanel cellPanel = new HorizontalPanel();
cellPanel.setStyleName("cella");
cellPanel.add(toolBoxPanel);
cellPanel.add(bottomScrollerPanel);
cellPanel.setCellWidth(toolBoxPanel, "10px");
mainLayout.add(cellPanel);
divHidden.setStyleName("d4sFrame");
divHidden.setWidth("750px");
divHidden.setStyleName("d4sRichTextArea");
divHidden.addStyleName("hasRichTextToolbar");
divHidden.addStyleName("setVisibilityOff");
eastPanel.add(exportResultsPanel);
eastPanel.add(workSpacePanel);
eastPanel.add(divHidden);
bottomScrollerPanel.add(eastPanel);
presenter.addTextToolBar(true);
// Add image and button to the RootPanel
RootPanel.get("ReportGeneratorDIV").add(mainLayout);
// int scrollerWidth = Window.getClientWidth()- TEMPLATE_LEFT - 30;
// bottomScrollerPanel.setPixelSize(scrollerWidth, 1000);
//
// if ( Window.getClientWidth() < 1070 ) {
// int scrollerWidth2 = Window.getClientWidth()- TEMPLATE_LEFT;
// bottomScrollerPanel.setPixelSize(scrollerWidth2, 1000);
// }
//
// Window.addResizeHandler(new ResizeHandler() {
// public void onResize(ResizeEvent event) {
// int scrollerHeight = event.getHeight() - bottomScrollerPanel.getAbsoluteTop();
// if (scrollerHeight < toolBoxPanel.getTreePanelHeight())
// scrollerHeight = toolBoxPanel.getTreePanelHeight();
// int scrollerWidth = Window.getClientWidth()- TEMPLATE_LEFT - 30;
// bottomScrollerPanel.setPixelSize(scrollerWidth , 1000);
//
//
// if ( Window.getClientWidth() < 1060 ) {
// int scrollerWidth2 = Window.getClientWidth()- TEMPLATE_LEFT;
// bottomScrollerPanel.setPixelSize(scrollerWidth2, 1000);
// }
// }
//
// });
//presenter.showExportPanel("", "", null, "");
//showGuidedTour() ;
}
/**
*
* @return .
*/
public VerticalPanel getMainLayout() {
return mainLayout;
}
/**
*
* @return .
*/
public Headerbar getHeader() {
return header;
}
/**
*
* @return .
*/
public WorkspacePanel getWorkSpacePanel() {
return workSpacePanel;
}
/**
*
* @return .
*/
public ToolboxPanel getToolBoxPanel() {
return toolBoxPanel;
}
/**
*
* @return .
*/
public VerticalPanel getToolbarPanel() {
return toolbarPanel;
}
/**
*
* @return .
*/
public TitleBar getTitleHeader() {
return titlebar;
}
/**
*
* @return .
*/
public HTML getDivHidden() {
return divHidden;
}
/**
*
* @param divHidden .
*/
public void setDivHidden(HTML divHidden) {
this.divHidden = divHidden;
}
public ScrollPanel getScrollerPanel() {
return bottomScrollerPanel;
}
}