implemented create scenario
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@87162 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
86746daad9
commit
b18bea1b92
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/reports-4.6.17-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/reports-4.6.19-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -26,10 +26,10 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/reports-4.6.17-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/reports-4.6.19-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<<<<<<<=.mine
|
||||
>>>>>>>=.r71295
|
||||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.17-SNAPSHOT
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.19-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>reports</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>4.6.17-SNAPSHOT</version>
|
||||
<version>4.6.19-SNAPSHOT</version>
|
||||
<name>gCube Reports Manager</name>
|
||||
<description>
|
||||
gCube Reports Portlet.
|
||||
|
|
|
@ -186,7 +186,7 @@ public class Headerbar extends Composite{
|
|||
|
||||
menuBar.addSeparator();
|
||||
|
||||
MenuItem vmeMenuCreate = getVMEMenuFake("Create");
|
||||
MenuItem vmeMenuCreate = getVMEMenuCreate();
|
||||
menuBar.addItem(vmeMenuCreate);
|
||||
|
||||
separator4 = menuBar.addSeparator();
|
||||
|
@ -415,6 +415,52 @@ public class Headerbar extends Composite{
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
private MenuItem getVMEMenuCreate() {
|
||||
MenuBar importMenu = new MenuBar(true);
|
||||
|
||||
importMenu.setAnimationEnabled(true);
|
||||
MenuItem toReturn = new MenuItem("Create VME-DB", importMenu);
|
||||
toReturn.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
|
||||
|
||||
MenuItem item = new MenuItem("Create new VME", true, new Command() {
|
||||
public void execute() {
|
||||
presenter.importVMETemplate(VMETypeIdentifier.Vme);
|
||||
}
|
||||
});
|
||||
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 Fishing footprint", true, new Command() {
|
||||
public void execute() {
|
||||
presenter.importVMETemplate(VMETypeIdentifier.FisheryAreasHistory);
|
||||
}
|
||||
});
|
||||
importMenu.addItem(item);
|
||||
|
||||
item = new MenuItem("Create new Regional History of VMEs", true, new Command() {
|
||||
public void execute() {
|
||||
presenter.importVMETemplate(VMETypeIdentifier.VMEsHistory);
|
||||
}
|
||||
});
|
||||
importMenu.addItem(item);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
|
|
|
@ -38,6 +38,7 @@ public class CommonCommands {
|
|||
*/
|
||||
public Command openReport;
|
||||
|
||||
|
||||
public Command newTemplate;
|
||||
/**
|
||||
*
|
||||
|
@ -73,7 +74,6 @@ public class CommonCommands {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
openTemplate = new Command() {
|
||||
public void execute() {
|
||||
final int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
|
||||
|
|
|
@ -1208,6 +1208,26 @@ public class Presenter {
|
|||
dlg.show();
|
||||
}
|
||||
|
||||
public void importVMETemplate(final VMETypeIdentifier type) {
|
||||
showLoading();
|
||||
reportService.importVMETemplate(type, new AsyncCallback<Model>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("Could not Load Template Model, error on server.: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Model toLoad) {
|
||||
if (toLoad != null) {
|
||||
loadModel(toLoad, type == VMETypeIdentifier.Vme);
|
||||
}
|
||||
else
|
||||
Window.alert("Could not Load Template Model, error on server.");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void importVMEReport(String reportId, String name, final VMETypeIdentifier type) {
|
||||
showLoading();
|
||||
reportService.importVMEReport(reportId, name, type, new AsyncCallback<Model>() {
|
||||
|
|
|
@ -29,6 +29,8 @@ public interface ReportService extends RemoteService{
|
|||
|
||||
Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType);
|
||||
|
||||
Model importVMETemplate(VMETypeIdentifier refType);
|
||||
|
||||
String save(String filePath, String workspaceFolderId, String ItemName,
|
||||
TypeExporter type, boolean overwrite)
|
||||
throws SaveReportFileException, SaveReportFileExistException;
|
||||
|
|
|
@ -84,4 +84,6 @@ public interface ReportServiceAsync {
|
|||
AsyncCallback<ArrayList<VMEReportBean>> callback);
|
||||
|
||||
void getVMEReportRef2Associate(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
||||
void importVMETemplate(VMETypeIdentifier refType,
|
||||
AsyncCallback<Model> callback);
|
||||
}
|
||||
|
|
|
@ -50,10 +50,15 @@ public interface Images extends ImageBundle {
|
|||
* @return .
|
||||
*/
|
||||
AbstractImagePrototype justifyRight();
|
||||
/**
|
||||
* @return .
|
||||
*/
|
||||
AbstractImagePrototype closeDoc();
|
||||
/**
|
||||
* @return .
|
||||
*/
|
||||
AbstractImagePrototype newdoc();
|
||||
|
||||
/**
|
||||
* @return .
|
||||
*/
|
||||
|
|
|
@ -39,3 +39,4 @@ open_template = Open Template
|
|||
open_report = Open Report from Workspace
|
||||
importing = Import from Template
|
||||
forecolors = Text Color
|
||||
close_report = Close Report
|
|
@ -80,6 +80,8 @@ public class RichTextToolbar extends Composite {
|
|||
commands.get("save").execute();
|
||||
} else if (sender == newdoc) {
|
||||
commands.get("newdoc").execute();
|
||||
}else if (sender == close) {
|
||||
commands.get("newdoc").execute();
|
||||
} else if (sender == open_report) {
|
||||
commands.get("open_report").execute();
|
||||
} else if (sender == open_template) {
|
||||
|
@ -173,6 +175,7 @@ public class RichTextToolbar extends Composite {
|
|||
private PushButton justifyRight;
|
||||
private PushButton save;
|
||||
private PushButton saveDB;
|
||||
private PushButton close;
|
||||
private PushButton newdoc;
|
||||
private PushButton open_template;
|
||||
private PushButton open_report;
|
||||
|
@ -245,6 +248,8 @@ public class RichTextToolbar extends Composite {
|
|||
}
|
||||
//add the save button
|
||||
topPanel.add(save = createPushButton(images.save(), strings.save()));
|
||||
//add the close button
|
||||
topPanel.add(close = createPushButton(images.closeDoc(), strings.close_report()));
|
||||
if (isVme) {
|
||||
topPanel.add(saveDB = createPushButton(images.db_save(), "Commit current in VME-DB"));
|
||||
saveDB.addClickHandler(new ClickHandler() {
|
||||
|
@ -456,6 +461,8 @@ public class RichTextToolbar extends Composite {
|
|||
*/
|
||||
public interface Strings extends Constants {
|
||||
|
||||
String close_report();
|
||||
|
||||
String insertImage();
|
||||
|
||||
String importing();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.reportgenerator.client.uibinder;
|
|||
import org.gcube.portlets.user.reportgenerator.client.Presenter.CommonCommands;
|
||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||
import org.gcube.portlets.user.reportgenerator.client.uibinder.ExportOptions.ExportMode;
|
||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
|
@ -64,7 +65,7 @@ public class OpenOptionsVME extends Composite {
|
|||
p.showVMEImportDialog();
|
||||
break;
|
||||
case OPEN_TEMPLATE:
|
||||
Window.alert("Not yet available");
|
||||
p.importVMETemplate(VMETypeIdentifier.Vme);
|
||||
break;
|
||||
case UPLOAD:
|
||||
Window.alert("Not yet available");
|
||||
|
|
|
@ -1552,6 +1552,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
try {
|
||||
model = new ReportManagerReportBuilder().buildReport(cr);
|
||||
model.setTemplateName(name);
|
||||
//ReportsReader.readReportStructure(model);
|
||||
} catch (ReportBuilderException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
|
@ -1575,8 +1576,34 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model importVMETemplate(VMETypeIdentifier refType) {
|
||||
RsgService rsgClient = new RsgClient(getRSGWSAddress());
|
||||
|
||||
CompiledReport cr = null;
|
||||
if (refType == VMETypeIdentifier.Vme) {
|
||||
_log.info("Importing VME Template");
|
||||
cr = rsgClient.getTemplate(new ReportType(refType.getId()));
|
||||
}
|
||||
else {
|
||||
_log.info("Importing Ref type= " + refType.getId());
|
||||
cr = rsgClient.getTemplate(new ReportType(refType.getId()));
|
||||
|
||||
}
|
||||
Model model = null;
|
||||
try {
|
||||
model = new ReportManagerReportBuilder().buildReport(cr);
|
||||
model.setTemplateName("New " + refType.getDisplayName());
|
||||
} catch (ReportBuilderException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
/**
|
||||
* this method ch
|
||||
* this method look for a ReportsStoreGateway WS available in the infrastructure
|
||||
* @return true if an instance of the ReportsStoreGateway is available in the infrastructure
|
||||
*/
|
||||
private boolean isReportsStoreGatewayAvailable() {
|
||||
|
@ -1606,4 +1633,5 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
else return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class ReportsReader {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/** Non Test methods **/
|
||||
/**
|
||||
* ket method whne reading
|
||||
|
@ -45,16 +46,23 @@ public class ReportsReader {
|
|||
case HEADING:
|
||||
case INSTRUCTION:
|
||||
case TEXT_INPUT:
|
||||
case HIDDEN:
|
||||
System.out.println(sep +"Type: " + rc.getType()+"\n\tId: " + rc.getId() + "\tValue: " + rc.getStringValue() + " props="+rc.getProperties().toString());
|
||||
break;
|
||||
case BOXAREA:
|
||||
BoxesArea ba = (BoxesArea) rc;
|
||||
System.out.println(sep +"Type: " + rc.getType());
|
||||
System.out.println(sep +"Type: " + rc.getType() + ba.getProperties());
|
||||
for (ReportComponent rpc : ba.getChildren()) {
|
||||
Box attrBox = (Box) rpc;
|
||||
System.out.println("\t"+attrBox);
|
||||
}
|
||||
break;
|
||||
case SEQUENCE_LIST:
|
||||
System.out.println(sep +"Type: " + rc.getType());
|
||||
for (ReportComponent rpc : rc.getChildren()) {
|
||||
printReportCompomnent(rpc, sep+"\t");
|
||||
}
|
||||
break;
|
||||
case SEQUENCE:
|
||||
System.out.println(sep +"Type: " + rc.getType());
|
||||
for (ReportComponent rpc : rc.getChildren()) {
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
package org.gcube.portlets.user.reportgenerator.shared;
|
||||
|
||||
public enum VMETypeIdentifier {
|
||||
Vme("Vme"),
|
||||
GeneralMeasure("GeneralMeasure"),
|
||||
InformationSource("InformationSource"),
|
||||
FisheryAreasHistory("FisheryAreasHistory"),
|
||||
VMEsHistory("VMEsHistory"),
|
||||
Rfmo("Rfmo");
|
||||
Vme("Vme", "VME"),
|
||||
GeneralMeasure("GeneralMeasure", "General Measure"),
|
||||
InformationSource("InformationSource", "Information Source"),
|
||||
FisheryAreasHistory("FisheryAreasHistory", "fishing foot print"),
|
||||
VMEsHistory("VMEsHistory", "regional history"),
|
||||
Rfmo("Rfmo", "RFMO");
|
||||
|
||||
private String _id;
|
||||
private String displayName;
|
||||
|
||||
private VMETypeIdentifier(String id) {
|
||||
private VMETypeIdentifier(String id, String _displayName) {
|
||||
this._id = id;
|
||||
this.displayName = _displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,4 +22,9 @@ public enum VMETypeIdentifier {
|
|||
public String getId() {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
|
||||
.optionDeleteVME {
|
||||
background: url('images/deleteVME.png') 55% 25px no-repeat;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.exportPanel {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Reference in New Issue