Fixed ButtonGroup error on Ribbon
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@83145 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
aed9d2ffab
commit
186f40058a
2
pom.xml
2
pom.xml
|
@ -206,7 +206,7 @@
|
|||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<!-- <scope>compile</scope> -->
|
||||
<!-- <scope>compile</scope>-->
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
|
|
|
@ -13,13 +13,14 @@ import com.sencha.gxt.widget.core.client.container.Viewport.ViewportAppearance;
|
|||
|
||||
/**
|
||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class PortalViewport extends SimpleContainer {
|
||||
|
||||
protected int rightScrollBarSize = 17;
|
||||
|
||||
protected boolean enableScroll;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a viewport layout container with the default appearance.
|
||||
|
@ -31,16 +32,24 @@ public class PortalViewport extends SimpleContainer {
|
|||
/**
|
||||
* Creates a viewport layout container with the specified appearance.
|
||||
*
|
||||
* @param appearance the appearance of the viewport layout container
|
||||
* @param appearance
|
||||
* the appearance of the viewport layout container
|
||||
*/
|
||||
public PortalViewport(ViewportAppearance appearance) {
|
||||
super(true);
|
||||
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||
appearance.render(sb);
|
||||
setElement(XDOM.create(sb.toSafeHtml()));
|
||||
monitorWindowResize = true;
|
||||
getFocusSupport().setIgnore(false);
|
||||
resize();
|
||||
try {
|
||||
|
||||
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||
appearance.render(sb);
|
||||
setElement(XDOM.create(sb.toSafeHtml()));
|
||||
monitorWindowResize = true;
|
||||
forceLayoutOnResize = true;
|
||||
getFocusSupport().setIgnore(false);
|
||||
resize();
|
||||
} catch (Exception e) {
|
||||
Log.error("PortalViewport: constructor error "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +64,8 @@ public class PortalViewport extends SimpleContainer {
|
|||
/**
|
||||
* Sets whether window scrolling is enabled.
|
||||
*
|
||||
* @param enableScroll true to enable window scrolling
|
||||
* @param enableScroll
|
||||
* true to enable window scrolling
|
||||
*/
|
||||
public void setEnableScroll(boolean enableScroll) {
|
||||
this.enableScroll = enableScroll;
|
||||
|
@ -70,7 +80,8 @@ public class PortalViewport extends SimpleContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param rightScrollBarSize the rightScrollBarSize to set
|
||||
* @param rightScrollBarSize
|
||||
* the rightScrollBarSize to set
|
||||
*/
|
||||
public void setRightScrollBarSize(int rightScrollBarSize) {
|
||||
this.rightScrollBarSize = rightScrollBarSize;
|
||||
|
@ -78,20 +89,26 @@ public class PortalViewport extends SimpleContainer {
|
|||
|
||||
@Override
|
||||
protected void onAttach() {
|
||||
super.onAttach();
|
||||
setEnableScroll(enableScroll);
|
||||
resize();
|
||||
super.onAttach();
|
||||
|
||||
}
|
||||
|
||||
protected void resize()
|
||||
{
|
||||
protected void resize() {
|
||||
int viewWidth = calculateWidth() - rightScrollBarSize;
|
||||
int viewHeight = calculateHeight();
|
||||
Log.trace("resize viewWidth: "+viewWidth+" viewHeight: "+viewHeight+" clientWidth: "+Window.getClientWidth()+" clientHeight: "+Window.getClientHeight());
|
||||
setPixelSize(viewWidth, viewHeight);
|
||||
Log.info("TDM resize viewWidth: " + viewWidth + " viewHeight: "
|
||||
+ viewHeight + " clientWidth: " + Window.getClientWidth()
|
||||
+ " clientHeight: " + Window.getClientHeight());
|
||||
try {
|
||||
setPixelSize(viewWidth, viewHeight);
|
||||
} catch (Exception e) {
|
||||
Log.error("PortalViewport: error in resize() at setPixelSize "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -99,19 +116,52 @@ public class PortalViewport extends SimpleContainer {
|
|||
protected void onWindowResize(int width, int height) {
|
||||
int viewWidth = calculateWidth();
|
||||
int viewHeight = calculateHeight();
|
||||
Log.trace("onWindowResize viewWidth: "+viewWidth+" viewHeight: "+viewHeight+" clientWidth: "+Window.getClientWidth()+" clientHeight: "+Window.getClientHeight());
|
||||
Log.trace("TDM onWindowResize viewWidth: " + viewWidth
|
||||
+ " viewHeight: " + viewHeight + " clientWidth: "
|
||||
+ Window.getClientWidth() + " clientHeight: "
|
||||
+ Window.getClientHeight());
|
||||
setPixelSize(viewWidth, viewHeight);
|
||||
}
|
||||
|
||||
protected int calculateWidth()
|
||||
{
|
||||
/**
|
||||
* Update window size
|
||||
*/
|
||||
/*
|
||||
* public void resize(){
|
||||
*
|
||||
* RootPanel workspace = RootPanel.get("tdp");
|
||||
*
|
||||
* int topBorder = workspace.getAbsoluteTop();
|
||||
*
|
||||
* int leftBorder = workspace.getAbsoluteLeft();
|
||||
*
|
||||
* int footer = 85;
|
||||
*
|
||||
* int rootHeight = (Window.getClientHeight() - topBorder - 4 - footer);// -
|
||||
* ((footer == null)?0:(footer.getOffsetHeight()-15));
|
||||
*
|
||||
* if (rootHeight < 550) rootHeight = 550;
|
||||
*
|
||||
* int rootWidth = Window.getClientWidth() - 2* leftBorder; //-
|
||||
* rightScrollBar;
|
||||
*
|
||||
* System.out.println("New workspace dimension Height: "+rootHeight+" Width: "
|
||||
* +rootWidth);
|
||||
*
|
||||
* this.setHeight(rootHeight); this.setWidth(rootWidth); }
|
||||
*/
|
||||
|
||||
protected int calculateWidth() {
|
||||
int leftBorder = getAbsoluteLeft();
|
||||
Log.info("TDM width: "
|
||||
+ String.valueOf(Window.getClientWidth() - 2 * leftBorder));
|
||||
return Window.getClientWidth() - 2 * leftBorder;
|
||||
}
|
||||
|
||||
protected int calculateHeight()
|
||||
{
|
||||
protected int calculateHeight() {
|
||||
int topBorder = getAbsoluteTop();
|
||||
Log.info("TDM height: "
|
||||
+ String.valueOf(Window.getClientHeight() - topBorder - 34));
|
||||
return Window.getClientHeight() - topBorder - 34;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.gcube.portlets.user.td.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.client.ribbon.TabularDataRibbon;
|
||||
import org.gcube.portlets.user.td.client.rpc.TabularDataService;
|
||||
import org.gcube.portlets.user.td.client.rpc.TabularDataServiceAsync;
|
||||
|
@ -15,7 +14,6 @@ import com.google.gwt.core.client.GWT;
|
|||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||
|
@ -23,7 +21,6 @@ import com.sencha.gxt.widget.core.client.TabPanel;
|
|||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.Viewport;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
|
||||
|
@ -33,7 +30,7 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
|||
public class TabularDataPortlet implements EntryPoint {
|
||||
|
||||
protected static final String JSP_TAG_ID = "tdp";
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -41,203 +38,178 @@ public class TabularDataPortlet implements EntryPoint {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public static final int TOOLBOX_HEIGHT= 800;
|
||||
|
||||
public static final int TOOLBOX_HEIGHT = 800;
|
||||
|
||||
/**
|
||||
* Create a remote service proxy to talk to the server-side Greeting service.
|
||||
* Create a remote service proxy to talk to the server-side Greeting
|
||||
* service.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private final TabularDataServiceAsync greetingService = GWT.create(TabularDataService.class);
|
||||
private final TabularDataServiceAsync greetingService = GWT
|
||||
.create(TabularDataService.class);
|
||||
|
||||
//Main Panel
|
||||
// Main Panel
|
||||
private static BorderLayoutContainer mainPanelLayout;
|
||||
|
||||
//Private TabularData
|
||||
|
||||
// Private TabularData
|
||||
private static TabularData tabularData;
|
||||
private static ContentPanel functionalityPanel;
|
||||
private static TabPanel functionalityTab;
|
||||
private static BorderLayoutData eastData;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onModuleLoad() {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Install an UncaughtExceptionHandler which will produce <code>FATAL</code> log messages
|
||||
* Install an UncaughtExceptionHandler which will produce
|
||||
* <code>FATAL</code> log messages
|
||||
*/
|
||||
Log.setUncaughtExceptionHandler();
|
||||
|
||||
// use deferred command to catch initialization exceptions in onModuleLoad2
|
||||
// use deferred command to catch initialization exceptions in
|
||||
// onModuleLoad2
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
@Override
|
||||
public void execute() {
|
||||
loadMainPanel();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update window size
|
||||
|
||||
public void updateSize(){
|
||||
|
||||
RootPanel workspace = RootPanel.get("tdp");
|
||||
|
||||
int topBorder = workspace.getAbsoluteTop();
|
||||
|
||||
int leftBorder = workspace.getAbsoluteLeft();
|
||||
|
||||
int footer = 85;
|
||||
|
||||
int rootHeight = (Window.getClientHeight() - topBorder - 4 - footer);// - ((footer == null)?0:(footer.getOffsetHeight()-15));
|
||||
|
||||
if (rootHeight < 550)
|
||||
rootHeight = 550;
|
||||
|
||||
int rootWidth = Window.getClientWidth() - 2* leftBorder; //- rightScrollBar;
|
||||
|
||||
System.out.println("New workspace dimension Height: "+rootHeight+" Width: "+rootWidth);
|
||||
|
||||
mainPanelLayout.setHeight(rootHeight);
|
||||
mainPanelLayout.setWidth(rootWidth);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
protected void loadMainPanel() {
|
||||
/*
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
System.out.println("onWindowResized width: "+event.getWidth()+" height: "+event.getHeight());
|
||||
updateSize();
|
||||
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
|
||||
TabularDataController controller = new TabularDataController();
|
||||
EventBus eventBus = controller.getEventBus();
|
||||
|
||||
tabularData = new TabularData(Constants.TD_DATASOURCE_FACTORY_ID);
|
||||
|
||||
tabularData = new TabularData(Constants.TD_DATASOURCE_FACTORY_ID);
|
||||
tabularData.addFailureHandler(new FailureEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onFailure(FailureEvent event) {
|
||||
Info.display("Error: "+event.getMessage(), event.getCaught().getMessage());
|
||||
Info.display("Error: " + event.getMessage(), event.getCaught()
|
||||
.getMessage());
|
||||
|
||||
}
|
||||
});
|
||||
controller.setTabularData(tabularData);
|
||||
|
||||
|
||||
//Layout
|
||||
|
||||
// Layout
|
||||
mainPanelLayout = new BorderLayoutContainer();
|
||||
mainPanelLayout.setBorders(true);
|
||||
mainPanelLayout.setWidth("100%");
|
||||
mainPanelLayout.setHeight("100%");
|
||||
|
||||
|
||||
//Ribbon Menu
|
||||
TabularDataRibbon tabularDataTooBar = new TabularDataRibbon(eventBus);
|
||||
Widget toolBarPanel = tabularDataTooBar.getContainer();
|
||||
|
||||
BorderLayoutData toolBarData = new BorderLayoutData(122);
|
||||
toolBarData.setMargins(new Margins(5));
|
||||
toolBarData.setCollapsible(false);
|
||||
toolBarData.setSplit(false);
|
||||
|
||||
mainPanelLayout.setNorthWidget(toolBarPanel, toolBarData);
|
||||
|
||||
|
||||
//Grid Panel
|
||||
final TabularDataGridPanel gridPanel = tabularData.getGridPanel();
|
||||
mainPanelLayout.setBorders(true);
|
||||
|
||||
// Ribbon Menu
|
||||
TabularDataRibbon tabularDataTooBar = new TabularDataRibbon(eventBus);
|
||||
TabPanel toolBarPanel = tabularDataTooBar.getContainer();
|
||||
|
||||
BorderLayoutData toolBarData = new BorderLayoutData(122);
|
||||
toolBarData.setMargins(new Margins(5));
|
||||
toolBarData.setCollapsible(false);
|
||||
toolBarData.setSplit(false);
|
||||
|
||||
mainPanelLayout.setNorthWidget(toolBarPanel, toolBarData);
|
||||
|
||||
// Grid Panel
|
||||
final TabularDataGridPanel gridPanel = tabularData.getGridPanel();
|
||||
gridPanel.setHeaderVisible(false);
|
||||
|
||||
|
||||
MarginData gridData = new MarginData();
|
||||
mainPanelLayout.setCenterWidget(gridPanel,gridData);
|
||||
|
||||
|
||||
//Functionality Panel
|
||||
functionalityPanel= new ContentPanel();
|
||||
functionalityPanel.setWidth(310);
|
||||
functionalityPanel.setHeaderVisible(false);
|
||||
functionalityPanel.setResize(true);
|
||||
|
||||
functionalityTab=new TabPanel();
|
||||
functionalityTab.setAnimScroll(true);
|
||||
functionalityTab.setTabScroll(true);
|
||||
functionalityTab.setCloseContextMenu(true);
|
||||
|
||||
functionalityPanel.add(functionalityTab);
|
||||
|
||||
eastData = new BorderLayoutData(310);
|
||||
eastData.setCollapsible(true);
|
||||
eastData.setSplit(false);
|
||||
eastData.setFloatable(false);
|
||||
eastData.setCollapseMini(true);
|
||||
eastData.setMargins(new Margins(0, 5, 0, 5));
|
||||
eastData.setCollapseHidden(true);
|
||||
|
||||
mainPanelLayout.setEastWidget(functionalityPanel,eastData);
|
||||
mainPanelLayout.setCenterWidget(gridPanel, gridData);
|
||||
|
||||
// Functionality Panel
|
||||
functionalityPanel= new ContentPanel();
|
||||
functionalityPanel.setWidth(310);
|
||||
functionalityPanel.setHeaderVisible(false);
|
||||
functionalityPanel.setResize(true);
|
||||
|
||||
functionalityTab = new TabPanel();
|
||||
functionalityTab.setAnimScroll(true);
|
||||
functionalityTab.setTabScroll(true);
|
||||
functionalityTab.setCloseContextMenu(true);
|
||||
|
||||
functionalityPanel.add(functionalityTab);
|
||||
|
||||
eastData = new BorderLayoutData(310);
|
||||
eastData.setCollapsible(true);
|
||||
eastData.setSplit(false);
|
||||
eastData.setFloatable(false);
|
||||
eastData.setCollapseMini(true);
|
||||
eastData.setMargins(new Margins(0, 5, 0, 5));
|
||||
eastData.setCollapseHidden(true);
|
||||
|
||||
mainPanelLayout.setEastWidget(functionalityPanel, eastData);
|
||||
functionalityPanel.collapse();
|
||||
functionalityPanel.disable();
|
||||
|
||||
|
||||
controller.setFunctionalityTab(functionalityTab);
|
||||
controller.setFunctionalityPanel(functionalityPanel);
|
||||
controller.setEastData(eastData);
|
||||
|
||||
|
||||
|
||||
//Main
|
||||
//SimpleContainer mainPanel = new SimpleContainer();
|
||||
//mainPanelLayout.clearSizeCache();
|
||||
//mainPanelLayout.forceLayout();
|
||||
//mainPanel.add(mainPanelLayout);
|
||||
|
||||
//updateSize();
|
||||
|
||||
controller.setFunctionalityTab(functionalityTab);
|
||||
controller.setFunctionalityPanel(functionalityPanel);
|
||||
controller.setEastData(eastData);
|
||||
|
||||
// Main
|
||||
// SimpleContainer mainPanel = new SimpleContainer();
|
||||
// mainPanelLayout.clearSizeCache();
|
||||
// mainPanelLayout.forceLayout();
|
||||
|
||||
/*
|
||||
* mainPanel.add(toolBarPanel);
|
||||
* Log.info("toolBarPanel height: "+toolBarPanel.getOffsetHeight());
|
||||
* Log.info("toolBarPanel width: "+toolBarPanel.getOffsetWidth());
|
||||
*
|
||||
* // updateSize(); try { RootPanel.get(JSP_TAG_ID).add(mainPanel); }
|
||||
* catch (Exception e) { e.printStackTrace();
|
||||
* Log.error("Tabular Data Portlet: error " + e.getLocalizedMessage());
|
||||
* }
|
||||
*/
|
||||
bind(mainPanelLayout);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void bind(Widget mainWidget)
|
||||
{
|
||||
RootPanel root = RootPanel.get(JSP_TAG_ID);
|
||||
if (root == null) {
|
||||
Log.trace("Div with id "+JSP_TAG_ID+" not found, starting in dev mode");
|
||||
Viewport viewport = new Viewport();
|
||||
viewport.setWidget(mainWidget);
|
||||
viewport.onResize();
|
||||
RootPanel.get().add(viewport);
|
||||
} else {
|
||||
Log.trace("Application div with id "+JSP_TAG_ID+" found, starting in portal mode");
|
||||
PortalViewport viewport = new PortalViewport();
|
||||
//viewport.setEnableScroll(true);
|
||||
viewport.setWidget(mainWidget);
|
||||
//RootPanel.get()
|
||||
viewport.onResize();
|
||||
root.add(viewport);
|
||||
protected void bind(BorderLayoutContainer mainWidget) {
|
||||
try {
|
||||
RootPanel root = RootPanel.get(JSP_TAG_ID);
|
||||
Log.info("Root Panel: " + root);
|
||||
if (root == null) {
|
||||
Log.info("Div with id " + JSP_TAG_ID
|
||||
+ " not found, starting in dev mode");
|
||||
Viewport viewport = new Viewport();
|
||||
viewport.setWidget(mainWidget);
|
||||
RootPanel.get().add(viewport);
|
||||
} else {
|
||||
Log.info("Application div with id " + JSP_TAG_ID
|
||||
+ " found, starting in portal mode");
|
||||
PortalViewport viewport = new PortalViewport();
|
||||
Log.info("Created Viewport");
|
||||
viewport.setWidget(mainWidget);
|
||||
Log.info("Set Widget");
|
||||
Log.info("getOffsetWidth(): " + viewport.getOffsetWidth());
|
||||
Log.info("getOffsetHeight(): " + viewport.getOffsetHeight());
|
||||
/*viewport.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
viewport.resize();
|
||||
}
|
||||
});*/
|
||||
|
||||
root.add(viewport);
|
||||
Log.info("Added viewport to root");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.error("Error in attach viewport:" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/*private void configPanel(final Portlet panel) {
|
||||
panel.setCollapsible(true);
|
||||
panel.setAnimCollapse(false);
|
||||
//panel.getHeader().addTool(new ToolButton(ToolButton.GEAR));
|
||||
panel.getHeader().addTool(new ToolButton(ToolButton.CLOSE));
|
||||
|
||||
}*/
|
||||
|
||||
/*
|
||||
* private void configPanel(final Portlet panel) {
|
||||
* panel.setCollapsible(true); panel.setAnimCollapse(false);
|
||||
* //panel.getHeader().addTool(new ToolButton(ToolButton.GEAR));
|
||||
* panel.getHeader().addTool(new ToolButton(ToolButton.CLOSE));
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ public class ChartsToolBar {
|
|||
public ChartsToolBar(EventBus eventBus)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
toolBar = new ToolBar();
|
||||
build();
|
||||
}
|
||||
|
||||
|
@ -53,11 +52,13 @@ public class ChartsToolBar {
|
|||
|
||||
protected void build()
|
||||
{
|
||||
toolBar.setHeight("94px");
|
||||
toolBar = new ToolBar();
|
||||
toolBar.setSpacing(1);
|
||||
|
||||
|
||||
ButtonGroup basicGroup = new ButtonGroup();
|
||||
basicGroup.setHeight("78px");
|
||||
basicGroup.setStyleName("margin:2px");
|
||||
basicGroup.setId("Charts");
|
||||
basicGroup.setStyleName("ribbon");
|
||||
basicGroup.setHeadingText("Charts");
|
||||
toolBar.add(basicGroup);
|
||||
|
||||
|
@ -136,8 +137,8 @@ public class ChartsToolBar {
|
|||
|
||||
//External Tools
|
||||
ButtonGroup externalToolGroup = new ButtonGroup();
|
||||
externalToolGroup.setHeight("78px");
|
||||
externalToolGroup.setStyleName("margin:2px");
|
||||
externalToolGroup.setId("ExternalTools");
|
||||
externalToolGroup.setStyleName("ribbon");
|
||||
externalToolGroup.setHeadingText("External Tools");
|
||||
toolBar.add(externalToolGroup);
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ public class FileToolBar {
|
|||
public FileToolBar(EventBus eventBus)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
toolBar = new ToolBar();
|
||||
build();
|
||||
}
|
||||
|
||||
|
@ -69,23 +68,27 @@ public class FileToolBar {
|
|||
|
||||
protected void build()
|
||||
{
|
||||
toolBar.setHeight("94px");
|
||||
toolBar = new ToolBar();
|
||||
toolBar.setSpacing(1);
|
||||
|
||||
//File
|
||||
ButtonGroup dataGroup = new ButtonGroup();
|
||||
dataGroup.setHeight("78px");
|
||||
dataGroup.setStyleName("margin:2px");
|
||||
dataGroup.setId("File");
|
||||
dataGroup.setStyleName("ribbon");
|
||||
dataGroup.setHeadingText("File");
|
||||
toolBar.add(dataGroup);
|
||||
|
||||
|
||||
FlexTable dataLayout = new FlexTable();
|
||||
dataLayout.setStyleName("ribbon");
|
||||
dataGroup.add(dataLayout);
|
||||
|
||||
|
||||
openButton = new TextButton("Open", TabularDataResources.INSTANCE.open32());
|
||||
openButton.setId("oepnButton");
|
||||
openButton.setScale(ButtonScale.LARGE);
|
||||
openButton.setIconAlign(IconAlign.TOP);
|
||||
openButton.setToolTip("Open Tabular Resource");
|
||||
openButton.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
openButton.setToolTip("Open Tabular Resource");
|
||||
|
||||
openButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -97,6 +100,8 @@ public class FileToolBar {
|
|||
dataLayout.setWidget(0, 0, openButton);
|
||||
dataLayout.getFlexCellFormatter().setRowSpan(0, 0, 2);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
saveButton = new TextButton("Save", TabularDataResources.INSTANCE.save32());
|
||||
saveButton.setScale(ButtonScale.LARGE);
|
||||
|
@ -111,13 +116,18 @@ public class FileToolBar {
|
|||
}
|
||||
});
|
||||
|
||||
dataLayout.setWidget(0, 1, saveButton);
|
||||
dataLayout.getFlexCellFormatter().setRowSpan(0, 1, 2);
|
||||
|
||||
dataLayout.setWidget(0, 1, saveButton);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
closeButton = new TextButton("Close", TabularDataResources.INSTANCE.close());
|
||||
closeButton.setId("closeButton");
|
||||
closeButton.setToolTip("Close table");
|
||||
|
||||
dataLayout.setWidget(0, 2, closeButton);
|
||||
closeButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
|
@ -128,6 +138,7 @@ public class FileToolBar {
|
|||
});
|
||||
|
||||
propertiesButton = new TextButton("Properties", TabularDataResources.INSTANCE.properties());
|
||||
propertiesButton.setId("propertiesButton");
|
||||
propertiesButton.setToolTip("Show properties");
|
||||
dataLayout.setWidget(1, 2, propertiesButton);
|
||||
propertiesButton.addSelectHandler(new SelectHandler() {
|
||||
|
@ -137,15 +148,15 @@ public class FileToolBar {
|
|||
eventBus.fireEvent(new OpenFunctionalityEvent(OpenFunctionalityType.PROPERTIES));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cleanCells(dataLayout.getElement());
|
||||
|
||||
|
||||
|
||||
|
||||
//Import
|
||||
ButtonGroup importGroup = new ButtonGroup();
|
||||
importGroup.setHeight("78px");
|
||||
importGroup.setStyleName("margin:2px");
|
||||
importGroup.setId("Import");
|
||||
importGroup.setStyleName("ribbon");
|
||||
importGroup.setHeadingText("Import");
|
||||
toolBar.add(importGroup);
|
||||
|
||||
|
@ -196,8 +207,8 @@ public class FileToolBar {
|
|||
|
||||
//Export
|
||||
ButtonGroup exportGroup = new ButtonGroup();
|
||||
exportGroup.setHeight("78px");
|
||||
exportGroup.setStyleName("margin:2px");
|
||||
exportGroup.setId("Export");
|
||||
exportGroup.setStyleName("ribbon");
|
||||
exportGroup.setHeadingText("Export");
|
||||
exportGroup.disable();
|
||||
toolBar.add(exportGroup);
|
||||
|
@ -247,15 +258,15 @@ public class FileToolBar {
|
|||
|
||||
}
|
||||
|
||||
protected void cleanCells(Element elem) {
|
||||
NodeList<Element> tds = elem.<XElement> cast().select("td");
|
||||
for (int i = 0; i < tds.getLength(); i++) {
|
||||
Element td = tds.getItem(i);
|
||||
|
||||
if (!td.hasChildNodes() && td.getClassName().equals("")) {
|
||||
td.removeFromParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void cleanCells(Element elem) {
|
||||
NodeList<Element> tds = elem.<XElement> cast().select("td");
|
||||
for (int i = 0; i < tds.getLength(); i++) {
|
||||
Element td = tds.getItem(i);
|
||||
|
||||
if (!td.hasChildNodes() && td.getClassName().equals("")) {
|
||||
td.removeFromParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ public class FormulasToolBar {
|
|||
public FormulasToolBar(EventBus eventBus)
|
||||
{
|
||||
this.eventBus = eventBus;
|
||||
toolBar = new ToolBar();
|
||||
build();
|
||||
}
|
||||
|
||||
|
@ -61,12 +60,14 @@ public class FormulasToolBar {
|
|||
|
||||
protected void build()
|
||||
{
|
||||
toolBar.setHeight("94px");
|
||||
toolBar = new ToolBar();
|
||||
toolBar.setSpacing(1);
|
||||
|
||||
|
||||
//Basic
|
||||
ButtonGroup basicGroup = new ButtonGroup();
|
||||
basicGroup.setHeight("78px");
|
||||
basicGroup.setStyleName("margin:2px");
|
||||
basicGroup.setId("Table");
|
||||
basicGroup.setStyleName("ribbon");
|
||||
basicGroup.setHeadingText("Table");
|
||||
toolBar.add(basicGroup);
|
||||
|
||||
|
@ -161,8 +162,8 @@ public class FormulasToolBar {
|
|||
|
||||
//Column
|
||||
ButtonGroup columnGroup = new ButtonGroup();
|
||||
columnGroup.setHeight("78px");
|
||||
columnGroup.setStyleName("margin:2px");
|
||||
columnGroup.setId("Column");
|
||||
columnGroup.setStyleName("ribbon");
|
||||
columnGroup.setHeadingText("Column");
|
||||
columnGroup.disable();
|
||||
toolBar.add(columnGroup);
|
||||
|
@ -224,8 +225,8 @@ public class FormulasToolBar {
|
|||
|
||||
//History
|
||||
ButtonGroup historyGroup = new ButtonGroup();
|
||||
historyGroup.setHeight("78px");
|
||||
historyGroup.setStyleName("margin:2px");
|
||||
historyGroup.setId("History");
|
||||
historyGroup.setStyleName("ribbon");
|
||||
historyGroup.setHeadingText("History");
|
||||
toolBar.add(historyGroup);
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ public class ReviewToolBar {
|
|||
|
||||
public ReviewToolBar(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
toolBar = new ToolBar();
|
||||
build();
|
||||
}
|
||||
|
||||
|
@ -45,12 +44,14 @@ public class ReviewToolBar {
|
|||
}
|
||||
|
||||
protected void build() {
|
||||
toolBar.setHeight("94px");
|
||||
toolBar = new ToolBar();
|
||||
toolBar.setSpacing(1);
|
||||
|
||||
|
||||
// Validation
|
||||
ButtonGroup validationGroup = new ButtonGroup();
|
||||
validationGroup.setHeight("78px");
|
||||
validationGroup.setStyleName("margin:2px");
|
||||
validationGroup.setId("Validation");
|
||||
validationGroup.setStyleName("ribbon");
|
||||
validationGroup.setHeadingText("Validation");
|
||||
toolBar.add(validationGroup);
|
||||
|
||||
|
@ -116,8 +117,8 @@ public class ReviewToolBar {
|
|||
|
||||
// Operations
|
||||
ButtonGroup operationsGroup = new ButtonGroup();
|
||||
operationsGroup.setHeight("78px");
|
||||
operationsGroup.setStyleName("margin:2px");
|
||||
operationsGroup.setId("Operations");
|
||||
operationsGroup.setStyleName("ribbon");
|
||||
operationsGroup.setHeadingText("Operations");
|
||||
toolBar.add(operationsGroup);
|
||||
|
||||
|
|
|
@ -3,54 +3,60 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.td.client.ribbon;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.PlainTabPanel;
|
||||
import com.sencha.gxt.widget.core.client.TabPanel;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
|
||||
/**
|
||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TabularDataRibbon {
|
||||
|
||||
|
||||
protected TabPanel ribbon;
|
||||
|
||||
//protected PlainTabPanel ribbon;
|
||||
|
||||
protected FileToolBar fileToolBar;
|
||||
protected ReviewToolBar reviewToolBar;
|
||||
protected FormulasToolBar formulasToolBar;
|
||||
protected ChartsToolBar chartsToolBar;
|
||||
|
||||
public TabularDataRibbon(EventBus eventBus)
|
||||
{
|
||||
ribbon = new TabPanel();
|
||||
ribbon.setId("Ribbon");
|
||||
ribbon.setStyleName("ribbon");
|
||||
fileToolBar = new FileToolBar(eventBus);
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.setHeight("94px");
|
||||
con.add(fileToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Home");
|
||||
|
||||
reviewToolBar = new ReviewToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.setHeight("94px");
|
||||
con.add(reviewToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Review");
|
||||
|
||||
formulasToolBar = new FormulasToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.setHeight("94px");
|
||||
con.add(formulasToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Modify");
|
||||
|
||||
|
||||
chartsToolBar = new ChartsToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.setHeight("94px");
|
||||
con.add(chartsToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Applications");
|
||||
|
||||
|
||||
public TabularDataRibbon(EventBus eventBus) {
|
||||
try {
|
||||
ribbon = new TabPanel();
|
||||
ribbon.setId("Ribbon");
|
||||
|
||||
|
||||
fileToolBar = new FileToolBar(eventBus);
|
||||
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||
con.add(fileToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Home");
|
||||
|
||||
reviewToolBar = new ReviewToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
|
||||
con.add(reviewToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Review");
|
||||
|
||||
formulasToolBar = new FormulasToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.add(formulasToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Modify");
|
||||
|
||||
chartsToolBar = new ChartsToolBar(eventBus);
|
||||
con = new VerticalLayoutContainer();
|
||||
con.add(chartsToolBar.getToolBar(), new VerticalLayoutData(1, -1));
|
||||
ribbon.add(con, "Applications");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.error("Ribbon error:" + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,6 +65,5 @@ public class TabularDataRibbon {
|
|||
public TabPanel getContainer() {
|
||||
return ribbon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.user.td.client.TabularDataPortlet' />
|
||||
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="ENABLED" />
|
||||
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
||||
<set-property name="log_FirebugLogger" value="ENABLED" />
|
||||
<set-property name="log_GWTLogger" value="ENABLED" />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/** Add css rules here for your application. */
|
||||
.ribbon {
|
||||
height:127px;
|
||||
table {
|
||||
border-spacing: 1px !important;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue