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
This commit is contained in:
Massimiliano Assante 2013-03-16 17:14:36 +00:00
parent 52d60eca5c
commit 1cd70b45bf
7 changed files with 94 additions and 38 deletions

View File

@ -26,14 +26,16 @@ import com.google.gwt.user.client.ui.PopupPanel;
* <code> CommonCommands </code> 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() {

View File

@ -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() {

View File

@ -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 .

View File

@ -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);

View File

@ -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;
}
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:HTMLPanel styleName="exportPanel">
<g:HTMLPanel styleName="exportPanel" ui:field="myPanel">
<table style="width: 700px; text-align: center;">
<tr>
<td colspan="3">

View File

@ -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 {