From 1cd70b45bf669d9601333e445b455d57a09dd86d Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Sat, 16 Mar 2013 17:14:36 +0000 Subject: [PATCH] added open report button in toolbar git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@71486 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/Presenter/CommonCommands.java | 40 +++++++++++++++++-- .../client/Presenter/Presenter.java | 17 ++++++-- .../client/ReportGenerator.java | 17 +++----- .../reportgenerator/client/ToolboxPanel.java | 8 ---- .../client/uibinder/ExportOptions.java | 8 +++- .../client/uibinder/ExportOptions.ui.xml | 2 +- src/main/webapp/ReportGenerator.css | 40 ++++++++++++++----- 7 files changed, 94 insertions(+), 38 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/CommonCommands.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/CommonCommands.java index 29929e7..807fa34 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/CommonCommands.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/CommonCommands.java @@ -26,14 +26,16 @@ import com.google.gwt.user.client.ui.PopupPanel; * CommonCommands class contains the menu commands for the UI * * @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it - * - * @version December 2012 (2.7) */ public class CommonCommands { /** * */ public Command openTemplate; + /** + * + */ + public Command openReport; /** * */ @@ -66,7 +68,7 @@ public class CommonCommands { GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() { public void onSuccess() { - WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Open Template", true, true); + WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Select a Template to open", true, true); wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE); wpTreepopup.setSelectableTypes(ItemType.REPORT_TEMPLATE); @@ -93,6 +95,38 @@ public class CommonCommands { } }; + openReport = new Command() { + public void execute() { + + GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() { + public void onSuccess() { + int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50; + int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25; + + WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Select a Report to open", true, true); + wpTreepopup.setShowableTypes(ItemType.REPORT); + wpTreepopup.setSelectableTypes(ItemType.REPORT); + wpTreepopup.addPopupHandler(new PopupHandler() { + public void onPopup(PopupEvent event) { + if (! event.isCanceled()) { + if (event.getSelectedItem() != null) { + presenter.openTemplate(event.getSelectedItem().getName(), event.getSelectedItem().getId(), false); + } + presenter.getHeader().enableExports(); + } + + } + }); + wpTreepopup.setPopupPosition(left, top); + wpTreepopup.show(); + } + + public void onFailure(Throwable reason) { + Window.alert("There are networks problem, please check your connection."); + } + }); + } + }; pickColor = new Command() { public void execute() { diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java index c98f455..b9fcb9a 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/Presenter/Presenter.java @@ -360,6 +360,7 @@ public class Presenter { toReturn.put("save", commonCommands.saveTemplate); toReturn.put("newdoc", newTemplate); + toReturn.put("open_report", commonCommands.openReport); toReturn.put("open_template", commonCommands.openTemplate); toReturn.put("importing", commonCommands.importTemplateCommand); toReturn.put("insertImage", commonCommands.insertImage); @@ -407,7 +408,7 @@ public class Presenter { */ public void addTextToolBar() { - RichTextToolbar rtbar = new RichTextToolbar(new RichTextArea(), false, getCommands() ); + RichTextToolbar rtbar = new RichTextToolbar(new RichTextArea(), false, getCommands(), true); SimplePanel deco = new SimplePanel(); rtbar.setEnabled(false); deco.add(rtbar); @@ -606,7 +607,7 @@ public class Presenter { */ public void enableTextToolBar(RichTextArea d4sArea) { - RichTextToolbar rtbar = new RichTextToolbar(d4sArea, false, getCommands() ); + RichTextToolbar rtbar = new RichTextToolbar(d4sArea, false, getCommands(), true); if (menuForWorkflowDocument) //disable open and save buttons from the toolbar rtbar.enableCommands(false); currentSelectedToolbar = rtbar; @@ -1161,15 +1162,23 @@ public class Presenter { @Override public void onFailure(Throwable caught) { - Window.alert("Error: " + caught.getMessage()); + Window.alert("Error while trying exporting this report: " + caught.getMessage()); } }); } public void showExportPanel(final String filePath, final String itemName, final TypeExporter type, String tempFileId) { - ExportOptions exo = new ExportOptions(this, toolBoxPanel, filePath, itemName, type, reportService, tempFileId); + final ExportOptions exo = new ExportOptions(this, toolBoxPanel, filePath, itemName, type, reportService, tempFileId); exportsPanel.add(exo); + //needed for applying the css3 transition effect + final Timer t = new Timer() { + @Override + public void run() { + exo.getMainPanel().addStyleName("exportPanel-show"); + } + }; + t.schedule(10); } public void clearExportPanel() { diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportGenerator.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportGenerator.java index 62506cf..1dcfbda 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportGenerator.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ReportGenerator.java @@ -19,9 +19,12 @@ import org.gcube.portlets.user.workspace.lighttree.client.load.WorkspaceLightTre import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.RunAsyncCallback; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; 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.Button; import com.google.gwt.user.client.ui.CellPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; @@ -126,8 +129,7 @@ public class ReportGenerator implements EntryPoint { toolbarPanel.setWidth("100%"); toolbarPanel.setHeight("40"); - - + CellPanel cellPanel = new HorizontalPanel(); cellPanel.setStyleName("cella"); cellPanel.add(toolBoxPanel); @@ -178,8 +180,7 @@ public class ReportGenerator implements EntryPoint { }); //showGuidedTour() ; - //presenter.showExportSaveOptions("", "", TypeExporter.DOCX, null); - + } private void showGuidedTour() { @@ -370,14 +371,6 @@ public class ReportGenerator implements EntryPoint { return toolbarPanel; } - /** - * - * @param toolbarPanel . - */ - public void setToolbarPanel(VerticalPanel toolbarPanel) { - this.toolbarPanel = toolbarPanel; - } - /** * * @return . diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ToolboxPanel.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ToolboxPanel.java index 31fd400..1e59e51 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/ToolboxPanel.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/ToolboxPanel.java @@ -1,9 +1,5 @@ package org.gcube.portlets.user.reportgenerator.client; -// -//import org.gcube.portlets.user.workspace.client.tree.WorkspaceTreePanel; -//import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspace; - import org.gcube.portlets.user.workspace.client.AppControllerExplorer; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent; import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType; @@ -12,7 +8,6 @@ import org.gcube.portlets.user.workspace.client.event.FileUploadEvent.UploadType import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel; import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.SimplePanel; /** @@ -32,9 +27,6 @@ public class ToolboxPanel extends SimplePanel { */ public static final int TOOLBOX_HEIGHT= 800; - /** - * constructor - */ public ToolboxPanel(AppControllerExplorer appController) { this.appController = appController; AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT); diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.java b/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.java index cf2532b..7fdbdd0 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.java +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.java @@ -18,6 +18,7 @@ import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Widget; public class ExportOptions extends Composite { @@ -33,6 +34,7 @@ public class ExportOptions extends Composite { @UiField HTML saveOpen; @UiField HTML save; @UiField HTML saveAs; + @UiField HTMLPanel myPanel; private String tempFileId; private String filePath; @@ -132,6 +134,10 @@ public class ExportOptions extends Composite { }); break; } - } + + public HTMLPanel getMainPanel() { + return myPanel; + } + } diff --git a/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.ui.xml b/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.ui.xml index 67c76e3..538f8cc 100644 --- a/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.ui.xml +++ b/src/main/java/org/gcube/portlets/user/reportgenerator/client/uibinder/ExportOptions.ui.xml @@ -1,7 +1,7 @@ - +
diff --git a/src/main/webapp/ReportGenerator.css b/src/main/webapp/ReportGenerator.css index 1b57f18..c08c9d6 100644 --- a/src/main/webapp/ReportGenerator.css +++ b/src/main/webapp/ReportGenerator.css @@ -4,11 +4,35 @@ margin: 10px 5px 5px 20px; border: 1px solid #e3e8f3; padding: 10px; - background-color: #FFFFBF; + background-color: #FFF; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; width: 775px; + height: 20px; + opacity: 0; + + transition-property: opacity, height; + transition-duration: .55s; + transition-timing-function: ease-out; + + -moz-transition-property: opacity, height; + -moz-transition-duration: .55s; + -moz-transition-timing-function: ease-out; + + -webkit-transition-property: opacity, height; + -webkit-transition-duration: .55s; + -webkit-transition-timing-function: ease-out; + + -ms-transition-property: opacity, height; + -ms-transition-duration: .55s; + -ms-transition-timing-function: ease-out; +} + +.exportPanel-show { + opacity: 1; + background-color: #FFFFBF; + height: 220px; } .exportResult { @@ -55,7 +79,6 @@ background: url('images/save_open.png') 55% 25px no-repeat; } - .closeImage { background: url(images/close.png) 0px 0px no-repeat; height: 15px; @@ -146,7 +169,7 @@ .tablePanel { border-bottom: 2px dashed #FFF; background-color: transparent; - margin: 8px 0px; + margin: 8px 0px; } .tableControlPanel { @@ -200,7 +223,6 @@ font-size: 11px; } - .selectedCell { background-color: #e3e8f3 !important; } @@ -219,7 +241,7 @@ tableBorder td { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; - padding-top: 8px; + padding-top: 8px; } .checkAttribute label { @@ -455,7 +477,7 @@ tableBorder td { font-size: 10pt; } -.heading3-label{ +.heading3-label { font-size: 10pt; padding-left: 2px; font-weight: bold; @@ -466,7 +488,7 @@ tableBorder td { font-size: 10pt; } -.heading4-label{ +.heading4-label { font-size: 9pt; padding-left: 15px; } @@ -476,7 +498,7 @@ tableBorder td { font-size: 10pt; } -.heading5-label{ +.heading5-label { font-size: 8pt; padding-left: 4px; } @@ -686,7 +708,7 @@ gwt-MenuBar { } .hasRichTextToolbar { - + } .gwt-RichTextToolbar {