added multi reference option in UI
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@86210 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
17e5838657
commit
3d07be06cf
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/reports-4.6.4-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/reports-4.6.6-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -31,5 +31,5 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/reports-4.6.4-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/reports-4.6.6-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.4-SNAPSHOT
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.6.6-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -8,15 +8,6 @@
|
|||
<dependent-module archiveName="gcube-reporting-modeler-1.1.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="reports-store-gateway-client-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-client/reports-store-gateway-client">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="reports-store-gateway-support-model-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-support-model/reports-store-gateway-support-model">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="reports-store-gateway-interface-dto-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/reports-store-gateway-interface-dto/reports-store-gateway-interface-dto">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="document-workflow-library-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/document-workflow-library/document-workflow-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -12,8 +12,8 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>reports</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>4.6.4-SNAPSHOT</version>
|
||||
<name>gCube Reports Portlet</name>
|
||||
<version>4.6.6-SNAPSHOT</version>
|
||||
<name>gCube Reports Manager</name>
|
||||
<description>
|
||||
gCube Reports Portlet.
|
||||
</description>
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.extjs.gxt.ui.client.widget.MessageBox;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.dom.client.Style.WhiteSpace;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.CellPanel;
|
||||
|
@ -113,7 +114,7 @@ public class Headerbar extends Composite{
|
|||
MenuItem sectionsMenu;
|
||||
MenuItem biblioMenu;
|
||||
MenuItem exportMenu;
|
||||
MenuItem importMenu;
|
||||
MenuItem vmeMenu;
|
||||
MenuItemSeparator separator1;
|
||||
MenuItemSeparator separator2;
|
||||
MenuItemSeparator separator3;
|
||||
|
@ -145,8 +146,9 @@ public class Headerbar extends Composite{
|
|||
exportMenu = getExportsMenu();
|
||||
menuBar.addItem(exportMenu);
|
||||
menuBar.addSeparator();
|
||||
importMenu = getImportMenu();
|
||||
menuBar.addItem(importMenu);
|
||||
vmeMenu = getVMEMenu();
|
||||
menuBar.addItem(vmeMenu);
|
||||
|
||||
|
||||
mainLayout.setSize("100%", "24px");
|
||||
mainLayout.setStyleName("menubar");
|
||||
|
@ -305,6 +307,41 @@ public class Headerbar extends Composite{
|
|||
}
|
||||
};
|
||||
|
||||
private MenuItem getVMEMenu() {
|
||||
MenuBar importMenu = new MenuBar(true);
|
||||
|
||||
importMenu.setAnimationEnabled(true);
|
||||
MenuItem toReturn = new MenuItem("VME Options", importMenu);
|
||||
toReturn.getElement().getStyle().setWhiteSpace(WhiteSpace.NOWRAP);
|
||||
|
||||
Command importVMEReport = new Command() {
|
||||
public void execute() {
|
||||
presenter.showVMEImportDialog();
|
||||
}
|
||||
};
|
||||
|
||||
importVME = new MenuItem(IMPORT_VME, true, importVMEReport);
|
||||
|
||||
importMenu.addItem(importVME);
|
||||
importMenu.addSeparator();
|
||||
//add the submenu items for editing report refs
|
||||
for (final VMETypeIdentifier type : VMETypeIdentifier.values()) {
|
||||
if (type != VMETypeIdentifier.Vme) {
|
||||
MenuItem item = new MenuItem("Edit " + type.getId(), true, new Command() {
|
||||
public void execute() {
|
||||
presenter.showVMEReportRefImportDialog(type);
|
||||
}
|
||||
});
|
||||
importMenu.addItem(item);
|
||||
}
|
||||
}
|
||||
importMenu.addSeparator();
|
||||
MenuItem exportVME = new MenuItem("Export Current to VME-DB", true, importVMEReport);
|
||||
importMenu.addItem(exportVME);
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
|
@ -344,40 +381,6 @@ public class Headerbar extends Composite{
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
private MenuItem getImportMenu() {
|
||||
MenuBar importMenu = new MenuBar(true);
|
||||
|
||||
importMenu.setAnimationEnabled(true);
|
||||
MenuItem toReturn = new MenuItem("Import", importMenu);
|
||||
|
||||
Command importVMEReport = new Command() {
|
||||
public void execute() {
|
||||
presenter.showVMEImportDialog();
|
||||
}
|
||||
};
|
||||
|
||||
importVME = new MenuItem(IMPORT_VME, true, importVMEReport);
|
||||
|
||||
MenuBar importVMERef = new MenuBar(true);
|
||||
MenuItem importVMERefItem = new MenuItem(IMPORT_VME_REF, importVMERef);
|
||||
|
||||
//add the submenu items for report refs
|
||||
for (final VMETypeIdentifier type : VMETypeIdentifier.values()) {
|
||||
if (type != VMETypeIdentifier.Vme) {
|
||||
MenuItem item = new MenuItem(type.getId(), true, new Command() {
|
||||
public void execute() {
|
||||
presenter.showVMERefAssociateDialog(type);
|
||||
}
|
||||
});
|
||||
importVMERef.addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
importMenu.addItem(importVME);
|
||||
importMenu.addItem(importVMERefItem);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private MenuItem getExportsMenu() {
|
||||
MenuBar exportsMenu = new MenuBar(true);
|
||||
|
||||
|
|
|
@ -145,15 +145,16 @@ public class Presenter {
|
|||
eventBus.addHandler(SelectedReportEvent.TYPE, new SelectedReportEventHandler() {
|
||||
@Override
|
||||
public void onReportSelected(SelectedReportEvent event) {
|
||||
if (event.getType() == VMETypeIdentifier.Vme) {
|
||||
importVMEReport(event.getId());
|
||||
} else {
|
||||
if (event.isAssociation()) {
|
||||
try {
|
||||
associateVMRReportRef(event.getType(), event.getId());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
importVMEReport(event.getId(), event.getType());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -190,10 +191,10 @@ public class Presenter {
|
|||
|
||||
switch (event.getOperationResult()) {
|
||||
case SAVED:
|
||||
refreshWorkspace();
|
||||
//refreshWorkspace();
|
||||
break;
|
||||
case SAVED_OPEN:
|
||||
refreshWorkspace();
|
||||
// refreshWorkspace();
|
||||
toolBoxPanel.showExportedVersion(event.getItemId(), event.getItemId());
|
||||
break;
|
||||
default:
|
||||
|
@ -263,7 +264,7 @@ public class Presenter {
|
|||
|
||||
public void onSuccess(Model wfReport) {
|
||||
dlg.hide();
|
||||
loadModel(wfReport);
|
||||
loadModel(wfReport, true);
|
||||
header.setMenuForWorkflowDocument(sessionInfo.isEditable());
|
||||
titleBar.addWorkflowButtons(true);
|
||||
pollServiceForLockRenewal();
|
||||
|
@ -278,7 +279,7 @@ public class Presenter {
|
|||
public void onSuccess(Model result) {
|
||||
dlg.hide();
|
||||
if (result != null) {
|
||||
loadModel(result);
|
||||
loadModel(result, true);
|
||||
header.enableExports();
|
||||
} else
|
||||
commonCommands.newTemplate.execute();
|
||||
|
@ -318,7 +319,7 @@ public class Presenter {
|
|||
@Override
|
||||
public void onSuccess(Model toLoad) {
|
||||
if (toLoad != null)
|
||||
loadModel(toLoad);
|
||||
loadModel(toLoad, true);
|
||||
else
|
||||
Window.alert("Could not Load template, error on server: ");
|
||||
}
|
||||
|
@ -455,20 +456,7 @@ public class Presenter {
|
|||
return GWT.getHostPageBaseURL() + "../../";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void addTextToolBar() {
|
||||
|
||||
RichTextToolbar rtbar = new RichTextToolbar(new RichTextArea(), false, getCommands(), true);
|
||||
SimplePanel deco = new SimplePanel();
|
||||
rtbar.setEnabled(false);
|
||||
deco.add(rtbar);
|
||||
deco.setSize("100%", "25");
|
||||
rtbar.setWidth("100%");
|
||||
ReportGenerator.get().getToolbarPanel().clear();
|
||||
ReportGenerator.get().getToolbarPanel().add(deco);
|
||||
}
|
||||
/**
|
||||
* remove the user-added components from the workspace, and from the model
|
||||
*
|
||||
|
@ -595,56 +583,6 @@ public class Presenter {
|
|||
this.@org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter::location = $wnd.location.href;
|
||||
}-*/;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param area .
|
||||
*/
|
||||
public void disaableTextToolBar(RichTextArea area) {
|
||||
|
||||
}
|
||||
/**
|
||||
* used when the resizing textAreas depending on the content
|
||||
* @param myY a
|
||||
* @param pixel a
|
||||
*/
|
||||
public void shiftComponentsByTextArea(int myY, int pixel) {
|
||||
int section = model.getCurrentPage();
|
||||
List<TemplateComponent> comps = model.getSectionComponent(section);
|
||||
|
||||
if (comps != null) {
|
||||
for (TemplateComponent tc : comps) {
|
||||
if (tc.getType() != ComponentType.FAKE_TEXTAREA) {
|
||||
if (tc.getY() > myY) {
|
||||
GWT.log("FOUND " + tc.getX() + ", " + tc.getY(), null);
|
||||
GWT.log("pixel " + pixel , null);
|
||||
int newY = tc.getY()+pixel;// : tc.getY()-pixel;
|
||||
//
|
||||
tc.setY(newY);
|
||||
GWT.log("moveWidget " + tc.getX() + ", " + tc.getY(), null);
|
||||
moveWidget(tc.getContent(), tc.getX(),newY);
|
||||
GWT.log("MOVED " + tc.getX() + ", " + tc.getY(), null);
|
||||
}
|
||||
}
|
||||
//Window.alert("myY - tc.getY() " + myY + ", " + tc.getY());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param toMove .
|
||||
* @param left .
|
||||
* @param top .
|
||||
*/
|
||||
public void moveWidget(Widget toMove, int left, int top) {
|
||||
//wp.getMainLayout().add(toMove);
|
||||
wp.moveWidget(toMove, left, top);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import a Section in the View and in the Model
|
||||
* @param toLoad the SerializableModel instance where toget the section
|
||||
|
@ -678,7 +616,22 @@ public class Presenter {
|
|||
while (! ( model.getCurrentPage() == sect2Seek) )
|
||||
nextPageButtonClicked();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void addTextToolBar(boolean enableCommands) {
|
||||
RichTextToolbar rtbar = new RichTextToolbar(new RichTextArea(), false, getCommands(), true);
|
||||
rtbar.enableCommands(enableCommands);
|
||||
|
||||
currentSelectedToolbar = rtbar;
|
||||
SimplePanel deco = new SimplePanel();
|
||||
rtbar.setEnabled(false);
|
||||
deco.add(rtbar);
|
||||
deco.setSize("100%", "25");
|
||||
rtbar.setWidth("100%");
|
||||
ReportGenerator.get().getToolbarPanel().clear();
|
||||
ReportGenerator.get().getToolbarPanel().add(deco);
|
||||
}
|
||||
/**
|
||||
* enable the format text toolbar for the given Rich Textarea passed as argument
|
||||
* @param d4sArea the enabled text area
|
||||
|
@ -818,29 +771,11 @@ public class Presenter {
|
|||
titleBar.getSectionSwitchPanel().showPrevButton();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* load the template to edit in the MODEL and in the VIEW
|
||||
* @param serializedpath the temp file to open
|
||||
*/
|
||||
public void openImportedFimesXML(String serializedpath) {
|
||||
model.getModelService().readImportedModel(serializedpath, new AsyncCallback<Model>() {
|
||||
@Override
|
||||
public void onSuccess(Model toLoad) {
|
||||
loadModel(toLoad);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("Could not Load report, please try again later: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param toLoad
|
||||
*/
|
||||
private void loadModel(Model toLoad) {
|
||||
private void loadModel(Model toLoad, boolean savingEnabled) {
|
||||
//reset the UI
|
||||
cleanAllNotSession();
|
||||
|
||||
|
@ -854,7 +789,7 @@ public class Presenter {
|
|||
titleBar.getSectionSwitchPanel().setVisible(true);
|
||||
resizeWorkingArea(model.getPageWidth(), model.getPageHeight());
|
||||
|
||||
addTextToolBar();
|
||||
addTextToolBar(savingEnabled);
|
||||
int currPage = model.getCurrentPage();
|
||||
//load the UI components of the current page
|
||||
GWT.log("READ CURR PAGE"+currPage, null);
|
||||
|
@ -904,7 +839,7 @@ public class Presenter {
|
|||
titleBar.setTemplateName(model.getTemplateName());
|
||||
titleBar.getSectionSwitchPanel().setPageDisplayer(model.getCurrentPage(), model.getTotalPages());
|
||||
titleBar.getSectionSwitchPanel().setVisible(true);
|
||||
addTextToolBar();
|
||||
addTextToolBar(true);
|
||||
int currPage = model.getCurrentPage();
|
||||
//load the UI components of the current page
|
||||
GWT.log("READ CURR PAGE"+currPage, null);
|
||||
|
@ -1188,7 +1123,7 @@ public class Presenter {
|
|||
|
||||
public void showReportStructure() {
|
||||
toolBoxPanel.showStructure(new ReportStructurePanel(eventBus, model.getSerializableModel(), ToolboxPanel.TOOLBOX_WIDTH+"px", ToolboxPanel.TOOLBOX_HEIGHT+"px"));
|
||||
}
|
||||
}
|
||||
|
||||
public HorizontalPanel getExportsPanel() {
|
||||
return exportsPanel;
|
||||
|
@ -1248,21 +1183,28 @@ public class Presenter {
|
|||
*
|
||||
*/
|
||||
public void showVMEImportDialog() {
|
||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), VMETypeIdentifier.Vme);
|
||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), VMETypeIdentifier.Vme, false);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void showVMEReportRefImportDialog(VMETypeIdentifier refType) {
|
||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), refType, false);
|
||||
dlg.show();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void showVMERefAssociateDialog(VMETypeIdentifier refType) {
|
||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), refType);
|
||||
ImportVMEReportDialog dlg = new ImportVMEReportDialog(getEventBus(), refType, true);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
private void importVMEReport(String reportId) {
|
||||
private void importVMEReport(String reportId, final VMETypeIdentifier type) {
|
||||
showLoading();
|
||||
reportService.importVMEReport(reportId, new AsyncCallback<Model>() {
|
||||
reportService.importVMEReport(reportId, type, new AsyncCallback<Model>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("Could not Load Report Model, error on server.: " + caught.getMessage());
|
||||
|
@ -1271,7 +1213,7 @@ public class Presenter {
|
|||
@Override
|
||||
public void onSuccess(Model toLoad) {
|
||||
if (toLoad != null)
|
||||
loadModel(toLoad);
|
||||
loadModel(toLoad, type == VMETypeIdentifier.Vme);
|
||||
else
|
||||
Window.alert("Could not Load Report Model, error on server.");
|
||||
}
|
||||
|
@ -1282,7 +1224,7 @@ public class Presenter {
|
|||
private void associateVMRReportRef(VMETypeIdentifier type, String reportId) throws Exception {
|
||||
GWT.log("Type="+type);
|
||||
GWT.log("Id"+reportId);
|
||||
reportService.importVMEReportRef(reportId, type, new AsyncCallback<Model>() {
|
||||
reportService.getVMEReportRef2Associate(reportId, type, new AsyncCallback<Model>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ReportGenerator implements EntryPoint {
|
|||
eastPanel.add(workSpacePanel);
|
||||
eastPanel.add(divHidden);
|
||||
bottomScrollerPanel.add(eastPanel);
|
||||
presenter.addTextToolBar();
|
||||
presenter.addTextToolBar(true);
|
||||
|
||||
// Add image and button to the RootPanel
|
||||
RootPanel.get("ReportGeneratorDIV").add(mainLayout);
|
||||
|
|
|
@ -25,9 +25,9 @@ public interface ReportService extends RemoteService{
|
|||
|
||||
ArrayList<VMEReportBean> listVMEReportRefByType(VMETypeIdentifier refType);
|
||||
|
||||
Model importVMEReport(String id);
|
||||
Model importVMEReport(String id, VMETypeIdentifier refType);
|
||||
|
||||
Model importVMEReportRef(String id, VMETypeIdentifier refType);
|
||||
Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType);
|
||||
|
||||
String save(String filePath, String workspaceFolderId, String ItemName,
|
||||
TypeExporter type, boolean overwrite)
|
||||
|
|
|
@ -77,10 +77,11 @@ public interface ReportServiceAsync {
|
|||
|
||||
void listVMEReports(AsyncCallback<ArrayList<VMEReportBean>> callback);
|
||||
|
||||
void importVMEReport(String id, AsyncCallback<Model> callback);
|
||||
void importVMEReport(String id, VMETypeIdentifier refType,
|
||||
AsyncCallback<Model> callback);
|
||||
|
||||
void listVMEReportRefByType(VMETypeIdentifier refType,
|
||||
AsyncCallback<ArrayList<VMEReportBean>> callback);
|
||||
|
||||
void importVMEReportRef(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
||||
void getVMEReportRef2Associate(String id, VMETypeIdentifier refType, AsyncCallback<Model> callback);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public class ToolboxPanel extends VerticalPanel {
|
|||
|
||||
public ToolboxPanel(AppControllerExplorer appController) {
|
||||
this.appController = appController;
|
||||
AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
|
||||
this.tp = tp;
|
||||
// AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
|
||||
// this.tp = tp;
|
||||
// add(tp);
|
||||
// this.appController.hideSharingFacilities(); //sharing disabled we have problems from Reports
|
||||
}
|
||||
|
|
|
@ -46,9 +46,10 @@ public class ImportVMEReportDialog extends Window {
|
|||
*
|
||||
* @param eventBus the bus to fire events into
|
||||
*/
|
||||
public ImportVMEReportDialog(final HandlerManager eventBus, VMETypeIdentifier type) {
|
||||
public ImportVMEReportDialog(final HandlerManager eventBus, VMETypeIdentifier type, final boolean isAssociation) {
|
||||
this.eventBus = eventBus;
|
||||
this.type = type;
|
||||
setModal(true);
|
||||
mainPanel.setHeaderVisible(false);
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
|
@ -78,7 +79,8 @@ public class ImportVMEReportDialog extends Window {
|
|||
add(hp);
|
||||
add(mainPanel);
|
||||
showLoading();
|
||||
if (type == VMETypeIdentifier.Vme)
|
||||
if (type == VMETypeIdentifier.Vme) {
|
||||
setHeading("Select the VME");
|
||||
reportService.listVMEReports(new AsyncCallback<ArrayList<VMEReportBean>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -91,7 +93,9 @@ public class ImportVMEReportDialog extends Window {
|
|||
showAvailableReports(reports);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
setHeading("Select the " + type.getId());
|
||||
reportService.listVMEReportRefByType(type, new AsyncCallback<ArrayList<VMEReportBean>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -101,7 +105,7 @@ public class ImportVMEReportDialog extends Window {
|
|||
@Override
|
||||
public void onSuccess(ArrayList<VMEReportBean> refReports) {
|
||||
mainPanel.unmask();
|
||||
showAvailableReferenceReports(refReports);
|
||||
showAvailableReferenceReports(refReports, isAssociation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -110,7 +114,7 @@ public class ImportVMEReportDialog extends Window {
|
|||
*
|
||||
* @param reports
|
||||
*/
|
||||
public void showAvailableReferenceReports(List<VMEReportBean> reports) {
|
||||
public void showAvailableReferenceReports(List<VMEReportBean> reports, boolean isAssociation) {
|
||||
|
||||
ColumnModel cm = null;
|
||||
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
||||
|
@ -158,13 +162,24 @@ public class ImportVMEReportDialog extends Window {
|
|||
}
|
||||
}));
|
||||
|
||||
gridPanel.addButton(new Button("Edit Selected", new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), type));
|
||||
}
|
||||
}));
|
||||
if (isAssociation) {
|
||||
gridPanel.addButton(new Button("Associate Selected", new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), type, true));
|
||||
}
|
||||
}));
|
||||
}
|
||||
else {
|
||||
gridPanel.addButton(new Button("Edit Selected", new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), type, false));
|
||||
}
|
||||
}));
|
||||
}
|
||||
mainPanel.add(gridPanel);
|
||||
mainPanel.setLayout(new FitLayout());
|
||||
mainPanel.layout();
|
||||
|
@ -245,7 +260,7 @@ public class ImportVMEReportDialog extends Window {
|
|||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), VMETypeIdentifier.Vme));
|
||||
eventBus.fireEvent(new SelectedReportEvent(grid.getSelectionModel().getSelectedItem().getId(), VMETypeIdentifier.Vme, false));
|
||||
}
|
||||
}));
|
||||
mainPanel.add(gridPanel);
|
||||
|
|
|
@ -8,11 +8,13 @@ public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{
|
|||
public static Type<SelectedReportEventHandler> TYPE = new Type<SelectedReportEventHandler>();
|
||||
private final String id;
|
||||
private final VMETypeIdentifier type;
|
||||
private final boolean isAssociation;
|
||||
|
||||
public SelectedReportEvent(String id, VMETypeIdentifier type) {
|
||||
public SelectedReportEvent(String id, VMETypeIdentifier type, boolean isAssociation) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
this.isAssociation = isAssociation;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@ -23,6 +25,10 @@ public class SelectedReportEvent extends GwtEvent<SelectedReportEventHandler>{
|
|||
return type;
|
||||
}
|
||||
|
||||
public boolean isAssociation() {
|
||||
return isAssociation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<SelectedReportEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
|
|
|
@ -377,10 +377,10 @@ public class TemplateComponent {
|
|||
case REPORT_REFERENCE:
|
||||
GWT.log("FOUND Master SEQUENCE trying getGroup");
|
||||
|
||||
ReportReferences ref = (ReportReferences) sc.getPossibleContent();
|
||||
ArrayList<Tuple> tuple = ref.getTuples();
|
||||
ReportReferences refs = (ReportReferences) sc.getPossibleContent();
|
||||
ArrayList<Tuple> tuple = refs.getTuples();
|
||||
|
||||
ClientReportReference cmSeq = new ClientReportReference(presenter, ref.getRefType(), tuple);
|
||||
ClientReportReference cmSeq = new ClientReportReference(presenter, refs.getRefType(), tuple, refs.isSingleRelation());
|
||||
this.content = cmSeq;
|
||||
break;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ public class TemplateComponent {
|
|||
break;
|
||||
case REPORT_REFERENCE:
|
||||
ClientReportReference cRef = (ClientReportReference) this.content;
|
||||
ReportReferences ref = new ReportReferences(cRef.getRefType(), cRef.getTupleList());
|
||||
ReportReferences ref = new ReportReferences(cRef.getRefType(), cRef.getTupleList(), cRef.isSingleRelation());
|
||||
content = ref;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,15 +2,14 @@ package org.gcube.portlets.user.reportgenerator.client.targets;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
||||
import org.gcube.portlets.d4sreporting.common.shared.BasicComponent;
|
||||
import org.gcube.portlets.d4sreporting.common.shared.RepeatableSequence;
|
||||
import org.gcube.portlets.d4sreporting.common.shared.Tuple;
|
||||
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
|
||||
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
|
||||
import org.gcube.portlets.user.reportgenerator.shared.VMETypeIdentifier;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.dom.client.HasClickHandlers;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
/**
|
||||
|
@ -27,19 +26,23 @@ public class ClientReportReference extends Composite implements ClientSequence {
|
|||
private ArrayList<Tuple> tupleList;
|
||||
private SequenceWidget first;
|
||||
private Presenter p;
|
||||
private boolean singleRelation; //allow or not to add new entries
|
||||
|
||||
/**
|
||||
* s
|
||||
* @param p
|
||||
* @param ms
|
||||
*/
|
||||
public ClientReportReference(Presenter p, String refType, ArrayList<Tuple> tupleList) {
|
||||
public ClientReportReference(Presenter p, String refType, ArrayList<Tuple> tupleList, boolean singleRelation) {
|
||||
this.p = p;
|
||||
this.refType = refType;
|
||||
this.tupleList = tupleList;
|
||||
this.singleRelation = singleRelation;
|
||||
for (Tuple seq : tupleList) {
|
||||
if (myPanel.getWidgetCount()==0) { // if is the first one
|
||||
first = getMasterSequence(seq);
|
||||
if (isSingleRelation())
|
||||
first.removeAddAnotherButton();
|
||||
myPanel.add(first);
|
||||
} else {
|
||||
SequenceWidget seqW = new SequenceWidget(p, this, seq, false, false);
|
||||
|
@ -56,11 +59,23 @@ public class ClientReportReference extends Composite implements ClientSequence {
|
|||
SequenceWidget toReturn = new SequenceWidget(p, this, seq, true, false);
|
||||
if (tupleList.size() == 1) {
|
||||
toReturn.enableClear();
|
||||
toReturn.removeAddAnotherButton();
|
||||
if (isTupleEmpty(tupleList.get(0))) {
|
||||
toReturn.clearAssociation();
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
private boolean isTupleEmpty(Tuple toCheck) {
|
||||
boolean toReturn = false;
|
||||
for (BasicComponent bc : toCheck.getGroupedComponents()) {
|
||||
if (bc.getPossibleContent() == null)
|
||||
return true;
|
||||
|
||||
}
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<Tuple> getTupleList() {
|
||||
return tupleList;
|
||||
|
@ -72,6 +87,10 @@ public class ClientReportReference extends Composite implements ClientSequence {
|
|||
}
|
||||
|
||||
|
||||
public boolean isSingleRelation() {
|
||||
return singleRelation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<TemplateComponent> getGroupedComponents() {
|
||||
return groupedComponents;
|
||||
|
|
|
@ -102,7 +102,6 @@ public class D4sRichTextarea extends ReportTextArea {
|
|||
div.setHTML(area.getHTML());
|
||||
int newHeight = div.getOffsetHeight()+20 ;
|
||||
if (newHeight > height-10 && newHeight != currHeight) {
|
||||
presenter.shiftComponentsByTextArea(myInstance.top, newHeight - currHeight);
|
||||
resizePanel(width, div.getOffsetHeight());
|
||||
//Window.alert("myInstance.top: " + myInstance.top);
|
||||
presenter.resizeTemplateComponentInModel(myInstance, width, newHeight);
|
||||
|
@ -123,7 +122,6 @@ public class D4sRichTextarea extends ReportTextArea {
|
|||
div.setHTML(area.getHTML());
|
||||
int newHeight = div.getOffsetHeight()+20 ;
|
||||
if (newHeight > height-10 && newHeight != currHeight) {
|
||||
presenter.shiftComponentsByTextArea(myInstance.top, newHeight - currHeight);
|
||||
resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
|
||||
//Window.alert("myInstance.top: " + myInstance.top);
|
||||
presenter.resizeTemplateComponentInModel(myInstance, myPanel.getOffsetWidth()+5, newHeight);
|
||||
|
|
|
@ -1556,36 +1556,58 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public Model importVMEReport(String id) {
|
||||
String reportName = "Sample VME Report imported with id: " + id;
|
||||
ReportsModeler rm = new ReportsModeler(
|
||||
UUID.randomUUID().toString(),
|
||||
reportName,
|
||||
getASLSession().getUsername(),
|
||||
new Date(),
|
||||
new Date(),
|
||||
getASLSession().getUsername()
|
||||
);
|
||||
rm.add(new Instruction(null));
|
||||
rm.add(new Title("Name for id " + id, false));
|
||||
rm.add(new Heading(1, "VME Name (Non Editable) "));
|
||||
rm.add(new TextInput("Corner Rise Seamounts"));
|
||||
rm.add(new Heading(2, "This is a Heading of Level 2 that is editable"));
|
||||
rm.add(new TextInput("Corner Rise Seamounts again"));
|
||||
rm.add(new TextInput());
|
||||
rm.nextSection();
|
||||
rm = addSection2(rm);
|
||||
rm.nextSection();
|
||||
ReportComponent rp = new TextInput("With props and id");
|
||||
rp.setId(UUID.randomUUID().toString());
|
||||
rp.setProperties(new Property("theId", "theValue"));
|
||||
rm.add(rp);
|
||||
|
||||
rp = new Heading(1, "Ciao!");
|
||||
rp.setId(UUID.randomUUID().toString());
|
||||
rp.setProperties(new Property("theId", "theValue"));
|
||||
rm.add(rp);
|
||||
public Model importVMEReport(String id, VMETypeIdentifier refType) {
|
||||
ReportsModeler rm = null;
|
||||
if (refType == VMETypeIdentifier.Vme) {
|
||||
String reportName = "Sample VME Report imported with id: " + id;
|
||||
rm = new ReportsModeler(
|
||||
UUID.randomUUID().toString(),
|
||||
reportName,
|
||||
getASLSession().getUsername(),
|
||||
new Date(),
|
||||
new Date(),
|
||||
getASLSession().getUsername()
|
||||
);
|
||||
rm.add(new Instruction(null));
|
||||
rm.add(new Title("Name for id " + id, false));
|
||||
rm.add(new Heading(1, "VME Name (Non Editable) "));
|
||||
rm.add(new TextInput("Corner Rise Seamounts"));
|
||||
rm.add(new Heading(2, "This is a Heading of Level 2 that is editable"));
|
||||
rm.add(new TextInput("Corner Rise Seamounts again"));
|
||||
rm.add(new TextInput());
|
||||
rm.nextSection();
|
||||
rm = addSection2(rm);
|
||||
rm.nextSection();
|
||||
ReportComponent rp = new TextInput("With props and id");
|
||||
rp.setId(UUID.randomUUID().toString());
|
||||
rp.setProperties(new Property("theId", "theValue"));
|
||||
rm.add(rp);
|
||||
|
||||
rp = new Heading(1, "Ciao!");
|
||||
rp.setId(UUID.randomUUID().toString());
|
||||
rp.setProperties(new Property("theId", "theValue"));
|
||||
rm.add(rp);
|
||||
}
|
||||
else {
|
||||
String reportName = refType.getId() + " VME Reference Report with id: " + id;
|
||||
rm = new ReportsModeler(
|
||||
UUID.randomUUID().toString(),
|
||||
reportName,
|
||||
getASLSession().getUsername(),
|
||||
new Date(),
|
||||
new Date(),
|
||||
getASLSession().getUsername()
|
||||
);
|
||||
rm.add(new Title("Test" + refType.getId()));
|
||||
rm.add(new Heading(2, "Year"));
|
||||
rm.add(new TextInput());
|
||||
rm.add(new Heading(2, "Validity Period - Start"));
|
||||
rm.add(new TextInput());
|
||||
rm.add(new Heading(2, "Validity Period - End"));
|
||||
rm.add(new TextInput());
|
||||
rm.add(getTestReference(ReferenceReportType.InformationSource, false));
|
||||
rm.add(new Heading(1, "Ciao!"));
|
||||
}
|
||||
try {
|
||||
return rm.getReportInstance();
|
||||
} catch (Exception e) {
|
||||
|
@ -1594,8 +1616,8 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Model importVMEReportRef(String id, VMETypeIdentifier refType) {
|
||||
@Override
|
||||
public Model getVMEReportRef2Associate(String id, VMETypeIdentifier refType) {
|
||||
String reportName = "Sample Reference Report: " + id;
|
||||
ReportsModeler rm = new ReportsModeler(
|
||||
UUID.randomUUID().toString(),
|
||||
|
@ -1623,7 +1645,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
rm.add(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows));
|
||||
try {
|
||||
Model toReturn = rm.getReportInstance();
|
||||
ReportsReader.readReportStructure(toReturn);
|
||||
//ReportsReader.readReportStructure(toReturn);
|
||||
return toReturn;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1631,6 +1653,7 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
private ReportsModeler addSection2(ReportsModeler rm) {
|
||||
rm.add(new Heading(1, "Specific Measure"));
|
||||
ReportSequence seq = new ReportSequence(UUID.randomUUID().toString());
|
||||
|
@ -1640,34 +1663,42 @@ public class ReportServiceImpl extends RemoteServiceServlet implements ReportSe
|
|||
seq.add(new TextInput());
|
||||
seq.add(new Heading(2, "Validity Period - End"));
|
||||
seq.add(new TextInput());
|
||||
|
||||
seq.add(getTestReference(ReferenceReportType.InformationSource, true));
|
||||
rm.add(seq);
|
||||
return rm;
|
||||
}
|
||||
/**
|
||||
* TODO: remove
|
||||
* @return
|
||||
*/
|
||||
private ReferenceReport getTestReference(ReferenceReportType type, boolean single) {
|
||||
//construct the options (the references)
|
||||
ArrayList<DBTableRow> dBTableRows = new ArrayList<DBTableRow>();
|
||||
|
||||
ArrayList<Column> md = new ArrayList<Column>();
|
||||
|
||||
Random generator = new Random();
|
||||
int year = generator.nextInt(15) + 2000;
|
||||
//construct the references
|
||||
md.add(new Column("Meeting Date", "2009"));
|
||||
md.add(new Column("Meeting Date", ""+year));
|
||||
md.add(new Column("Report Summary", "Aenean vulputate ac dui eu interdum. Nullam tincidunt hendrerit sollicitudin."));
|
||||
md.add(new Column("Committee", "Lorem ipsum dolor sit amet, consectetur adipiscing elit"));
|
||||
md.add(new Column("URL", "http://archive.nafo.int/open/fc/2012/fcdoc12-01.pdf"));
|
||||
md.add(new Column("Citation", "(Rossi et Al) adipiscing elit oekfha lfkahjf lakjfha lkfahjf alkjdfh "));
|
||||
md.add(new Column("Type", "The type"));
|
||||
dBTableRows.add(new DBTableRow("primaryKey", md));
|
||||
seq.add(new ReferenceReport(ReferenceReportType.InformationSource, dBTableRows));
|
||||
rm.add(seq);
|
||||
return rm;
|
||||
return new ReferenceReport(type, dBTableRows, single);
|
||||
}
|
||||
/**
|
||||
* TODO: remove once you get real names
|
||||
* @return
|
||||
*/
|
||||
private static String generateRandomWord() {
|
||||
Random random = new Random();
|
||||
char[] word = new char[random.nextInt(8)+3]; // words of length 3 through 10. (1 and 2 letter words are boring.)
|
||||
for(int j = 0; j < word.length; j++)
|
||||
{
|
||||
word[j] = (char)('a' + random.nextInt(26));
|
||||
}
|
||||
return new String(word);
|
||||
Random random = new Random();
|
||||
char[] word = new char[random.nextInt(7)+5]; // words of length 5 through 12
|
||||
for(int j = 0; j < word.length; j++) {
|
||||
word[j] = (char)('a' + random.nextInt(26));
|
||||
}
|
||||
return new String(word);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue