refactored with new Workspace Navigator instead of Workspace light tree

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@119132 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-09-28 17:05:00 +00:00
parent 03769055d4
commit 8ca1678cf4
13 changed files with 365 additions and 323 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/reports-4.13.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/reports-5.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/reports-4.13.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/reports-5.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -4,7 +4,7 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="workspace-light-tree-2.14.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-light-tree/workspace-light-tree">
<dependent-module archiveName="gcube-reporting-modeler-1.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-modeler/gcube-reporting-modeler">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="gcube-reporting-library-3.6.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-reporting-library/gcube-reporting-library">

1
.tern-project Normal file
View File

@ -0,0 +1 @@
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>reports</artifactId>
<packaging>war</packaging>
<version>4.13.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<name>gCube Reports Manager</name>
<description>
gCube Reports Portlet.
@ -158,8 +158,8 @@
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-light-tree</artifactId>
<version>[2.13.1-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<artifactId>workspace-explorer</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.admin</groupId>

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client;
import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
@ -12,10 +13,10 @@ import org.gcube.portlets.user.reportgenerator.client.dialog.PagePropertiesDialo
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.lighttree.client.event.PopupEvent;
import org.gcube.portlets.widgets.lighttree.client.event.PopupHandler;
import org.gcube.portlets.widgets.lighttree.client.load.WorkspaceLightTreeLoadPopup;
import org.gcube.portlets.widgets.wsexplorer.shared.*;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
@ -53,7 +54,7 @@ public class Headerbar extends Composite{
private static final String EXPORT_FIMES = "Export to FiMES XML";
private static final String EXPORT_XML = "Export to XML";
private static final String IMPORT_VME = "Edit VME";
// private static final String EXPORT_ENCRYPTED_REPORT = "Save an Encrypted Version to Desktop";
// private static final String EXPORT_ENCRYPTED_REPORT = "Save an Encrypted Version to Desktop";
private static final String VIEW_USER_COMMENTS = "View user comments";
@ -75,33 +76,33 @@ public class Headerbar extends Composite{
//private MenuItem optionPDF;
private MenuItem importModel;
private MenuItem addBiblioEntry;
private MenuItem viewBiblio;
private MenuItem manageBiblio;
private MenuItem optionHTML;
private MenuItem optionDOCX;
private MenuItem optionPDF;
private MenuItem optionFimes;
private MenuItem optionXML;
private MenuItem optionEncryptedModel;
private MenuItem viewMetadata;
private MenuItem viewComments;
private MenuItem discardSection;
private MenuItem importVME;
private MenuItem importVMERef;
@ -145,8 +146,8 @@ public class Headerbar extends Composite{
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
mainLayout.setSize("100%", "24px");
mainLayout.setStyleName("menubar");
@ -171,7 +172,7 @@ public class Headerbar extends Composite{
initWidget(mainLayout);
}
public void setMenuForVME() {
menuBar.removeItem(viewMenu);
menuBar.removeItem(sectionsMenu);
@ -180,25 +181,25 @@ public class Headerbar extends Composite{
menuBar.removeSeparator(separator2);
menuBar.removeSeparator(separator3);
menuBar.removeItem(exportMenu);
vmeMenu = getVMEMenuEdit();
menuBar.addItem(vmeMenu);
menuBar.addSeparator();
MenuItem vmeMenuCreate = getVMEMenuCreate();
menuBar.addItem(vmeMenuCreate);
separator4 = menuBar.addSeparator();
MenuItem vmeMenuDelete = getVMEMenuDelete();
menuBar.addItem(vmeMenuDelete);
menuBar.addSeparator();
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
}
public void setMenuForWorkflowDocument(boolean canUpdate) {
presenter.setMenuForWorkflowDocument(true);
menuBar.removeItem(fileMenu);
@ -224,7 +225,7 @@ public class Headerbar extends Composite{
presenter.updateWorkflowDocument(false);
}
};
if (canUpdate)
workflowMenu.addItem("Update this document", updateWfDocument);
//workflowMenu.addItem("Show previous changes", showChanges);
@ -244,8 +245,8 @@ public class Headerbar extends Composite{
separator4 = menuBar.addSeparator();
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
ReportGenerator.get().getToolbarPanel().clear();
ReportGenerator.get().getToolbarPanel().add(new HTML("&nbsp;&nbsp;", true));
enableExports();
@ -277,15 +278,15 @@ public class Headerbar extends Composite{
};
return openNothing;
}
public Command getDisabledExportMenuItemCmd() {
Command disabledExportMenuItemCmd = new Command() {
public void execute() {
MessageBox.alert("Alert",
"Export is disabled for templates, please save this template as a Report and retry." +
" If you just saved this Template as a Report please save it and reopen the Report", null);
" If you just saved this Template as a Report please save it and reopen the Report", null);
}
};
return disabledExportMenuItemCmd;
@ -302,14 +303,14 @@ public class Headerbar extends Composite{
};
return openNothing;
}
Command addCitationCmd = new Command() {
public void execute() {
presenter.openAddCitationDialog();
}
};
Command viewBiblioCmd = new Command() {
public void execute() {
if (presenter.hasBibliography()) {
@ -320,7 +321,7 @@ public class Headerbar extends Composite{
}
}
};
Command manageBiblioCmd = new Command() {
public void execute() {
if (presenter.hasBibliography()) {
@ -331,7 +332,7 @@ public class Headerbar extends Composite{
}
}
};
private MenuItem getVMEMenuDelete() {
MenuBar createMenu = new MenuBar(true);
@ -346,7 +347,7 @@ public class Headerbar extends Composite{
});
createMenu.addItem(item);
createMenu.addSeparator();
item = new MenuItem("Delete VME General Measure", true, new Command() {
public void execute() {
presenter.showVMEDeleteDialog(VMETypeIdentifier.GeneralMeasure);
@ -373,7 +374,7 @@ public class Headerbar extends Composite{
createMenu.addItem(item);
return toReturn;
}
private MenuItem getVMEMenuEdit() {
MenuBar importMenu = new MenuBar(true);
@ -391,51 +392,51 @@ public class Headerbar extends Composite{
importMenu.addItem(importVME);
importMenu.addSeparator();
MenuItem item = new MenuItem("Edit VME General Measures", true, new Command() {
public void execute() {
presenter.showVMEReportRefImportDialog(VMETypeIdentifier.GeneralMeasure);
}
});
importMenu.addItem(item);
item = new MenuItem("Edit Information Sources", true, new Command() {
public void execute() {
presenter.showVMEReportRefImportDialog(VMETypeIdentifier.InformationSource);
}
});
importMenu.addItem(item);
item = new MenuItem("Edit Bottom fishing areas", true, new Command() {
public void execute() {
presenter.showVMEReportRefImportDialog(VMETypeIdentifier.FisheryAreasHistory);
}
});
importMenu.addItem(item);
item = new MenuItem("Edit Regional overview of VMEs", true, new Command() {
public void execute() {
presenter.showVMEReportRefImportDialog(VMETypeIdentifier.VMEsHistory);
}
});
importMenu.addItem(item);
// item = new MenuItem("Edit Rfmo", true, new Command() {
// public void execute() {
// presenter.showVMEReportRefImportDialog(VMETypeIdentifier.Rfmo);
// }
// });
// importMenu.addItem(item);
//
// importMenu.addSeparator();
// MenuItem exportVME = new MenuItem("Export Current to VME-DB", true, importVMEReport);
// importMenu.addItem(exportVME);
// item = new MenuItem("Edit Rfmo", true, new Command() {
// public void execute() {
// presenter.showVMEReportRefImportDialog(VMETypeIdentifier.Rfmo);
// }
// });
// importMenu.addItem(item);
//
// importMenu.addSeparator();
// MenuItem exportVME = new MenuItem("Export Current to VME-DB", true, importVMEReport);
// importMenu.addItem(exportVME);
return toReturn;
}
private MenuItem getVMEMenuCreate() {
MenuBar importMenu = new MenuBar(true);
@ -450,28 +451,28 @@ public class Headerbar extends Composite{
});
importMenu.addItem(item);
importMenu.addSeparator();
item = new MenuItem("Create new General Measure", true, new Command() {
public void execute() {
presenter.importVMETemplate(VMETypeIdentifier.GeneralMeasure);
}
});
importMenu.addItem(item);
item = new MenuItem("Create new Information Source", true, new Command() {
public void execute() {
presenter.importVMETemplate(VMETypeIdentifier.InformationSource);
}
});
importMenu.addItem(item);
item = new MenuItem("Create new Bottom fishing areas", true, new Command() {
public void execute() {
presenter.importVMETemplate(VMETypeIdentifier.FisheryAreasHistory);
}
});
importMenu.addItem(item);
item = new MenuItem("Create new Regional overview of VMEs", true, new Command() {
public void execute() {
presenter.importVMETemplate(VMETypeIdentifier.VMEsHistory);
@ -519,7 +520,7 @@ public class Headerbar extends Composite{
insertsMenu.addItem(viewComments);
return toReturn;
}
private MenuItem getExportsMenu() {
MenuBar exportsMenu = new MenuBar(true);
@ -531,18 +532,18 @@ public class Headerbar extends Composite{
optionHTML = new MenuItem("<font color=\"gray\">"+ EXPORT_HTML +"</font>", true, getDisabledExportMenuItemCmd());
optionFimes = new MenuItem("<font color=\"gray\">"+ EXPORT_FIMES +"</font>", true, getDisabledExportMenuItemCmd());
optionXML = new MenuItem("<font color=\"gray\">"+ EXPORT_XML +"</font>", true, getDisabledExportMenuItemCmd());
// optionEncryptedModel = new MenuItem("<font color=\"gray\">"+ EXPORT_ENCRYPTED_REPORT +"</font>", true, getDisabledExportMenuItemCmd());
// optionEncryptedModel = new MenuItem("<font color=\"gray\">"+ EXPORT_ENCRYPTED_REPORT +"</font>", true, getDisabledExportMenuItemCmd());
exportsMenu.addItem(optionDOCX);
exportsMenu.addItem(optionHTML);
exportsMenu.addItem(optionPDF);
exportsMenu.addItem(optionXML);
exportsMenu.addSeparator();
// exportsMenu.addItem(optionEncryptedModel);
// exportsMenu.addItem(optionEncryptedModel);
//optionsMenu.addItem(optionPDF);
//exportsMenu.addItem(optionFimes);
return toReturn;
}
@ -563,19 +564,19 @@ public class Headerbar extends Composite{
presenter.toggleReportStructure();
}
};
// Create the Options menu
MenuBar optionsMenu = new MenuBar(true);
optionsMenu.setAnimationEnabled(true);
MenuItem toReturn = new MenuItem("View", optionsMenu);
optionsMenu.addItem("View Properties", openPageProperties);
optionsMenu.addItem("View/Hide Structure", showReportStructure);
optionsMenu.addSeparator();
return toReturn;
}
@ -592,28 +593,28 @@ public class Headerbar extends Composite{
optionHTML.setHTML(EXPORT_HTML);
optionHTML.setScheduledCommand(generateHTML);
optionFimes.setHTML(EXPORT_FIMES);
optionFimes.setScheduledCommand(generateFimes);
optionXML.setHTML(EXPORT_XML);
optionXML.setScheduledCommand(generatedXML);
// optionEncryptedModel.setHTML(EXPORT_ENCRYPTED_REPORT);
// optionEncryptedModel.setHTML(EXPORT_ENCRYPTED_REPORT);
//
// importModel.setHTML("Import from Template or Report");
// importModel.setScheduledCommand(importModelOrReport);
//
// viewMetadata.setHTML("View Metadata");
// viewMetadata.setScheduledCommand(openMetadata);
// importModel.setHTML("Import from Template or Report");
// importModel.setScheduledCommand(importModelOrReport);
//
// viewMetadata.setHTML("View Metadata");
// viewMetadata.setScheduledCommand(openMetadata);
// discardSection.setHTML("Discard current");
// discardSection.setScheduledCommand(discardSectionCom);
// discardSection.setHTML("Discard current");
// discardSection.setScheduledCommand(discardSectionCom);
}
/**
* rewrite with setHTML to remove the gray color
* @param d4sArea
@ -631,8 +632,8 @@ public class Headerbar extends Composite{
private MenuItem getFileMenu() {
CommonCommands cmd = new CommonCommands(presenter);
Command openHelp = new Command() {
public void execute() {
@ -655,7 +656,7 @@ public class Headerbar extends Composite{
};
Command saveReportAs = new Command() {
public void execute() {
@ -677,8 +678,8 @@ public class Headerbar extends Composite{
}
};
// Create the file menu
MenuBar fileMenu = new MenuBar(true);
@ -691,10 +692,10 @@ public class Headerbar extends Composite{
fileMenu.addItem("Save", saveReport);
fileMenu.addItem("Save As ..", saveReportAs);
fileMenu.addSeparator();
// fileMenu.addItem("Import from FiMES XML", importFimes);
// fileMenu.addItem("Import from FiMES XML", importFimes);
fileMenu.addItem("Close Report", cmd.newTemplate);
fileMenu.addSeparator();
// fileMenu.addItem("? Open User's Guide", openHelp);
// fileMenu.addItem("? Open User's Guide", openHelp);
return toReturn;
}
@ -707,13 +708,13 @@ public class Headerbar extends Composite{
}
//************** COMMANDS ********************************////
ScheduledCommand generateFimes = new ScheduledCommand() {
public void execute() {
presenter.generateFiMES(templateModel);
}
};
ScheduledCommand generateDOCX = new ScheduledCommand() {
public void execute() {
presenter.generateManifestation(templateModel, ExportManifestationType.DOCX);
@ -722,7 +723,7 @@ public class Headerbar extends Composite{
ScheduledCommand generatePDF = new ScheduledCommand() {
public void execute() {
// Window.alert("PDF Exporting may not be fully working, you can also generate a PDF using your Word Processor application starting from the docx exported file");
// Window.alert("PDF Exporting may not be fully working, you can also generate a PDF using your Word Processor application starting from the docx exported file");
presenter.generateManifestation(templateModel, ExportManifestationType.PDF);
}
};
@ -732,35 +733,42 @@ public class Headerbar extends Composite{
presenter.generateManifestation(templateModel, ExportManifestationType.HTML);
}
};
ScheduledCommand generatedXML = new ScheduledCommand() {
public void execute() {
presenter.generateManifestation(templateModel, ExportManifestationType.XML);
}
};
ScheduledCommand generateEncryptedModel = new ScheduledCommand() {
@Override
public void execute() {
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
GWT.runAsync(WorkspaceExplorerSelectDialog.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup( "Select the Report (or Template) to encrypt ", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE, ItemType.REPORT);
wpTreepopup.setSelectableTypes(ItemType.REPORT_TEMPLATE, ItemType.REPORT);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
final String itemId = event.getSelectedItem().getId();
final String url = GWT.getModuleBaseURL() + "downloadEncryptedReport?itemId=" + itemId;
Window.open(url, "_blank", "");
}
}
ItemType[] types = {ItemType.REPORT_TEMPLATE, ItemType.REPORT};
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select the Report (or Template) to encrypt", Arrays.asList(types), Arrays.asList(types));
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
final String itemId = item.getId();
final String url = GWT.getModuleBaseURL() + "downloadEncryptedReport?itemId=" + itemId;
Window.open(url, "_blank", "");
}
});
wpTreepopup.center();
@Override
public void onFailed(Throwable throwable) {
Window.alert("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {}
@Override
public void onNotValidSelection() {
}
};
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
wpTreepopup.show();
}
@ -770,24 +778,24 @@ public class Headerbar extends Composite{
});
}
};
//************** COMMANDS ********************************////
Command addBiblioEntryCommand = new Command() {
public void execute() {
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
presenter.openAddCitationDialog();
}
@Override
public void onFailure(Throwable reason) {
}
});
}
};
@ -797,7 +805,7 @@ public class Headerbar extends Composite{
Command openMetadata = new Command() {
public void execute() {
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
int left = mainLayout.getAbsoluteLeft() + 50;
@ -820,12 +828,12 @@ public class Headerbar extends Composite{
dlg.setAnimationEnabled(true);
dlg.show();
}
@Override
public void onFailure(Throwable reason) {}
});
}
};
@ -843,45 +851,52 @@ public class Headerbar extends Composite{
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Pick the item you want to import from", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE, ItemType.REPORT);
ItemType[] types = {ItemType.REPORT_TEMPLATE, ItemType.REPORT};
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Pick the item you want to import from", Arrays.asList(types), Arrays.asList(types));
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(event.getSelectedItem(), presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
presenter.getHeader().enableExports();
}
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(item, presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
presenter.getHeader().enableExports();
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
@Override
public void onFailed(Throwable throwable) {
Window.alert("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {}
@Override
public void onNotValidSelection() {
}
};
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
wpTreepopup.show();
@Override
public void onFailure(Throwable reason) {
}
});
}
}
};
/**
*
* @return .
*/
public CellPanel getMainLayout() {
return mainLayout;
}
}
@Override
public void onFailure(Throwable reason) {
}
});
}
}
};
/**
*
* @return .
*/
public CellPanel getMainLayout() {
return mainLayout;
}
}

View File

@ -1,13 +1,15 @@
package org.gcube.portlets.user.reportgenerator.client.Presenter;
import java.util.Arrays;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.dialog.ImporterDialog;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.lighttree.client.event.PopupEvent;
import org.gcube.portlets.widgets.lighttree.client.event.PopupHandler;
import org.gcube.portlets.widgets.lighttree.client.load.WorkspaceLightTreeLoadPopup;
import org.gcube.portlets.widgets.lighttree.client.save.WorkspaceLightTreeSavePopup;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.save.WorkspaceExplorerSaveDialog;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.extjs.gxt.ui.client.event.ColorPaletteEvent;
import com.extjs.gxt.ui.client.event.Events;
@ -86,30 +88,31 @@ public class CommonCommands {
openTemplate = new Command() {
public void execute() {
final int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
final int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
GWT.runAsync(WorkspaceExplorerSelectDialog.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Select a Template to open", true, true);
wpTreepopup.setWidth("450px");
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.setSelectableTypes(ItemType.REPORT_TEMPLATE);
ItemType[] types = {ItemType.REPORT_TEMPLATE};
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select a Template to open", Arrays.asList(types), Arrays.asList(types));
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
presenter.openTemplate(event.getSelectedItem().getName(), event.getSelectedItem().getId(), true);
}
}
@Override
public void onSelectedItem(Item item) {
presenter.openTemplate(item.getName(), item.getId(), true);
wpTreepopup.hide();
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
@Override
public void onFailed(Throwable throwable) {
Window.alert("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {}
@Override
public void onNotValidSelection() {
}
};
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
@ -120,37 +123,39 @@ public class CommonCommands {
};
openReport = new Command() {
public void execute() {
public void execute() {
GWT.runAsync(WorkspaceExplorerSelectDialog.class, new RunAsyncCallback() {
public void onSuccess() {
ItemType[] types = {ItemType.REPORT};
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select a Report to open", Arrays.asList(types), Arrays.asList(types));
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.setWidth("450px");
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();
}
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
presenter.openTemplate(item.getName(), item.getId(), true);
wpTreepopup.hide();
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
@Override
public void onFailed(Throwable throwable) {
Window.alert("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {}
@Override
public void onNotValidSelection() {
}
};
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
});
}
};
pickColor = new Command() {
@ -186,39 +191,43 @@ public class CommonCommands {
dlg.setAnimationEnabled(true);
dlg.show();
}
else {
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
else {
GWT.runAsync(WorkspaceExplorerSelectDialog.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Pick the item you want to import from", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.setWidth("450px");
ItemType[] types = {ItemType.REPORT_TEMPLATE};
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Pick the item you want to import from", Arrays.asList(types), Arrays.asList(types));
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(event.getSelectedItem(), presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
}
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(item, presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
wpTreepopup.hide();
}
});
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
@Override
public void onFailed(Throwable throwable) {
Window.alert("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {}
@Override
public void onNotValidSelection() {
}
};
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
});
}
}
};
@ -241,32 +250,39 @@ public class CommonCommands {
} //end constructor
public void saveReportAsDialog() {
final int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
final int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
GWT.runAsync(WorkspaceLightTreeSavePopup.class, new RunAsyncCallback() {
GWT.runAsync(WorskpaceExplorerSaveNotificationListener.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeSavePopup wpTreepopup = new WorkspaceLightTreeSavePopup("Save Report, choose folder please:", true);
wpTreepopup.setWidth("450px");
wpTreepopup.setSelectableTypes( ItemType.FOLDER, ItemType.ROOT);
wpTreepopup.setShowEmptyFolders(true);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
ItemType[] types = {ItemType.FOLDER};
final WorkspaceExplorerSaveDialog navigator = new WorkspaceExplorerSaveDialog("Save Report, choose folder please:", Arrays.asList(types));
WorskpaceExplorerSaveNotificationListener listener = new WorskpaceExplorerSaveNotificationListener(){
@Override
public void onSaving(Item parent, String fileName) {
//checking user input
String inputUser = event.getName();
String inputUser = fileName;
String newTemplateName = inputUser;
if (presenter.getModel().getTemplateName().compareTo(newTemplateName) != 0) {
newTemplateName = newTemplateName.trim();
presenter.getModel().setTemplateName(newTemplateName+".d4sR");
}
presenter.changeTemplateName(newTemplateName);
presenter.saveReport(event.getSelectedItem().getId(), newTemplateName);
presenter.saveReport(parent.getId(), newTemplateName);
navigator.hide();
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
@Override
public void onAborted() {
GWT.log("onAborted");
}
@Override
public void onFailed(Throwable throwable) {
GWT.log("onFailed");
}
};
navigator.addWorkspaceExplorerSaveNotificationListener(listener);
navigator.show();
}
public void onFailure(Throwable reason) {

View File

@ -4,8 +4,8 @@ import org.gcube.portlets.d4sreporting.common.shared.Model;
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.widgets.lighttree.client.Item;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
@ -11,10 +12,10 @@ import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.user.reportgenerator.shared.ReportImage;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.lighttree.client.event.PopupEvent;
import org.gcube.portlets.widgets.lighttree.client.event.PopupHandler;
import org.gcube.portlets.widgets.lighttree.client.load.WorkspaceLightTreeLoadPopup;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
@ -364,27 +365,34 @@ public class ClientImage extends Composite {
}
private void openFileExplorer(final int left, final int top) {
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
GWT.runAsync(WorkspaceExplorerSelectDialog.class, new RunAsyncCallback() {
public void onSuccess() {
ItemType[] types = {ItemType.IMAGE_DOCUMENT, ItemType.EXTERNAL_IMAGE};
final WorkspaceExplorerSelectDialog wpTreepopup = new WorkspaceExplorerSelectDialog("Select the Image", Arrays.asList(types), Arrays.asList(types));
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Select the Image", true, true);
wpTreepopup.setShowableTypes(ItemType.IMAGE_DOCUMENT, ItemType.EXTERNAL_IMAGE);
wpTreepopup.setSelectableTypes(ItemType.IMAGE_DOCUMENT, ItemType.EXTERNAL_IMAGE);
wpTreepopup.setWidth("450px");
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
if (event.getSelectedItem().getType() == ItemType.IMAGE_DOCUMENT)
fetchImage(event.getSelectedItem().getId(), true, true);
else
fetchImage(event.getSelectedItem().getId(), false, true);
}
}
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
if (item.getType() == ItemType.IMAGE_DOCUMENT)
fetchImage(item.getId(), true, true);
else
fetchImage(item.getId(), false, true);
wpTreepopup.hide();
}
});
wpTreepopup.center();
wpTreepopup.show();
@Override
public void onFailed(Throwable throwable) {
Window.alert("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {}
@Override
public void onNotValidSelection() {
}
};
wpTreepopup.addWorkspaceExplorerSelectNotificationListener(listener);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {

View File

@ -1,13 +1,15 @@
package org.gcube.portlets.user.reportgenerator.client.uibinder;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import java.util.Arrays;
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
import org.gcube.portlets.user.reportgenerator.client.ToolboxPanel;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.widgets.lighttree.client.ItemType;
import org.gcube.portlets.widgets.lighttree.client.event.PopupEvent;
import org.gcube.portlets.widgets.lighttree.client.event.PopupHandler;
import org.gcube.portlets.widgets.lighttree.client.save.WorkspaceLightTreeSavePopup;
import org.gcube.portlets.widgets.exporter.shared.TypeExporter;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.save.WorkspaceExplorerSaveDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
@ -104,14 +106,14 @@ public class ExportOptions extends Composite {
});
break;
case SAVE_AS:
WorkspaceLightTreeSavePopup wpTree = new WorkspaceLightTreeSavePopup("Save Report, select the folder:", true);
wpTree.setSelectableTypes(ItemType.FOLDER, ItemType.ROOT);
wpTree.setShowEmptyFolders(true);
wpTree.addPopupHandler(new PopupHandler(){
ItemType[] types = {ItemType.FOLDER};
final WorkspaceExplorerSaveDialog navigator = new WorkspaceExplorerSaveDialog("Save Report, choose folder please:", Arrays.asList(types));
WorskpaceExplorerSaveNotificationListener listener = new WorskpaceExplorerSaveNotificationListener(){
@Override
public void onPopup(PopupEvent event) {
rpc.save(filePath, event.getSelectedItem().getId(), event.getName(), type, true, new AsyncCallback<String>() {
public void onSaving(Item parent, String fileName) {
rpc.save(filePath, parent.getId(), fileName, type, true, new AsyncCallback<String>() {
@Override
public void onSuccess(String createdItemId) {
p.clearExportPanel();
@ -122,10 +124,22 @@ public class ExportOptions extends Composite {
public void onFailure(Throwable caught) {
Window.alert("Error: " + caught.getMessage());
}
});
}});
wpTree.show();
wpTree.center();
});
navigator.hide();
}
@Override
public void onAborted() {
GWT.log("onAborted");
}
@Override
public void onFailed(Throwable throwable) {
GWT.log("onFailed");
}
};
navigator.addWorkspaceExplorerSaveNotificationListener(listener);
navigator.show();
break;
case
SAVE_OPEN:

View File

@ -5,8 +5,8 @@
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<set-property name="user.agent" value="safari,gecko1_8,ie9" />
<inherits
name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
<!-- inherits WorkspaceExplorer widget -->
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='org.gcube.portlets.d4sreporting.common.Reporting' />
<inherits name='com.extjs.gxt.ui.GXT' />

View File

@ -7,8 +7,11 @@
<link rel="stylesheet" type="text/css" href="gxt/css/gxt-all.css" />
<link type="text/css" rel="stylesheet" href="ReportGenerator.css">
<script src="reports/js/jquery-1.10.1.min.js"></script>
<script src="reports/js/bootstrap.min.js"></script>
<script type="text/javascript" language="javascript" src="reports/reports.nocache.js"></script>
<script type="text/javascript" src="reports/reports.nocache.js"></script>
</head>
<body>
<div id="ReportGeneratorDIV"></div>

View File

@ -9,5 +9,8 @@
--%>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/gxt/css/gxt-all.css" />
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/ReportGenerator.css" />
<script src='<%=request.getContextPath()%>/reports/js/jquery-1.10.1.min.js'></script>
<script src='<%=request.getContextPath()%>/reports/js/bootstrap.min.js'></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/reports/reports.nocache.js"></script>
<div id="ReportGeneratorDIV"></div>

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_ID" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
id="WebApp_ID" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>ReportGenerator-portlet</display-name>
<!-- Servlets -->
<servlet>
@ -11,25 +14,14 @@
<url-pattern>/reports/ReportServiceImpl</url-pattern>
</servlet-mapping>
<!-- quicktourServlet -->
<!-- <servlet> -->
<!-- <servlet-name>quicktourServlet</servlet-name> -->
<!-- <servlet-class>org.gcube.portlets.widgets.guidedtour.server.TourServiceImpl</servlet-class> -->
<!-- </servlet> -->
<!-- <servlet-mapping> -->
<!-- <servlet-name>quicktourServlet</servlet-name> -->
<!-- <url-pattern>/reports/quicktourServlet</url-pattern> -->
<!-- </servlet-mapping> -->
<servlet>
<servlet-name>WorkspaceLightService</servlet-name>
<servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class>
<servlet-name>workspaceExplorer</servlet-name>
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WorkspaceLightService</servlet-name>
<url-pattern>/reports/WorkspaceLightService</url-pattern>
<servlet-name>workspaceExplorer</servlet-name>
<url-pattern>/reports/WorkspaceExplorerService</url-pattern>
</servlet-mapping>
@ -42,10 +34,10 @@
<servlet-name>uploadprogress</servlet-name>
<url-pattern>/reports/uploadprogress</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>DownloadService</servlet-name>
<servlet-class>org.gcube.portlets.user.reportgenerator.server.servlet.DownloadImageServlet</servlet-class>
<servlet-class>org.gcube.portlets.user.reportgenerator.server.servlet.DownloadImageServlet</servlet-class>
</servlet>
<servlet-mapping>
@ -78,16 +70,6 @@
</servlet-mapping>
<!-- Fimes import expot part -->
<!--servlet> <servlet-name>fimesexporterServlet</servlet-name> <servlet-class>org.gube.portlets.user.reporting.fimesexporter.server.FimesExporterServiceImpl</servlet-class>
</servlet> <servlet-mapping> <servlet-name>fimesexporterServlet</servlet-name>
<url-pattern>/reportgenerator/exporter</url-pattern> </servlet-mapping -->
<!-- servlet> <servlet-name>fileUploaderServlet</servlet-name> <servlet-class>org.gcube.portlets.user.reporting.fimesimporter.server.FimesFileUploaderServlet</servlet-class>
</servlet> <servlet-mapping> <servlet-name>fileUploaderServlet</servlet-name>
<url-pattern>/reportgenerator/fimesfileuploaderservlet</url-pattern> </servlet-mapping -->
<servlet>
<servlet-name>convertServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.exporter.server.ReportExporterServiceImpl</servlet-class>