From f307dfe922500d2305eec8d1f01aa2644cb6c3ad Mon Sep 17 00:00:00 2001 From: "giancarlo.panichi" Date: Thu, 5 Jul 2018 16:29:38 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashboard@169691 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 54 +++ .project | 53 +++ .../com.google.appengine.eclipse.core.prefs | 3 + .settings/com.google.gdt.eclipse.core.prefs | 4 + .settings/com.google.gwt.eclipse.core.prefs | 3 + .settings/org.eclipse.core.resources.prefs | 6 + .settings/org.eclipse.jdt.core.prefs | 13 + .settings/org.eclipse.m2e.core.prefs | 4 + .settings/org.eclipse.wst.common.component | 10 + ...se.wst.common.project.facet.core.prefs.xml | 7 + ....eclipse.wst.common.project.facet.core.xml | 8 + .settings/org.eclipse.wst.validation.prefs | 2 + distro/LICENSE | 1 + distro/README | 68 +++ distro/changelog.xml | 5 + distro/descriptor.xml | 32 ++ distro/profile.xml | 29 ++ pom.xml | 395 ++++++++++++++++++ .../accountingdashb.gwt.xml | 39 ++ .../client/application/ApplicationModule.java | 36 ++ .../application/ApplicationPresenter.java | 78 ++++ .../client/application/ApplicationView.java | 34 ++ .../client/application/ApplicationView.ui.xml | 14 + .../client/application/CommonMessages.java | 23 + .../controller/ApplicationCache.java | 27 ++ .../application/controller/Controller.java | 88 ++++ .../controller/ControllerModule.java | 23 + .../application/customwidget/TagWidget.java | 73 ++++ .../application/customwidget/TagWidget.ui.xml | 42 ++ .../customwidget/TagWidgetHideEvent.java | 54 +++ .../application/dialog/error/ErrorModule.java | 16 + .../dialog/error/ErrorPresenter.java | 58 +++ .../dialog/error/ErrorUiHandlers.java | 13 + .../application/dialog/error/ErrorView.java | 68 +++ .../application/dialog/error/ErrorView.ui.xml | 31 ++ .../application/dialog/info/InfoModule.java | 16 + .../dialog/info/InfoPresenter.java | 58 +++ .../dialog/info/InfoUiHandlers.java | 13 + .../application/dialog/info/InfoView.java | 68 +++ .../application/dialog/info/InfoView.ui.xml | 31 ++ .../dialog/monitor/MonitorModule.java | 16 + .../dialog/monitor/MonitorPresenter.java | 58 +++ .../dialog/monitor/MonitorUiHandlers.java | 13 + .../dialog/monitor/MonitorView.java | 57 +++ .../dialog/monitor/MonitorView.ui.xml | 21 + .../client/application/event/HelloEvent.java | 37 ++ .../application/event/MonitorEvent.java | 50 +++ .../application/mainarea/MainAreaModule.java | 21 + .../mainarea/MainAreaPresenter.java | 79 ++++ .../mainarea/MainAreaUiHandlers.java | 13 + .../application/mainarea/MainAreaView.java | 51 +++ .../application/mainarea/MainAreaView.ui.xml | 13 + .../mainarea/filter/FilterAreaModule.java | 16 + .../mainarea/filter/FilterAreaPresenter.java | 57 +++ .../mainarea/filter/FilterAreaUiHandlers.java | 13 + .../mainarea/filter/FilterAreaView.java | 132 ++++++ .../mainarea/filter/FilterAreaView.ui.xml | 50 +++ .../filter/scopetree/ScopeTreeModel.java | 97 +++++ .../report/ReaportAreaUiHandlers.java | 13 + .../mainarea/report/ReportAreaModule.java | 16 + .../mainarea/report/ReportAreaPresenter.java | 53 +++ .../mainarea/report/ReportAreaView.java | 45 ++ .../mainarea/report/ReportAreaView.ui.xml | 16 + .../client/application/menu/MenuModule.java | 16 + .../application/menu/MenuPresenter.java | 41 ++ .../application/menu/MenuUiHanlers.java | 14 + .../client/application/menu/MenuView.java | 30 ++ .../client/application/menu/MenuView.ui.xml | 24 ++ .../providers/DataProviderModule.java | 16 + .../DeadFishBySpecificDiseasesProvider.java | 183 ++++++++ .../providers/TreatmentsProvider.java | 181 ++++++++ .../application/utils/CheckCellHead.java | 42 ++ .../application/utils/DateTimeUtils.java | 45 ++ .../gin/AccountingDashBoardClientModule.java | 40 ++ .../client/gin/CustomRootPresenter.java | 46 ++ .../client/place/NameTokens.java | 26 ++ .../client/place/TokenParameters.java | 15 + .../client/resources/AppResources.java | 68 +++ .../client/resources/ResourceLoader.java | 24 ++ .../client/resources/ScopeTreeResources.java | 21 + .../client/resources/uiData.css | 292 +++++++++++++ .../client/resources/uiScopeTree.css | 68 +++ .../rpc/AccountingDashboardService.java | 28 ++ .../rpc/AccountingDashboardServiceAsync.java | 26 ++ .../portlet/AccountingDashboardPortlet.java | 49 +++ .../AccountingDashboardServiceImpl.java | 62 +++ .../server/SessionUtil.java | 187 +++++++++ .../server/accounting/AccountingService.java | 33 ++ .../server/util/ServiceCredentials.java | 141 +++++++ .../accountingdashboard/shared/Constants.java | 37 ++ .../shared/data/ScopeData.java | 89 ++++ .../shared/data/TreatmentData.java | 79 ++++ .../shared/exception/ServiceException.java | 44 ++ .../exception/SessionExpiredException.java | 39 ++ .../shared/session/SessionConstants.java | 18 + .../shared/session/UserInfo.java | 107 +++++ .../accountingdashb.gwt.xml | 39 ++ src/main/webapp/AccountingDashboard.css | 55 +++ src/main/webapp/AccountingDashboard.html | 51 +++ .../jsp/AccountingDashboardPortlet_view.jsp | 14 + src/main/webapp/WEB-INF/liferay-display.xml | 9 + .../WEB-INF/liferay-plugin-package.properties | 9 + src/main/webapp/WEB-INF/liferay-portlet.xml | 14 + src/main/webapp/WEB-INF/portlet.xml | 27 ++ src/main/webapp/WEB-INF/web.xml | 22 + src/main/webapp/icon.png | Bin 0 -> 3041 bytes .../AccountingServiceTest.java | 43 ++ .../user/accountingdashboard/AuthTest.java | 29 ++ .../user/accountingdashboard/ServiceTest.java | 40 ++ 109 files changed, 5020 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/com.google.appengine.eclipse.core.prefs create mode 100644 .settings/com.google.gdt.eclipse.core.prefs create mode 100644 .settings/com.google.gwt.eclipse.core.prefs create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 .settings/org.eclipse.wst.common.component create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.prefs.xml create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 .settings/org.eclipse.wst.validation.prefs create mode 100644 distro/LICENSE create mode 100644 distro/README create mode 100644 distro/changelog.xml create mode 100644 distro/descriptor.xml create mode 100644 distro/profile.xml create mode 100644 pom.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/CommonMessages.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ApplicationCache.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/Controller.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ControllerModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidgetHideEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorUiHandlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoUiHandlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorUiHandlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/HelloEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/MonitorEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaUiHandlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaUiHandlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/scopetree/ScopeTreeModel.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReaportAreaUiHandlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuUiHanlers.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.ui.xml create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DataProviderModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DeadFishBySpecificDiseasesProvider.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/TreatmentsProvider.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/CheckCellHead.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/DateTimeUtils.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/AccountingDashBoardClientModule.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/CustomRootPresenter.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/NameTokens.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/TokenParameters.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/AppResources.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ResourceLoader.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ScopeTreeResources.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiData.css create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiScopeTree.css create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardService.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardServiceAsync.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/portlet/AccountingDashboardPortlet.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/server/AccountingDashboardServiceImpl.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/server/SessionUtil.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/AccountingService.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/server/util/ServiceCredentials.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/Constants.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/ScopeData.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/TreatmentData.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/ServiceException.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/SessionExpiredException.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/SessionConstants.java create mode 100644 src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/UserInfo.java create mode 100644 src/main/resources/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml create mode 100644 src/main/webapp/AccountingDashboard.css create mode 100644 src/main/webapp/AccountingDashboard.html create mode 100644 src/main/webapp/WEB-INF/jsp/AccountingDashboardPortlet_view.jsp create mode 100644 src/main/webapp/WEB-INF/liferay-display.xml create mode 100644 src/main/webapp/WEB-INF/liferay-plugin-package.properties create mode 100644 src/main/webapp/WEB-INF/liferay-portlet.xml create mode 100644 src/main/webapp/WEB-INF/portlet.xml create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/icon.png create mode 100644 src/test/java/org/gcube/portlets/user/accountingdashboard/AccountingServiceTest.java create mode 100644 src/test/java/org/gcube/portlets/user/accountingdashboard/AuthTest.java create mode 100644 src/test/java/org/gcube/portlets/user/accountingdashboard/ServiceTest.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..90dd282 --- /dev/null +++ b/.classpath @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..06c7ddc --- /dev/null +++ b/.project @@ -0,0 +1,53 @@ + + + accounting-dashboard + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + com.google.gwt.eclipse.core.gwtNature + + diff --git a/.settings/com.google.appengine.eclipse.core.prefs b/.settings/com.google.appengine.eclipse.core.prefs new file mode 100644 index 0000000..bbc4057 --- /dev/null +++ b/.settings/com.google.appengine.eclipse.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +googleCloudSqlEnabled=false +localDevMySqlEnabled=true diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs new file mode 100644 index 0000000..691688a --- /dev/null +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +jarsExcludedFromWebInfLib= +warSrcDir=src/main/webapp +warSrcDirIsOutput=false diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 0000000..fb32c70 --- /dev/null +++ b/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +entryPointModules= +filesCopiedToWebInfLib= diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..13b3428 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..062f4a2 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..cc81385 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..c20cdb1 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/distro/LICENSE b/distro/LICENSE new file mode 100644 index 0000000..2d9616a --- /dev/null +++ b/distro/LICENSE @@ -0,0 +1 @@ +${gcube.license} \ No newline at end of file diff --git a/distro/README b/distro/README new file mode 100644 index 0000000..35a12db --- /dev/null +++ b/distro/README @@ -0,0 +1,68 @@ +The gCube System - ${name} +-------------------------------------------------- + +${description} + + +${gcube.description} + +${gcube.funding} + + +Version +-------------------------------------------------- + +${version} (${buildDate}) + +Please see the file named "changelog.xml" in this directory for the release notes. + + +Authors +-------------------------------------------------- + +* Giancarlo Panichi (giancarlo.panichi-AT-isti.cnr.it), + Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" CNR, Pisa IT + + +Maintainers +----------- + +* Giancarlo Panichi (giancarlo.panichi-AT-isti.cnr.it), + Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" CNR, Pisa IT + + +Download information +-------------------------------------------------- + +Source code is available from SVN: + ${scm.url} + +Binaries can be downloaded from the gCube website: + ${gcube.website} + + +Installation +-------------------------------------------------- + +Installation documentation is available on-line in the gCube Wiki: + https://wiki.gcube-system.org/gcube/CMEMS_Scheduler_Manager + + +Documentation +-------------------------------------------------- + +Documentation is available on-line in the gCube Wiki: + https://wiki.gcube-system.org/gcube/CMEMS_Scheduler_Manager + + +Support +-------------------------------------------------- + +Bugs and support requests can be reported in the gCube issue tracking tool: + ${gcube.issueTracking} + + +Licensing +-------------------------------------------------- + +This software is licensed under the terms you may find in the file named "LICENSE" in this directory. diff --git a/distro/changelog.xml b/distro/changelog.xml new file mode 100644 index 0000000..95d6f6d --- /dev/null +++ b/distro/changelog.xml @@ -0,0 +1,5 @@ + + + First Release + + \ No newline at end of file diff --git a/distro/descriptor.xml b/distro/descriptor.xml new file mode 100644 index 0000000..b468e51 --- /dev/null +++ b/distro/descriptor.xml @@ -0,0 +1,32 @@ + + servicearchive + + tar.gz + + / + + + ${distroDirectory} + / + true + + README + LICENSE + changelog.xml + profile.xml + + 755 + true + + + + + target/${build.finalName}.${project.packaging} + /${artifactId} + + + + \ No newline at end of file diff --git a/distro/profile.xml b/distro/profile.xml new file mode 100644 index 0000000..13575d1 --- /dev/null +++ b/distro/profile.xml @@ -0,0 +1,29 @@ + + + + Service + + ${project.description} + PortletsUser + ${project.name} + 1.0.0 + + + ${project.description} + ${project.name} + ${version} + + ${project.groupId} + ${project.artifactId} + ${project.version} + + webapplication + + ${project.build.finalName}.${project.packaging} + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3eb9ddf --- /dev/null +++ b/pom.xml @@ -0,0 +1,395 @@ + + + + + maven-parent + org.gcube.tools + 1.0.0 + + + + + 4.0.0 + org.gcube.portlets.user + accounting-dashboard + 1.0.0-SNAPSHOT + war + + accounting-dashboard + Accounting Dashboard + + + https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashborad + + + + + + Giancarlo Panichi + g.panichi@isti.cnr.it + CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" + + architect + developer + + + + + + + distro + config + ${project.build.directory}/${project.build.finalName} + + + 1.8 + 1.8 + + + + 2.8.2 + 3.3.2 + 1.6 + 2.1.2 + 2.3.2.0 + + AccountingDashboard.html + org.gcube.portlets.user.accountingdashboard.accountingdashb + + + 2.6 + 3.3 + + + ${env.KEYS} + + UTF-8 + UTF-8 + + + + + + localRun + + + + org.slf4j + slf4j-api + compile + + + org.slf4j + slf4j-log4j12 + runtime + + + + + javax.servlet + javax.servlet-api + 3.1.0 + + + + + org.gcube.common + common-authorization + compile + + + + org.gcube.common + authorization-client + compile + + + + + + + + + + + com.google.gwt + gwt-servlet + ${gwt.version} + runtime + + + com.google.gwt + gwt-user + ${gwt.version} + provided + + + javax.servlet + javax.servlet-api + + + + + com.google.gwt + gwt-dev + ${gwt.version} + provided + + + javax.servlet + javax.servlet-api + + + + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + + + + com.gwtplatform + gwtp-mvp-client + ${gwtp.version} + provided + + + + com.gwtplatform + gwtp-processors + ${gwtp.version} + + + + + com.google.gwt.inject + gin + ${gin.version} + provided + + + + + xml-apis + xml-apis + 1.4.01 + + + + + + + com.github.gwtbootstrap + gwt-bootstrap + ${gwtBootStrapVersion} + + + + + + + javax.portlet + portlet-api + + + + + + org.gcube.core + common-scope-maps + compile + + + + org.gcube.common.portal + portal-manager + provided + + + + org.gcube.dvos + usermanagement-core + provided + + + + org.gcube.portal + client-context-library + [1.0.0-SNAPSHOT,) + compile + + + + + org.gcube.common + common-authorization + provided + + + + org.gcube.common + authorization-client + provided + + + + + org.gcube.resources.discovery + ic-client + + + + + + org.gcube.data.access + accounting-summary-access + [0.0.1-SNAPSHOT,2.0.0-SNAPSHOT) + + + + + com.allen-sauer.gwt.log + gwt-log + ${gwt.log.version} + + + + org.slf4j + slf4j-api + provided + + + + org.slf4j + slf4j-log4j12 + provided + + + + + + junit + junit + 4.8.1 + test + + + + + + + + ${webappDirectory}/WEB-INF/classes + + + src/main/java + + **/*.css + + + + src/main/resources + + **/*.* + + + + + + + + org.codehaus.mojo + gwt-maven-plugin + ${gwt.version} + + true + 180 + htmlunit + **/*GwtTest.java + INFO + ${gwt.runTarget} + ${webappDirectory} + ${gwt.module.name} + + + + + compile + test + + + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + + compile + + + + ${webappDirectory} + ${project.build.finalName} + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + ${project.build.sourceEncoding} + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + ${distroDirectory}/descriptor.xml + + + + + servicearchive + install + + single + + + + + + + + + + + + org.gcube.distribution + maven-portal-bom + LATEST + pom + import + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml new file mode 100644 index 0000000..6ebd420 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationModule.java new file mode 100644 index 0000000..dec40de --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationModule.java @@ -0,0 +1,36 @@ +package org.gcube.portlets.user.accountingdashboard.client.application; + + +import org.gcube.portlets.user.accountingdashboard.client.application.controller.ControllerModule; +import org.gcube.portlets.user.accountingdashboard.client.application.dialog.error.ErrorModule; +import org.gcube.portlets.user.accountingdashboard.client.application.dialog.info.InfoModule; +import org.gcube.portlets.user.accountingdashboard.client.application.dialog.monitor.MonitorModule; +import org.gcube.portlets.user.accountingdashboard.client.application.mainarea.MainAreaModule; +import org.gcube.portlets.user.accountingdashboard.client.application.menu.MenuModule; +import org.gcube.portlets.user.accountingdashboard.client.application.providers.DataProviderModule; + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + + + +/** + * + * @author Giancarlo Panichi + * + */ +public class ApplicationModule extends AbstractPresenterModule { + @Override + protected void configure() { + install(new MonitorModule()); + install(new InfoModule()); + install(new ErrorModule()); + install(new ControllerModule()); + install(new DataProviderModule()); + install(new MenuModule()); + install(new MainAreaModule()); + + + bindPresenter(ApplicationPresenter.class, ApplicationPresenter.PresenterView.class, ApplicationView.class, + ApplicationPresenter.ApplicationPresenterProxy.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationPresenter.java new file mode 100644 index 0000000..db1ae48 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationPresenter.java @@ -0,0 +1,78 @@ +package org.gcube.portlets.user.accountingdashboard.client.application; + + +import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; +import org.gcube.portlets.user.accountingdashboard.client.application.menu.MenuPresenter; + +import com.google.gwt.user.client.Window; +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.Presenter; +import com.gwtplatform.mvp.client.View; +import com.gwtplatform.mvp.client.annotations.ProxyStandard; +import com.gwtplatform.mvp.client.presenter.slots.NestedSlot; +import com.gwtplatform.mvp.client.presenter.slots.PermanentSlot; +import com.gwtplatform.mvp.client.proxy.NavigationEvent; +import com.gwtplatform.mvp.client.proxy.NavigationHandler; +import com.gwtplatform.mvp.client.proxy.Proxy; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ApplicationPresenter + extends Presenter + implements NavigationHandler { + interface PresenterView extends View { + } + + @ProxyStandard + interface ApplicationPresenterProxy extends Proxy { + } + + public static final PermanentSlot SLOT_MENU = new PermanentSlot<>(); + public static final NestedSlot SLOT_MAIN = new NestedSlot(); + + private MenuPresenter menuPresenter; + private Controller controller; + + + @Inject + ApplicationPresenter(EventBus eventBus, PresenterView view, ApplicationPresenterProxy proxy, MenuPresenter menuPresenter, + Controller controller) { + super(eventBus, view, proxy, RevealType.Root); + this.menuPresenter = menuPresenter; + this.controller = controller; + callHello(); + } + + @Override + protected void onBind() { + super.onBind(); + + setInSlot(SLOT_MENU, menuPresenter); + addRegisteredHandler(NavigationEvent.getType(), this); + + } + + @Override + protected void onReveal() { + super.onReveal(); + } + + @Override + public void onNavigation(NavigationEvent navigationEvent) { + Window.scrollTo(0, 0); + // PlaceRequest placeRequest=navigationEvent.getRequest(); + // placeManager.revealPlace(placeRequest); + + } + + private void callHello(){ + controller.callHello(); + } + + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.java new file mode 100644 index 0000000..62f878b --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.java @@ -0,0 +1,34 @@ +package org.gcube.portlets.user.accountingdashboard.client.application; + + +import javax.inject.Inject; + +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.Widget; +import com.gwtplatform.mvp.client.ViewImpl; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ApplicationView extends ViewImpl implements ApplicationPresenter.PresenterView { + interface Binder extends UiBinder { + } + + @UiField + HTMLPanel menu; + @UiField + HTMLPanel main; + + @Inject + ApplicationView(Binder uiBinder) { + initWidget(uiBinder.createAndBindUi(this)); + bindSlot(ApplicationPresenter.SLOT_MENU, menu); + bindSlot(ApplicationPresenter.SLOT_MAIN, main); + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.ui.xml new file mode 100644 index 0000000..8c76d91 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/ApplicationView.ui.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/CommonMessages.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/CommonMessages.java new file mode 100644 index 0000000..3ad6635 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/CommonMessages.java @@ -0,0 +1,23 @@ +package org.gcube.portlets.user.accountingdashboard.client.application; + +import com.google.gwt.i18n.client.Messages; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public interface CommonMessages extends Messages { + + // + @DefaultMessage("Attention") + String attention(); + + @DefaultMessage("Error") + String error(); + + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ApplicationCache.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ApplicationCache.java new file mode 100644 index 0000000..f8d23f9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ApplicationCache.java @@ -0,0 +1,27 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.controller; + +import java.io.Serializable; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ApplicationCache implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 4076265357737593194L; + + public ApplicationCache() { + + } + + + @Override + public String toString() { + return "ApplicationCache"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/Controller.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/Controller.java new file mode 100644 index 0000000..90f522c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/Controller.java @@ -0,0 +1,88 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.controller; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.dialog.error.ErrorPresenter; +import org.gcube.portlets.user.accountingdashboard.client.application.dialog.info.InfoPresenter; +import org.gcube.portlets.user.accountingdashboard.client.application.dialog.monitor.MonitorPresenter; +import org.gcube.portlets.user.accountingdashboard.client.application.event.HelloEvent; +import org.gcube.portlets.user.accountingdashboard.client.rpc.AccountingDashboardServiceAsync; +import org.gcube.portlets.user.accountingdashboard.shared.session.UserInfo; + +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.inject.Inject; +import com.google.inject.name.Named; + +/** + * + * @author Giancarlo Panichi + * + */ +public class Controller { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + private EventBus eventBus; + private AccountingDashboardServiceAsync service; + private ApplicationCache cache; + private MonitorPresenter monitorPresenter; + private ErrorPresenter errorPresenter; + private InfoPresenter infoPresenter; + + @Inject + Controller(@Named("ControllerEventBus") EventBus eventBus, AccountingDashboardServiceAsync service, + MonitorPresenter monitorPresenter, ErrorPresenter errorPresenter, InfoPresenter infoPresenter) { + this.eventBus = eventBus; + this.service = service; + this.monitorPresenter = monitorPresenter; + this.errorPresenter = errorPresenter; + this.infoPresenter = infoPresenter; + this.cache = new ApplicationCache(); + } + + public void fireEvent(GwtEvent event) { + eventBus.fireEventFromSource(event, this); + } + + public final HandlerRegistration addHandler(GwtEvent.Type type, H handler) { + return eventBus.addHandler(type, handler); + } + + public EventBus getEventBus() { + return eventBus; + } + + public void hello() { + eventBus.fireEvent(new HelloEvent()); + } + + public void callHello() { + /* String groupId= GCubeClientContext.getCurrentContextId(); */ + + // String token = Window.Location.getParameter(Constants.TOKEN); + // logger.log(Level.FINE,"Token: " + token); + + // MaterialLoader.showLoading(true); + service.hello(new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + logger.log(Level.FINE, "Error in Hello(): ", caught); + errorPresenter.errorMessage(caught.getLocalizedMessage()); + } + + @Override + public void onSuccess(UserInfo result) { + logger.log(Level.FINE, "Hello: " + result.getUsername()); + } + + }); + + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ControllerModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ControllerModule.java new file mode 100644 index 0000000..c8f9fc1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/controller/ControllerModule.java @@ -0,0 +1,23 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.controller; + +import com.google.gwt.event.shared.EventBus; +import com.google.gwt.event.shared.SimpleEventBus; +import com.google.gwt.inject.client.AbstractGinModule; +import com.google.inject.Singleton; +import com.google.inject.name.Names; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ControllerModule extends AbstractGinModule { + @Override + protected void configure() { + + bind(Controller.class).in(Singleton.class); + bind(EventBus.class).annotatedWith(Names.named("ControllerEventBus")).to(SimpleEventBus.class) + .in(Singleton.class); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.java new file mode 100644 index 0000000..f48ed78 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.java @@ -0,0 +1,73 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.customwidget; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.customwidget.TagWidgetHideEvent.HasTagWidgetHideEventHandlers; +import org.gcube.portlets.user.accountingdashboard.client.application.customwidget.TagWidgetHideEvent.TagWidgetHideEventHandler; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.SpanElement; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HasText; +import com.google.gwt.user.client.ui.Widget; + +/** + * + * @author Giancarlo Panichi + * + */ +public class TagWidget extends Composite implements HasText, HasTagWidgetHideEventHandlers { + private static Logger logger = java.util.logging.Logger.getLogger(""); + private static TagWidgetUiBinder uiBinder = GWT.create(TagWidgetUiBinder.class); + + interface TagWidgetUiBinder extends UiBinder { + } + + public TagWidget() { + initWidget(uiBinder.createAndBindUi(this)); + int typeInt = Event.getTypeInt(ClickEvent.getType().getName()); + sinkEvents(typeInt); + } + + @UiField + Button button; + + @UiField + SpanElement tagLabel; + + public TagWidget(String label) { + initWidget(uiBinder.createAndBindUi(this)); + tagLabel.setInnerText(label); + button.setText("x"); + } + + @UiHandler("button") + void onClick(ClickEvent e) { + logger.log(Level.FINE,"Button Click"); + TagWidgetHideEvent event = new TagWidgetHideEvent(this); + fireEvent(event); + + } + + public void setText(String text) { + tagLabel.setInnerText(text); + } + + public String getText() { + return tagLabel.getInnerText(); + } + + @Override + public HandlerRegistration addTagWidgetHideEventHandler(TagWidgetHideEventHandler handler) { + return addHandler(handler, TagWidgetHideEvent.TYPE); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.ui.xml new file mode 100644 index 0000000..d390c68 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidget.ui.xml @@ -0,0 +1,42 @@ + + + + + + + .cmsTagLabelText { + font-weight: bold; + } + + .cmsTagLabelButton { + border-radius: 10px; + border-bottom-style: inset; + background-color: white; + font-weight: normal; + font-size: small; + padding: 2px; + margin: 1px; + line-height: 11px!important; + vertical-align: baseline; + color: #5a5a5a; + } + + .csmTagLabelPanel { + color: white; + font-weight: bold; + background-color: #00ace2; + border-radius: 8px; + padding: 3px; + margin: 2px; + width: auto; + display: inline-block; + word-wrap: break-word; + } + + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidgetHideEvent.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidgetHideEvent.java new file mode 100644 index 0000000..7e182d8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/customwidget/TagWidgetHideEvent.java @@ -0,0 +1,54 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.customwidget; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.event.shared.HasHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class TagWidgetHideEvent extends GwtEvent { + + public interface TagWidgetHideEventHandler extends EventHandler { + void onHide(TagWidgetHideEvent event); + } + + public interface HasTagWidgetHideEventHandlers extends HasHandlers { + HandlerRegistration addTagWidgetHideEventHandler(TagWidgetHideEventHandler handler); + } + + private TagWidget tagWidget; + + public static final Type TYPE = new Type<>(); + + public TagWidgetHideEvent(TagWidget tagWidget) { + this.tagWidget = tagWidget; + } + + public static void fire(HasHandlers source, TagWidgetHideEvent event) { + source.fireEvent(event); + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(TagWidgetHideEventHandler handler) { + handler.onHide(this); + } + + public TagWidget getTagWidget() { + return tagWidget; + } + + @Override + public String toString() { + return "TagWidgetHideEvent [tagWidget=" + tagWidget + "]"; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorModule.java new file mode 100644 index 0000000..bcc4744 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.error; + + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ErrorModule extends AbstractPresenterModule { + @Override + protected void configure() { + bindPresenterWidget(ErrorPresenter.class, ErrorPresenter.ErrorPresenterView.class, ErrorView.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorPresenter.java new file mode 100644 index 0000000..52b1793 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorPresenter.java @@ -0,0 +1,58 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.error; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.PopupView; +import com.gwtplatform.mvp.client.PresenterWidget; + +/** + * + * @author Giancarlo Panichi + * + * + */ + +public class ErrorPresenter extends PresenterWidget + implements ErrorUiHandlers { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface ErrorPresenterView extends PopupView, HasUiHandlers { + public void errorMessage(String error); + } + + + @Inject + ErrorPresenter(EventBus eventBus, ErrorPresenterView view) { + super(eventBus, view); + + getView().setUiHandlers(this); + bindToEvent(); + } + + @Override + public void onBind() { + super.onBind(); + } + + private void bindToEvent() { + /* + controller.getEventBus().addHandler(MonitorEvent.TYPE, new MonitorEvent.MonitorEventHandler() { + + @Override + public void onMonitor(MonitorEvent event) { + + } + }); + */ + } + + public void errorMessage(String error) { + logger.log(Level.FINE,"Error message: " + error); + getView().errorMessage(error); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorUiHandlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorUiHandlers.java new file mode 100644 index 0000000..ad4dd93 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorUiHandlers.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.error; + + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public interface ErrorUiHandlers extends UiHandlers{ + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.java new file mode 100644 index 0000000..bc784aa --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.java @@ -0,0 +1,68 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.error; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.inject.Inject; + +import com.github.gwtbootstrap.client.ui.Button; +import com.github.gwtbootstrap.client.ui.Paragraph; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.PopupPanel; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.PopupViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ErrorView extends PopupViewWithUiHandlers implements ErrorPresenter.ErrorPresenterView { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface Binder extends UiBinder { + + } + + @UiField + DialogBox dialogBox; + + @UiField + Paragraph errorMsg; + + @UiField + Button okBtn; + + @UiHandler("okBtn") + void handleClick(ClickEvent e) { + logger.log(Level.FINE,"Close error dialog"); + dialogBox.hide(); + } + + @Inject + ErrorView(Binder uiBinder, EventBus eventBus) { + super(eventBus); + init(); + initWidget(uiBinder.createAndBindUi(this)); + + } + + private void init() { + dialogBox = new DialogBox(false, true); + dialogBox.getElement().getStyle().setZIndex(1070); + errorMsg = new Paragraph(); + okBtn = new Button(); + } + + @Override + public void errorMessage(String error) { + errorMsg.setText(error); + dialogBox.center(); + dialogBox.show(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.ui.xml new file mode 100644 index 0000000..4befac1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/error/ErrorView.ui.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + Error + + + + + + + + + Ok + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoModule.java new file mode 100644 index 0000000..364cc15 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.info; + + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class InfoModule extends AbstractPresenterModule { + @Override + protected void configure() { + bindPresenterWidget(InfoPresenter.class, InfoPresenter.InfoPresenterView.class, InfoView.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoPresenter.java new file mode 100644 index 0000000..0801fb2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoPresenter.java @@ -0,0 +1,58 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.info; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.PopupView; +import com.gwtplatform.mvp.client.PresenterWidget; + +/** + * + * @author Giancarlo Panichi + * + * + */ + +public class InfoPresenter extends PresenterWidget + implements InfoUiHandlers { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface InfoPresenterView extends PopupView, HasUiHandlers { + public void infoMessage(String info); + } + + + @Inject + InfoPresenter(EventBus eventBus, InfoPresenterView view) { + super(eventBus, view); + + getView().setUiHandlers(this); + bindToEvent(); + } + + @Override + public void onBind() { + super.onBind(); + } + + private void bindToEvent() { + /* + controller.getEventBus().addHandler(MonitorEvent.TYPE, new MonitorEvent.MonitorEventHandler() { + + @Override + public void onMonitor(MonitorEvent event) { + + } + }); + */ + } + + public void infoMessage(String error) { + logger.log(Level.FINE,"Info message: " + error); + getView().infoMessage(error); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoUiHandlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoUiHandlers.java new file mode 100644 index 0000000..1a9b7a4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoUiHandlers.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.info; + + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public interface InfoUiHandlers extends UiHandlers{ + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.java new file mode 100644 index 0000000..ef243ff --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.java @@ -0,0 +1,68 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.info; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.inject.Inject; + +import com.github.gwtbootstrap.client.ui.Button; +import com.github.gwtbootstrap.client.ui.Paragraph; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.PopupPanel; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.PopupViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class InfoView extends PopupViewWithUiHandlers implements InfoPresenter.InfoPresenterView { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface Binder extends UiBinder { + + } + + @UiField + DialogBox dialogBox; + + @UiField + Paragraph infoMsg; + + @UiField + Button okBtn; + + @UiHandler("okBtn") + void handleClick(ClickEvent e) { + logger.log(Level.FINE,"Close info dialog"); + dialogBox.hide(); + } + + @Inject + InfoView(Binder uiBinder, EventBus eventBus) { + super(eventBus); + init(); + initWidget(uiBinder.createAndBindUi(this)); + + } + + private void init() { + dialogBox = new DialogBox(false, true); + dialogBox.getElement().getStyle().setZIndex(1070); + infoMsg = new Paragraph(); + okBtn = new Button(); + } + + @Override + public void infoMessage(String error) { + infoMsg.setText(error); + dialogBox.center(); + dialogBox.show(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.ui.xml new file mode 100644 index 0000000..037fef2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/info/InfoView.ui.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + Error + + + + + + + + + Ok + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorModule.java new file mode 100644 index 0000000..e73f883 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.monitor; + + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MonitorModule extends AbstractPresenterModule { + @Override + protected void configure() { + bindPresenterWidget(MonitorPresenter.class, MonitorPresenter.MonitorPresenterView.class, MonitorView.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorPresenter.java new file mode 100644 index 0000000..13a0457 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorPresenter.java @@ -0,0 +1,58 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.monitor; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.PopupView; +import com.gwtplatform.mvp.client.PresenterWidget; + +/** + * + * @author Giancarlo Panichi + * + * + */ + +public class MonitorPresenter extends PresenterWidget + implements MonitorUiHandlers { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface MonitorPresenterView extends PopupView, HasUiHandlers { + public void monitor(boolean enable); + } + + + @Inject + MonitorPresenter(EventBus eventBus, MonitorPresenterView view) { + super(eventBus, view); + + getView().setUiHandlers(this); + bindToEvent(); + } + + @Override + public void onBind() { + super.onBind(); + } + + private void bindToEvent() { + /* + controller.getEventBus().addHandler(MonitorEvent.TYPE, new MonitorEvent.MonitorEventHandler() { + + @Override + public void onMonitor(MonitorEvent event) { + + } + }); + */ + } + + public void enable(boolean enable) { + logger.log(Level.FINE,"Monitor enable: " + enable); + getView().monitor(enable); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorUiHandlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorUiHandlers.java new file mode 100644 index 0000000..d5fff2f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorUiHandlers.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.monitor; + + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public interface MonitorUiHandlers extends UiHandlers{ + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.java new file mode 100644 index 0000000..aec3e83 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.java @@ -0,0 +1,57 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.dialog.monitor; + +import javax.inject.Inject; + +import org.gcube.portlets.user.accountingdashboard.client.resources.AppResources; + +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.PopupPanel; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.PopupViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MonitorView extends PopupViewWithUiHandlers + implements MonitorPresenter.MonitorPresenterView { + interface Binder extends UiBinder { + + } + + @UiField + DialogBox dialogBox; + + private AppResources resources; + + + @Inject + MonitorView(Binder uiBinder, EventBus eventBus, AppResources resources) { + super(eventBus); + this.resources=resources; + init(); + initWidget(uiBinder.createAndBindUi(this)); + + } + + private void init() { + dialogBox = new DialogBox(false, true); + dialogBox.addStyleName(resources.uiDataCss().uiDataMonitorPopup()); + + } + + @Override + public void monitor(boolean enable) { + if (enable) { + dialogBox.center(); + dialogBox.show(); + } else { + dialogBox.hide(); + } + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.ui.xml new file mode 100644 index 0000000..8d42ea5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/dialog/monitor/MonitorView.ui.xml @@ -0,0 +1,21 @@ + + + + + + + + + Please wait + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/HelloEvent.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/HelloEvent.java new file mode 100644 index 0000000..6f9a6e5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/HelloEvent.java @@ -0,0 +1,37 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.event; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HasHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class HelloEvent extends GwtEvent { + + public interface HelloEventHandler extends EventHandler { + void onHello(HelloEvent event); + } + + public static final Type TYPE = new Type<>(); + + + public HelloEvent() {} + + + public static void fire(HasHandlers source, HelloEvent event) { + source.fireEvent(event); + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(HelloEventHandler handler) { + handler.onHello(this); + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/MonitorEvent.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/MonitorEvent.java new file mode 100644 index 0000000..814655a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/event/MonitorEvent.java @@ -0,0 +1,50 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.event; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HasHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MonitorEvent extends GwtEvent { + + private boolean enable; + public interface MonitorEventHandler extends EventHandler { + void onMonitor(MonitorEvent event); + } + + public static final Type TYPE = new Type<>(); + + public MonitorEvent(boolean enable) { + this.enable=enable; + } + + public static void fire(HasHandlers source, MonitorEvent event) { + source.fireEvent(event); + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(MonitorEventHandler handler) { + handler.onMonitor(this); + } + + public boolean isEnable() { + return enable; + } + + @Override + public String toString() { + return "MonitorEvent [enable=" + enable + "]"; + } + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaModule.java new file mode 100644 index 0000000..825f145 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaModule.java @@ -0,0 +1,21 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea; + + +import org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter.FilterAreaModule; +import org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.ReportAreaModule; + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MainAreaModule extends AbstractPresenterModule { + @Override + protected void configure() { + install(new FilterAreaModule()); + install(new ReportAreaModule()); + bindPresenter(MainAreaPresenter.class, MainAreaPresenter.MainAreaView.class, MainAreaView.class, MainAreaPresenter.MainAreaPresenterProxy.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaPresenter.java new file mode 100644 index 0000000..966844a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaPresenter.java @@ -0,0 +1,79 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea; + +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.ApplicationPresenter; +import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; +import org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter.FilterAreaPresenter; +import org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report.ReportAreaPresenter; +import org.gcube.portlets.user.accountingdashboard.client.place.NameTokens; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.Presenter; +import com.gwtplatform.mvp.client.View; +import com.gwtplatform.mvp.client.annotations.NameToken; +import com.gwtplatform.mvp.client.annotations.NoGatekeeper; +import com.gwtplatform.mvp.client.annotations.ProxyStandard; +import com.gwtplatform.mvp.client.presenter.slots.SingleSlot; +import com.gwtplatform.mvp.client.proxy.ProxyPlace; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MainAreaPresenter + extends Presenter + implements MainAreaUiHandlers { + + private static Logger logger = Logger.getLogger(""); + + interface MainAreaView extends View, HasUiHandlers { + + } + + @ProxyStandard + @NameToken(NameTokens.MAIN_AREA) + @NoGatekeeper + interface MainAreaPresenterProxy extends ProxyPlace { + } + + public static final SingleSlot SLOT_FILTER = new SingleSlot<>(); + public static final SingleSlot SLOT_REPORT = new SingleSlot<>(); + + private EventBus eventBus; + private Controller controller; + private FilterAreaPresenter filterAreaPresenter; + private ReportAreaPresenter reportAreaPresenter; + + @Inject + MainAreaPresenter(EventBus eventBus, MainAreaView view, MainAreaPresenterProxy proxy, Controller controller, + FilterAreaPresenter filterAreaPresenter, ReportAreaPresenter reportAreaPresenter) { + super(eventBus, view, proxy, ApplicationPresenter.SLOT_MAIN); + this.eventBus = eventBus; + this.controller = controller; + this.filterAreaPresenter = filterAreaPresenter; + this.reportAreaPresenter = reportAreaPresenter; + getView().setUiHandlers(this); + addProviders(); + bindToEvent(); + } + + private void addProviders() { + + } + + private void bindToEvent() { + + } + + @Override + protected void onBind() { + super.onBind(); + setInSlot(SLOT_FILTER, filterAreaPresenter); + setInSlot(SLOT_REPORT, reportAreaPresenter); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaUiHandlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaUiHandlers.java new file mode 100644 index 0000000..03bd3da --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaUiHandlers.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea; + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public interface MainAreaUiHandlers extends UiHandlers { + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.java new file mode 100644 index 0000000..ccb7bf2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.java @@ -0,0 +1,51 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea; + +import java.util.logging.Logger; + +import javax.inject.Inject; + +import org.gcube.portlets.user.accountingdashboard.client.resources.AppResources; + +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.Widget; +import com.gwtplatform.mvp.client.ViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MainAreaView extends ViewWithUiHandlers implements MainAreaPresenter.MainAreaView { + + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface Binder extends UiBinder { + } + + @UiField + HTMLPanel filterPanel; + + @UiField + HTMLPanel reportPanel; + + + private AppResources resources; + + @Inject + MainAreaView(Binder uiBinder, AppResources resources) { + this.resources = resources; + init(); + initWidget(uiBinder.createAndBindUi(this)); + bindSlot(MainAreaPresenter.SLOT_FILTER, filterPanel); + bindSlot(MainAreaPresenter.SLOT_REPORT, reportPanel); + + } + + private void init() { + + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.ui.xml new file mode 100644 index 0000000..7aa7e45 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/MainAreaView.ui.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaModule.java new file mode 100644 index 0000000..8c13ebd --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter; + + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class FilterAreaModule extends AbstractPresenterModule { + @Override + protected void configure() { + bindPresenterWidget(FilterAreaPresenter.class, FilterAreaPresenter.FilterAreaView.class, FilterAreaView.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaPresenter.java new file mode 100644 index 0000000..5059bc7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaPresenter.java @@ -0,0 +1,57 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter; + +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.PresenterWidget; +import com.gwtplatform.mvp.client.View; + +/** + * + * @author Giancarlo Panichi + * + */ +public class FilterAreaPresenter + extends PresenterWidget implements FilterAreaUiHandlers { + + private static Logger logger = Logger.getLogger(""); + + interface FilterAreaView extends View, HasUiHandlers { + + + } + + + private EventBus eventBus; + private Controller controller; + + @Inject + FilterAreaPresenter(EventBus eventBus, FilterAreaView view, + Controller controller) { + super(eventBus, view); + this.eventBus = eventBus; + this.controller = controller; + getView().setUiHandlers(this); + addProviders(); + bindToEvent(); + } + + private void addProviders() { + + + } + + private void bindToEvent() { + + } + + @Override + protected void onBind() { + super.onBind(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaUiHandlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaUiHandlers.java new file mode 100644 index 0000000..5c6f889 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaUiHandlers.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter; + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public interface FilterAreaUiHandlers extends UiHandlers { + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.java new file mode 100644 index 0000000..0b57674 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.java @@ -0,0 +1,132 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter; + +import java.util.ArrayList; +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.inject.Inject; + +import org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter.scopetree.ScopeTreeModel; +import org.gcube.portlets.user.accountingdashboard.client.resources.AppResources; +import org.gcube.portlets.user.accountingdashboard.client.resources.ScopeTreeResources; +import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData; + +import com.github.gwtbootstrap.client.ui.ListBox; +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; +import com.google.gwt.i18n.client.LocaleInfo; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.cellview.client.CellTree; +import com.google.gwt.user.cellview.client.CellTree.Resources; +import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.view.client.ListDataProvider; +import com.gwtplatform.mvp.client.ViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class FilterAreaView extends ViewWithUiHandlers + implements FilterAreaPresenter.FilterAreaView { + + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface Binder extends UiBinder { + } + + @UiField + HTMLPanel periodPanel; + + @UiField + HTMLPanel explorePanel; + + @UiField(provided = true) + ListBox yearStart; + + @UiField(provided = true) + ListBox monthStart; + + @UiField(provided = true) + ListBox yearEnd; + + @UiField(provided = true) + ListBox monthEnd; + + @UiField(provided = true) + CellTree scopeTree; + + + private AppResources resources; + + @Inject + FilterAreaView(Binder uiBinder, AppResources resources) { + this.resources = resources; + init(); + initWidget(uiBinder.createAndBindUi(this)); + + } + + private void init() { + yearStart = new ListBox(); + yearStart.setMultipleSelect(false); + + yearEnd = new ListBox(); + yearEnd.setMultipleSelect(false); + + + Date now=new Date(); + String currentYear=DateTimeFormat.getFormat(PredefinedFormat.YEAR).format(now); + logger.log(Level.FINE, "Current year: " + currentYear); + int year=Integer.parseInt(currentYear); + for(int i=2015; i<=year;i++){ + yearStart.addItem(String.valueOf(i)); + yearEnd.addItem(String.valueOf(i)); + } + + + // returns a String array with localized names of the months + String[] months = LocaleInfo.getCurrentLocale().getDateTimeFormatInfo().monthsFull(); + logger.log(Level.FINE, "Months: " + months.length); + monthStart = new ListBox(); + monthStart.setMultipleSelect(false); + + monthEnd = new ListBox(); + monthEnd.setMultipleSelect(false); + + for (int i = 0; i < months.length; i++) { + monthStart.addItem(months[i]); + monthEnd.addItem(months[i]); + } + + ScopeData children1=new ScopeData("1","children1",null); + ScopeData children3=new ScopeData("3","children3",null); + ScopeData children4=new ScopeData("4","children4",null); + + + + ArrayList children2List=new ArrayList<>(); + children2List.add(children3); + children2List.add(children4); + ScopeData children2=new ScopeData("2","children2",children2List); + + ArrayList rootList=new ArrayList<>(); + rootList.add(children1); + rootList.add(children2); + ScopeData root=new ScopeData("0","root",rootList); + + ArrayList scopeDataList=new ArrayList<>(); + scopeDataList.add(root); + + ListDataProvider dataProvider = new ListDataProvider(scopeDataList); + ScopeTreeModel scopeTreeModel=new ScopeTreeModel(dataProvider); + + ScopeTreeResources scopeTreeResources = GWT.create(ScopeTreeResources.class); + scopeTree=new CellTree(scopeTreeModel, null,scopeTreeResources); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.ui.xml new file mode 100644 index 0000000..ae56d43 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/FilterAreaView.ui.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + Filters + + + + + From: + + + + + + Select the start date + + + + To: + + + + + + Select the end date + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/scopetree/ScopeTreeModel.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/scopetree/ScopeTreeModel.java new file mode 100644 index 0000000..fbec557 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/filter/scopetree/ScopeTreeModel.java @@ -0,0 +1,97 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.filter.scopetree; + +import java.util.ArrayList; + +import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData; + +import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.Cell; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.view.client.ListDataProvider; +import com.google.gwt.view.client.TreeViewModel; + +public class ScopeTreeModel implements TreeViewModel { + private ListDataProvider dataProvider; + + /** + * This selection model is shared across all leaf nodes. A selection model + * can also be shared across all nodes in the tree, or each set of child + * nodes can have its own instance. This gives you flexibility to determine + * how nodes are selected. + */ + //private final SingleSelectionModel selectionModel = new SingleSelectionModel(); + + public ScopeTreeModel(ListDataProvider dataProvider) { + this.dataProvider=dataProvider; + } + + /** + * Get the {@link NodeInfo} that provides the children of the specified + * value. + */ + @Override + public NodeInfo getNodeInfo(T value) { + if (value == null) { + // LEVEL 0. + // We passed null as the root value. Return the composers. + // Create a data provider that contains the list of composers. + + // Create a cell to display a composer. + Cell cell = new AbstractCell() { + @Override + public void render(Context context, ScopeData value, SafeHtmlBuilder sb) { + if (value != null) { + sb.appendEscaped(value.getName()); + } + } + }; + // Return a node info that pairs the data provider and the cell. + return new DefaultNodeInfo(dataProvider, cell); + } else if (value instanceof ScopeData) { + // LEVEL 1. + // We want the children of the composer. Return the playlists. + ListDataProvider dataProvider = new ListDataProvider( + ((ScopeData) value).getChildren()); + Cell cell = new AbstractCell() { + + @Override + public void render(Context context, ScopeData value, SafeHtmlBuilder sb) { + if (value != null) { + sb.appendEscaped(value.getName()); + } + } + }; + return new DefaultNodeInfo(dataProvider, cell); + } + + + /* + else if (value instanceof ScopeData) { + + // LEVEL 2 - LEAF. + // We want the children of the playlist. Return the songs. + ListDataProvider dataProvider = new ListDataProvider(((ScopeData) value).geSongs()); + // Use the shared selection model. + return new DefaultNodeInfo(dataProvider, new TextCell(), selectionModel, null); + }*/ + return null; + } + + /** + * Check if the specified value represents a leaf node. Leaf nodes cannot be + * opened. + */ + @Override + public boolean isLeaf(Object value) { + // The leaf nodes are the songs, which are Strings. + if (value != null && value instanceof ScopeData) { + ArrayList childrens = ((ScopeData) value).getChildren(); + if (childrens == null || childrens.isEmpty()) { + return true; + } else { + return false; + } + } + return false; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReaportAreaUiHandlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReaportAreaUiHandlers.java new file mode 100644 index 0000000..07316b4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReaportAreaUiHandlers.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report; + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public interface ReaportAreaUiHandlers extends UiHandlers { + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaModule.java new file mode 100644 index 0000000..a236a59 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report; + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ReportAreaModule extends AbstractPresenterModule { + @Override + protected void configure() { + + bindPresenterWidget(ReportAreaPresenter.class, ReportAreaPresenter.ReportAreaView.class, ReportAreaView.class); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaPresenter.java new file mode 100644 index 0000000..d3a47ff --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaPresenter.java @@ -0,0 +1,53 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report; + +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.PresenterWidget; +import com.gwtplatform.mvp.client.View; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ReportAreaPresenter extends PresenterWidget + implements ReaportAreaUiHandlers { + + private static Logger logger = Logger.getLogger(""); + + interface ReportAreaView extends View, HasUiHandlers { + + } + + private EventBus eventBus; + private Controller controller; + + @Inject + ReportAreaPresenter(EventBus eventBus, ReportAreaView view, Controller controller) { + super(eventBus, view); + this.eventBus = eventBus; + this.controller = controller; + getView().setUiHandlers(this); + addProviders(); + bindToEvent(); + } + + private void addProviders() { + + } + + private void bindToEvent() { + + } + + @Override + protected void onBind() { + super.onBind(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.java new file mode 100644 index 0000000..27bbd18 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.java @@ -0,0 +1,45 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.mainarea.report; + +import java.util.logging.Logger; + +import javax.inject.Inject; + +import org.gcube.portlets.user.accountingdashboard.client.resources.AppResources; + +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.user.client.ui.Widget; +import com.gwtplatform.mvp.client.ViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +public class ReportAreaView extends ViewWithUiHandlers implements ReportAreaPresenter.ReportAreaView { + + private static Logger logger = java.util.logging.Logger.getLogger(""); + + interface Binder extends UiBinder { + } + + /*@UiField + HTMLPanel periodPanel; + */ + + + + private AppResources resources; + + @Inject + ReportAreaView(Binder uiBinder, AppResources resources) { + this.resources = resources; + init(); + initWidget(uiBinder.createAndBindUi(this)); + + } + + private void init() { + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.ui.xml new file mode 100644 index 0000000..0e76757 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/mainarea/report/ReportAreaView.ui.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + Report Area + + diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuModule.java new file mode 100644 index 0000000..29e0383 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.menu; + + +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MenuModule extends AbstractPresenterModule { + @Override + protected void configure() { + bindSingletonPresenterWidget(MenuPresenter.class, MenuPresenter.PresenterView.class, MenuView.class); + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuPresenter.java new file mode 100644 index 0000000..5e6e2c4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuPresenter.java @@ -0,0 +1,41 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.menu; + +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.HasUiHandlers; +import com.gwtplatform.mvp.client.PresenterWidget; +import com.gwtplatform.mvp.client.View; +import com.gwtplatform.mvp.client.proxy.NavigationEvent; +import com.gwtplatform.mvp.client.proxy.NavigationHandler; + +/** + * + * @author Giancarlo Panichi + * + */ +public class MenuPresenter extends PresenterWidget + implements MenuUiHandlers, NavigationHandler { + interface PresenterView extends View, HasUiHandlers { + + } + + @Inject + MenuPresenter(EventBus eventBus, PresenterView view) { + super(eventBus, view); + getView().setUiHandlers(this); + } + + @Override + protected void onBind() { + super.onBind(); + addRegisteredHandler(NavigationEvent.getType(), this); + } + + + + @Override + public void onNavigation(NavigationEvent navigationEvent) { + + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuUiHanlers.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuUiHanlers.java new file mode 100644 index 0000000..82e8c3e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuUiHanlers.java @@ -0,0 +1,14 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.menu; + + +import com.gwtplatform.mvp.client.UiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +interface MenuUiHandlers extends UiHandlers { + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.java new file mode 100644 index 0000000..c19a9fc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.java @@ -0,0 +1,30 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.menu; + +import javax.inject.Inject; + +import com.github.gwtbootstrap.client.ui.Nav; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Widget; +import com.gwtplatform.mvp.client.ViewWithUiHandlers; + +/** + * + * @author Giancarlo Panichi + * + */ +class MenuView extends ViewWithUiHandlers implements MenuPresenter.PresenterView { + + interface Binder extends UiBinder { + } + + @UiField + Nav nav; + + @Inject + MenuView(Binder uiBinder) { + initWidget(uiBinder.createAndBindUi(this)); + + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.ui.xml b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.ui.xml new file mode 100644 index 0000000..ad23fc2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/menu/MenuView.ui.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + Accounting Dashboard + + + + + Help + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DataProviderModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DataProviderModule.java new file mode 100644 index 0000000..5285f92 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DataProviderModule.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.providers; + +import com.google.gwt.inject.client.AbstractGinModule; + +/** + * + * @author Giancarlo Panichi + * + */ +public class DataProviderModule extends AbstractGinModule { + @Override + protected void configure() { + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DeadFishBySpecificDiseasesProvider.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DeadFishBySpecificDiseasesProvider.java new file mode 100644 index 0000000..b0eb42f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/DeadFishBySpecificDiseasesProvider.java @@ -0,0 +1,183 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.providers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; +import org.gcube.portlets.user.accountingdashboard.shared.data.ScopeData; + +import com.google.gwt.view.client.AsyncDataProvider; +import com.google.gwt.view.client.HasData; +import com.google.gwt.view.client.Range; +import com.google.inject.Inject; + +/** + * + * @author Giancarlo Panichi + * + */ +public class DeadFishBySpecificDiseasesProvider extends AsyncDataProvider { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + @SuppressWarnings("unused") + private Controller controller; + private int start; + private int length; + private int columnSortIndex; + private boolean ascending = false; + private String id; + private ArrayList list; + + @Inject + public DeadFishBySpecificDiseasesProvider(String id, Controller controller) { + this.id = id; + this.controller = controller; + list = new ArrayList<>(); + bindEvents(); + } + + private void bindEvents() { + /* + * EventBus eventBus = controller.getEventBus(); + * eventBus.addHandler(DatasetsEvent.TYPE, new + * DatasetsEvent.DatasetsEventHandler() { + * + * @Override public void onDatasets(DatasetsEvent event) { + * update(event.getList()); + * + * } }); + */ + } + + private void update(ArrayList list) { + + logger.log(Level.FINE, "Disease Data Display is empty: " + getDataDisplays().isEmpty()); + + logger.log(Level.FINE, "Show=[Start=" + start + ", Length=" + length + "]"); + + int limits = start + length; + if (limits > list.size()) { + limits = list.size(); + if (limits < start) { + start = limits; + } + } + + List dataInRange = new ArrayList<>(); + if (list != null && list.size() > 1) { + if (columnSortIndex > -1) { + logger.log(Level.FINE, "ColumnSortIndex: " + columnSortIndex); + logger.log(Level.FINE, "Ascending: " + ascending); + Comparator comparator; + switch (columnSortIndex) { + case 0: + comparator = new Comparator() { + public int compare(ScopeData d1, ScopeData d2) { + if (d1 == d2) { + return 0; + } + + int diff = -1; + if (d1 == null) { + diff = -1; + } else { + if (d2 == null) { + diff = 1; + } else { + + if (d1 != null) { + if (d1.getName() != null) { + diff = ((d2 != null) && (d2.getName() != null)) + ? d1.getName().compareTo(d2.getName()) : 1; + } + } + + } + } + return ascending ? -diff : diff; + } + }; + break; + default: + comparator = new Comparator() { + public int compare(ScopeData d1, ScopeData d2) { + if (d1 == d2) { + return 0; + } + + int diff = -1; + if (d1 == null) { + diff = -1; + } else { + if (d2 == null) { + diff = 1; + } else { + + if (d1 != null) { + if (d1.getName() != null) { + diff = ((d2 != null) && (d2.getName() != null)) + ? d1.getName().compareTo(d2.getName()) : 1; + } + } + + } + } + return ascending ? -diff : diff; + } + }; + break; + } + + Collections.sort(list, comparator); + + } + + dataInRange = list.subList(start, limits); + } else { + dataInRange = list; + } + this.updateRowCount(list.size(), true); + this.updateRowData(start, dataInRange); + + } + + @Override + protected void onRangeChanged(HasData display) { + Range range = display.getVisibleRange(); + start = range.getStart(); + length = range.getLength(); + logger.log(Level.FINE, "Diseases Provider Range Change: [start=" + start + ", length=" + length + "]"); + retrieveData(); + } + + public void onSortChanged(int start, int length, int columnSortIndex, boolean ascending) { + logger.log(Level.FINE, "Disease Provider Sort: [start=" + start + ", length=" + length + "]"); + this.start = start; + this.length = length; + this.columnSortIndex = columnSortIndex; + this.ascending = ascending; + retrieveData(); + } + + public void onRefreshDiseases() { + logger.log(Level.FINE, "Disease Provider Refresh"); + retrieveData(); + } + + private void retrieveData() { + logger.log(Level.FINE, "Disease Provider: " + id); + update(list); + // controller.getDatasets(productId); + + } + + public void addNewDisease() { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/TreatmentsProvider.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/TreatmentsProvider.java new file mode 100644 index 0000000..d2cbd70 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/providers/TreatmentsProvider.java @@ -0,0 +1,181 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.providers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.client.application.controller.Controller; +import org.gcube.portlets.user.accountingdashboard.shared.data.TreatmentData; + +import com.google.gwt.view.client.AsyncDataProvider; +import com.google.gwt.view.client.HasData; +import com.google.gwt.view.client.Range; +import com.google.inject.Inject; + +/** + * + * @author Giancarlo Panichi + * + */ +public class TreatmentsProvider extends AsyncDataProvider { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + @SuppressWarnings("unused") + private Controller controller; + private int start; + private int length; + private int columnSortIndex; + private boolean ascending = false; + private String id; + private ArrayList list; + + @Inject + public TreatmentsProvider(String id, Controller controller) { + this.id = id; + this.controller = controller; + list = new ArrayList<>(); + bindEvents(); + } + + private void bindEvents() { + /* + * EventBus eventBus = controller.getEventBus(); + * eventBus.addHandler(DatasetsEvent.TYPE, new + * DatasetsEvent.DatasetsEventHandler() { + * + * @Override public void onDatasets(DatasetsEvent event) { + * update(event.getList()); + * + * } }); + */ + } + + private void update(ArrayList list) { + + logger.log(Level.FINE, "Treatments Data Display is empty: " + getDataDisplays().isEmpty()); + + logger.log(Level.FINE, "Show=[Start=" + start + ", Length=" + length + "]"); + + int limits = start + length; + if (limits > list.size()) { + limits = list.size(); + if (limits < start) { + start = limits; + } + } + + List dataInRange = new ArrayList<>(); + if (list != null && list.size() > 1) { + if (columnSortIndex > -1) { + logger.log(Level.FINE, "ColumnSortIndex: " + columnSortIndex); + logger.log(Level.FINE, "Ascending: " + ascending); + Comparator comparator; + switch (columnSortIndex) { + case 0: + comparator = new Comparator() { + public int compare(TreatmentData d1, TreatmentData d2) { + if (d1 == d2) { + return 0; + } + + int diff = -1; + if (d1 != null) { + if (d1.getTreatmentType() != null) { + diff = ((d2 != null) && (d2.getTreatmentType() != null)) + ? d1.getTreatmentType().compareTo(d2.getTreatmentType()) : 1; + } + } + return ascending ? -diff : diff; + } + }; + break; + case 1: + comparator = new Comparator() { + public int compare(TreatmentData d1, TreatmentData d2) { + if (d1 == d2) { + return 0; + } + + int diff = -1; + if (d1 != null) { + if (d1.getNumberOfTreatments() != null) { + diff = ((d2 != null) && (d2.getNumberOfTreatments() != null)) + ? d1.getNumberOfTreatments().compareTo(d2.getNumberOfTreatments()) : 1; + } + } + return ascending ? -diff : diff; + } + }; + break; + default: + comparator = new Comparator() { + public int compare(TreatmentData d1, TreatmentData d2) { + if (d1 == d2) { + return 0; + } + + int diff = -1; + if (d1 != null) { + if (d1.getTreatmentType() != null) { + diff = ((d2 != null) && (d2.getTreatmentType() != null)) + ? d1.getTreatmentType().compareTo(d2.getTreatmentType()) : 1; + } + } + return ascending ? -diff : diff; + } + }; + break; + } + + Collections.sort(list, comparator); + + } + + dataInRange = list.subList(start, limits); + } else { + dataInRange = list; + } + this.updateRowCount(list.size(), true); + this.updateRowData(start, dataInRange); + + } + + @Override + protected void onRangeChanged(HasData display) { + Range range = display.getVisibleRange(); + start = range.getStart(); + length = range.getLength(); + logger.log(Level.FINE, "Treatmentss Provider Range Change: [start=" + start + ", length=" + length + "]"); + retrieveData(); + } + + public void onSortChanged(int start, int length, int columnSortIndex, boolean ascending) { + logger.log(Level.FINE, "Treatments Provider Sort: [start=" + start + ", length=" + length + "]"); + this.start = start; + this.length = length; + this.columnSortIndex = columnSortIndex; + this.ascending = ascending; + retrieveData(); + } + + public void onRefreshTreatments() { + logger.log(Level.FINE, "Treatments Provider Refresh"); + retrieveData(); + } + + private void retrieveData() { + logger.log(Level.FINE, "Treatments Provider: " + id); + update(list); + // controller.getDatasets(productId); + + } + + public void addNewTreatment() { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/CheckCellHead.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/CheckCellHead.java new file mode 100644 index 0000000..080bebf --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/CheckCellHead.java @@ -0,0 +1,42 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.utils; + +import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; + +/** + * + * @author Giancarlo Panichi + * + */ +public class CheckCellHead extends AbstractCell { + + private Boolean isSelected = false; + private static final SafeHtml INPUT_CHECKED = SafeHtmlUtils.fromSafeConstant(""); + private static final SafeHtml INPUT_UNCHECKED = SafeHtmlUtils.fromSafeConstant(""); + + public CheckCellHead() { + super("click"); + } + + @Override + public void render(Context context, Boolean value, SafeHtmlBuilder sb) { + if (isSelected) { + sb.append(INPUT_CHECKED); + } else { + sb.append(INPUT_UNCHECKED); + } + } + + public Boolean isIsSelected() { + return isSelected; + } + + public void setIsSelected(Boolean isSelected) { + this.isSelected = isSelected; + } + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/DateTimeUtils.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/DateTimeUtils.java new file mode 100644 index 0000000..e5bd286 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/application/utils/DateTimeUtils.java @@ -0,0 +1,45 @@ +package org.gcube.portlets.user.accountingdashboard.client.application.utils; + +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceException; + +import com.google.gwt.i18n.client.DateTimeFormat; + +/** + * + * @author Giancarlo Panichi + * + */ +public class DateTimeUtils { + private static Logger logger = java.util.logging.Logger.getLogger(""); + + public static String toString(Date c) { + DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss"); + if (c == null) { + logger.log(Level.FINE,"DateTimeUtils: "); + return ""; + } else { + String s = format.format(c); + logger.log(Level.FINE,"DateTimeUtils: " + s); + + return s; + } + } + + public static Date toDate(String s) throws ServiceException { + + DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + try { + Date d = format.parse(s); + return d; + } catch (IllegalArgumentException e) { + logger.log(Level.FINE,"Invalid Time Format: " + s); + throw new ServiceException("Invalid Time Format: " + s); + } + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/AccountingDashBoardClientModule.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/AccountingDashBoardClientModule.java new file mode 100644 index 0000000..577b9c9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/AccountingDashBoardClientModule.java @@ -0,0 +1,40 @@ +package org.gcube.portlets.user.accountingdashboard.client.gin; + +import org.gcube.portlets.user.accountingdashboard.client.application.ApplicationModule; +import org.gcube.portlets.user.accountingdashboard.client.place.NameTokens; +import org.gcube.portlets.user.accountingdashboard.client.resources.ResourceLoader; +import org.gcube.portlets.user.accountingdashboard.client.rpc.AccountingDashboardServiceAsync; + +import com.google.inject.Singleton; +import com.gwtplatform.mvp.client.RootPresenter; +import com.gwtplatform.mvp.client.annotations.DefaultPlace; +import com.gwtplatform.mvp.client.annotations.ErrorPlace; +import com.gwtplatform.mvp.client.annotations.UnauthorizedPlace; +import com.gwtplatform.mvp.client.gin.AbstractPresenterModule; +import com.gwtplatform.mvp.client.gin.DefaultModule; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class AccountingDashBoardClientModule extends AbstractPresenterModule { + + @Override + protected void configure() { + bind(ResourceLoader.class).asEagerSingleton(); + bind(AccountingDashboardServiceAsync.class).in(Singleton.class); + bind(RootPresenter.class).to(CustomRootPresenter.class).asEagerSingleton(); + + install(new DefaultModule()); + install(new ApplicationModule()); + + + // DefaultPlaceManager Places + bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.MAIN_AREA); + bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.MAIN_AREA); + bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.MAIN_AREA); + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/CustomRootPresenter.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/CustomRootPresenter.java new file mode 100644 index 0000000..bdc41db --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/gin/CustomRootPresenter.java @@ -0,0 +1,46 @@ +package org.gcube.portlets.user.accountingdashboard.client.gin; + + +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.google.gwt.user.client.ui.IsWidget; +import com.google.gwt.user.client.ui.RootPanel; +import com.google.inject.Inject; +import com.google.web.bindery.event.shared.EventBus; +import com.gwtplatform.mvp.client.RootPresenter; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class CustomRootPresenter extends RootPresenter { + private static Logger logger = java.util.logging.Logger.getLogger(""); + private static final String SM_DIV = "contentDiv"; + + public static final class CustomRootView extends RootView { + @Override + public void setInSlot(Object slot, IsWidget widget) { + + RootPanel root = RootPanel.get(SM_DIV); + + if (root != null) { + logger.log(Level.FINE,"Add Panel in Div " + SM_DIV); + root.add(widget); + } else { + logger.log(Level.FINE,"Add Panel in Root"); + RootPanel.get().add(widget); + } + + } + } + + + + @Inject + CustomRootPresenter(EventBus eventBus, CustomRootView myRootView) { + super( eventBus, myRootView ); + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/NameTokens.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/NameTokens.java new file mode 100644 index 0000000..735c8b6 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/NameTokens.java @@ -0,0 +1,26 @@ +package org.gcube.portlets.user.accountingdashboard.client.place; + +/** + * + * @author Giancarlo Panichi + * + */ +public class NameTokens { + public static final String MAIN_AREA = "mainarea"; + + public static final String SAVE = "save"; + public static final String HELP = "help"; + + public static String getMainArea() { + return MAIN_AREA; + } + + public static String getSave() { + return SAVE; + } + + public static String getHelp() { + return HELP; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/TokenParameters.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/TokenParameters.java new file mode 100644 index 0000000..f42e17c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/place/TokenParameters.java @@ -0,0 +1,15 @@ +package org.gcube.portlets.user.accountingdashboard.client.place; + + +/** + * + * @author Giancarlo Panichi + * + */ +public class TokenParameters { + public static final String ID = "id"; + + public static String getId() { + return ID; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/AppResources.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/AppResources.java new file mode 100644 index 0000000..653cacf --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/AppResources.java @@ -0,0 +1,68 @@ +package org.gcube.portlets.user.accountingdashboard.client.resources; + +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public interface AppResources extends ClientBundle { + + + + interface uiDataCss extends CssResource { + String uiDataBody(); + String uiDataLabel(); + String uiDataLabelKeyTag(); + String uiDataLabelGeoAreaTag(); + String uiDataParagraphCentered(); + String uiDataActionParagraph(); + String uiDataAccordionGroup(); + String uiDataFiltersPanel(); + String uiDataFiltersPeriodPanel(); + String uiDataFiltersExplorePanel(); + String uiDataFiltersTitle(); + String uiDataFiltersFormPanel(); + String uiDataFiltersControls(); + String uiDataExploreTree(); + + + String uiDataButtonRefresh(); + String uiDataIconRefresh(); + String uiDataMainDataPanel(); + String uiDataRow(); + String uiDataTable(); + String uiDataTableStriped(); + String uiDataPager(); + String uiDataDataTable(); + String uiDataDataFirstTr(); + String uiDataDataFirstTdHead(); + String uiDataDataFirstTd(); + String uiDataDataTr(); + String uiDataDataTdHead(); + String uiDataDataTd(); + String uiDataDataUl(); + String uiDataDataLi(); + String uiDataSmallDataTable(); + String uiDataSmallDataTh(); + String uiDataSmallDataTd(); + String uiDataNoMarginTable(); + String uiDataMarginBottomFixedTable(); + String uiDataTh(); + String uiDataColumnCentered(); + String uiDataMonitorPopup(); + String uiDataMonitorPopupGlass(); + String uiDataMonitorPopupProgress(); + String uiDataPopup(); + String uiDataPopupGlass(); + String uiDataFormTable(); + String uiDataFormPager(); + } + + @Source("uiData.css") + uiDataCss uiDataCss(); + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ResourceLoader.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ResourceLoader.java new file mode 100644 index 0000000..0e0c0bf --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ResourceLoader.java @@ -0,0 +1,24 @@ +package org.gcube.portlets.user.accountingdashboard.client.resources; + +import com.google.inject.Inject; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ResourceLoader { + + @Inject + ResourceLoader(AppResources appResources) { + appResources.uiDataCss().ensureInjected(); + //scopeTreeResources.cellTreeStyle().ensureInjected(); + + /*appResources.bootstrapCss().ensureInjected(); + appResources.style().ensureInjected(); + appResources.pageTable().ensureInjected();*/ + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ScopeTreeResources.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ScopeTreeResources.java new file mode 100644 index 0000000..3c6d1a5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/ScopeTreeResources.java @@ -0,0 +1,21 @@ +package org.gcube.portlets.user.accountingdashboard.client.resources; + +import com.google.gwt.user.cellview.client.CellTree.Resources; +import com.google.gwt.user.cellview.client.CellTree.Style; + +public interface ScopeTreeResources extends Resources { + + interface ScopeTreeStyle extends Style { + /** + * The path to the default CSS styles used by this resource. + */ + String DEFAULT_CSS = "uiScopeTree.css"; + } + + + /** + * The styles used in this widget. + */ + @Source(ScopeTreeStyle.DEFAULT_CSS) + ScopeTreeStyle cellTreeStyle(); + } diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiData.css b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiData.css new file mode 100644 index 0000000..60bf25a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiData.css @@ -0,0 +1,292 @@ +/* Style */ +.uiDataBody { + padding-top: 0px; +} + +.uiDataLabel { + word-wrap: break-word; +} + +.uiDataLabelKeyTag { + color: white; + font-weight: bold; + background-color: #00ace2; + border-radius: 8px; + padding: 3px; + margin: 2px; + width: auto; + display: inline-block; + word-wrap: break-word; +} + +.uiDataLabelGeoAreaTag { + color: white; + font-weight: bold; + background-color: #009688; + border-radius: 8px; + padding: 3px; + margin: 2px; + width: auto; + display: inline-block; + word-wrap: break-word; +} + +.uiDataParagraphCentered { + text-align: center; +} + +.uiDataActionParagraph { + padding: 19px 20px 20px; + margin-top: 20px; + margin-bottom: 20px; + background-color: #f5f5f5; + border-top: 1px solid #e5e5e5; +} + +.uiDataAccordionGroup { + margin-bottom: 2px; + padding-left: 10px; + border-width: 1px; + border-style: solid; + border-color: rgb(229, 229, 229); + border-image: initial; + border-radius: 4px; +} + +.uiDataFiltersPanel { + float: left; + margin-right: 10px; +} + + + +.uiDataFiltersPeriodPanel { + border-color: #eeeeee !important; + border-style: solid !important; + border-width: 1px !important; + padding: 3px !important; +} + +.uiDataFiltersExplorePanel { + border-color: #eeeeee !important; + border-style: solid !important; + border-width: 1px !important; + padding: 3px !important; +} + +.uiDataFiltersTitle { + font-size: 14px; + line-height: 20px; + color: #333; + padding: 0px; + margin: 1px; +} + +.uiDataFiltersFormPanel { + margin: 0px; +} + +.uiDataFiltersControls { + margin-left: 60px; +} + +.uiDataExploreTree { + /*float: left; + margin-right: 10px;*/ +} + + +.uiDataMainDataPanel { + float: left; + max-width: 800px; +} + +.uiDataButtonRefresh { + width: 10px !important; + height: 10px !important; + padding: 5px !important; + margin: 0px !important; + margin-top: 6px !important; + line-height: 10px !important; + float: left !important; +} + +.uiDataIconRefresh { + font-size: 12px !important; +} + +.uiDataTable { + width: 100%; + background-color: white; + margin-bottom: 10px +} + +.uiDataRow { + margin-left: 0px; +} + +.uiDataTableStriped { + width: 100%; + background-color: white; + margin-bottom: 10px +} + +.uiDataTableStriped tr:nth-child\(even\) { + background-color: #f9f9f9; +} + +.uiDataTableStriped th { + background-color: #f0f0f0; +} + +.uiDataPager { + margin-left: auto; + margin-right: auto; + margin-top: 6px; + margin-bottom: 10px; +} + +.uiDataFormTable { + width: 320px; + background-color: white; + border: 1px solid #ccc; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-transition: border linear .2s, box-shadow linear .2s; + -moz-transition: border linear .2s, box-shadow linear .2s; + -o-transition: border linear .2s, box-shadow linear .2s; + transition: border linear .2s, box-shadow linear .2s; +} + +.uiDataFormTable tr:nth-child\(even\) { + background-color: #f9f9f9; +} + +.uiDataFormTable th { + border: 1px solid #ccc; + border-radius: 4px; + background-color: #f0f0f0; + font-weight: normal; +} + +.uiDataFormTable td { + border: 1px solid #ccc; +} + +.uiDataFormPager { + margin-top: 6px; + margin-bottom: 10px; +} + +.uiDataDataTable { + width: 100%; + border-collapse: collapse; + border: 1px ridge; +} + +.uiDataDataFirstTr { + background-color: #b3e5fc; +} + +.uiDataDataFirstTdHead { + text-align: left; + font-weight: normal; + /*font-weight: bold;*/ + background-color: #b3e5fc; + width: 100px; +} + +.uiDataDataFirstTd { + background-color: #b3e5fc; +} + +.uiDataDataTr { + /*background-color: white;*/ + +} + +.uiDataDataTdHead { + text-align: left; + font-weight: normal; + /*font-weight: bold;*/ /* background-color: white; */ + width: 100px; +} + +.uiDataDataTd { + /*background-color: white; */ + +} + +.uiDataSmallDataTable, .uiDataSmallDataTh, .uiDataSmallDataTd { + border-width: 1px; + border-style: groove; + /*border-color: #FFEB3B;*/ + border-collapse: collapse; + /*background-color: #FFEB3B;*/ +} + +.uiDataDataUl { + +} + +.uiDataDataLi { + display: inline; +} + +.uiDataNoMarginTable { + margin-bottom: 0px; +} + +.uiDataMarginBottomFixedTable { + margin-bottom: 12px; +} + +.uiDataTh { + width: 120px; +} + +.uiDataColumnCentered { + margin: auto; + display: block; +} + +.uiDataColumnCentered button { + margin: auto !important; + display: block !important; +} + +/* Monitor Dialog */ +.uiDataMonitorPopup { + background-color: white; + border: 1px double black; + padding: 0 15px; + z-index: 1070; +} + +.uiDataMonitorPopupGlass { + background-color: #333333; + opacity: 0.5; + clip: rect(auto, auto, auto, auto); + z-index: 1050; +} + +.uiDataMonitorPopupProgress { + margin: 5px; + height: 20px; +} + +/* Dialog */ +.uiDataPopup { + background-color: white; + border: 1px double black; + padding: 0 15px; + z-index: 1070; +} + +.uiDataPopupGlass { + background-color: #333333; + opacity: 0.5; + clip: rect(auto, auto, auto, auto); + z-index: 1050; +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiScopeTree.css b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiScopeTree.css new file mode 100644 index 0000000..c88c823 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/resources/uiScopeTree.css @@ -0,0 +1,68 @@ +.cellTreeWidget { + +} + +.cellTreeEmptyMessage { + padding-left: 16px; + font-style: italic; +} + +.cellTreeItem { + padding-top: 4px; + padding-bottom: 4px; + cursor: hand; + cursor: pointer; + zoom: 1; +} + +.cellTreeItemImage { + +} + +.cellTreeItemImageValue { + zoom: 1; +} + +.cellTreeItemValue { + padding-left: 3px; + padding-right: 3px; + outline: none; +} + +.cellTreeOpenItem { + +} + +.cellTreeTopItem { + /*font-weight: bold;*/ + color: #4b4a4a; + margin-top: 20px; + padding: 3px 13px 3px 10px !important; +} + +.cellTreeTopItemImage { + +} + +.cellTreeTopItemImageValue { + /*border-bottom: 1px solid #6f7277; + padding-bottom: 1px;*/ +} + +.cellTreeKeyboardSelectedItem { + background-color: #ffc; + outline: none; +} + +@sprite .cellTreeSelectedItem { + gwt-image: 'cellTreeSelectedBackground'; + background-color: #628cd5; + color: white; + height: auto; + overflow: visible; +} + +.cellTreeShowMoreButton { + padding-left: 16px; + outline: none; +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardService.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardService.java new file mode 100644 index 0000000..0f8a0cb --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardService.java @@ -0,0 +1,28 @@ +package org.gcube.portlets.user.accountingdashboard.client.rpc; + +import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceException; +import org.gcube.portlets.user.accountingdashboard.shared.session.UserInfo; + +import com.google.gwt.user.client.rpc.RemoteService; +import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; + +/** + * + * @author Giancarlo Panichi + * + * + */ +@RemoteServiceRelativePath("accountingdashboardservice") +public interface AccountingDashboardService extends RemoteService { + /** + * Get informations on the current user + * + * @return UserInfo user inforamations + * @throws ServiceException + * exception + */ + public UserInfo hello() throws ServiceException; + + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardServiceAsync.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardServiceAsync.java new file mode 100644 index 0000000..363d6c1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/client/rpc/AccountingDashboardServiceAsync.java @@ -0,0 +1,26 @@ +/** + * + */ +package org.gcube.portlets.user.accountingdashboard.client.rpc; + +import org.gcube.portlets.user.accountingdashboard.shared.session.UserInfo; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.AsyncCallback; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public interface AccountingDashboardServiceAsync { + + public static AccountingDashboardServiceAsync INSTANCE = (AccountingDashboardServiceAsync) GWT + .create(AccountingDashboardService.class); + + void hello(AsyncCallback callback); + + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/portlet/AccountingDashboardPortlet.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/portlet/AccountingDashboardPortlet.java new file mode 100644 index 0000000..b31d074 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/portlet/AccountingDashboardPortlet.java @@ -0,0 +1,49 @@ +package org.gcube.portlets.user.accountingdashboard.portlet; + + + +import java.io.IOException; + +import javax.portlet.GenericPortlet; +import javax.portlet.PortletException; +import javax.portlet.PortletRequestDispatcher; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.gcube.common.portal.PortalContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class AccountingDashboardPortlet extends GenericPortlet { + + private final Logger logger= LoggerFactory.getLogger(GenericPortlet.class); + + /** + * + */ + public static final String VIEW_JSP = "/WEB-INF/jsp/AccountingDashboardPortlet_view.jsp"; + + /** + * @param request . + * @param response . + * @throws IOException . + * @throws PortletException . + */ + public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { + + logger.trace("AccountingDashboard loading from JSP: "+VIEW_JSP); + logger.trace("Setting user in session using PortalContext"); + PortalContext.setUserInSession(request); + + + logger.trace("passing to the render"); + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP); + rd.include(request,response); + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/server/AccountingDashboardServiceImpl.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/AccountingDashboardServiceImpl.java new file mode 100644 index 0000000..cc06375 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/AccountingDashboardServiceImpl.java @@ -0,0 +1,62 @@ +package org.gcube.portlets.user.accountingdashboard.server; + +import javax.servlet.ServletException; + +import org.gcube.portlets.user.accountingdashboard.client.rpc.AccountingDashboardService; +import org.gcube.portlets.user.accountingdashboard.server.util.ServiceCredentials; +import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceException; +import org.gcube.portlets.user.accountingdashboard.shared.session.UserInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gwt.user.server.rpc.RemoteServiceServlet; + +/** + * + * @author Giancarlo Panichi + * + * + */ +@SuppressWarnings("serial") +public class AccountingDashboardServiceImpl extends RemoteServiceServlet implements AccountingDashboardService { + + private static Logger logger = LoggerFactory.getLogger(AccountingDashboardServiceImpl.class); + + /** + * {@inheritDoc} + */ + @Override + public void init() throws ServletException { + super.init(); + logger.info("AccountingDashbord Service started!"); + + } + + /** + * + * {@inheritDoc} + * + */ + @Override + public UserInfo hello() throws ServiceException { + try { + logger.debug("AccountingDashboardServiceImpl hello()"); + ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(this.getThreadLocalRequest()); + UserInfo userInfo = new UserInfo(serviceCredentials.getUserName(), serviceCredentials.getGroupId(), + serviceCredentials.getGroupName(), serviceCredentials.getScope(), serviceCredentials.getEmail(), + serviceCredentials.getFullName()); + logger.debug("UserInfo: " + userInfo); + return userInfo; + } catch (ServiceException e) { + logger.error(e.getLocalizedMessage(), e); + throw e; + } catch (Throwable e) { + logger.error("Hello(): " + e.getLocalizedMessage(), e); + throw new ServiceException(e.getLocalizedMessage(), e); + } + + } + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/SessionUtil.java new file mode 100644 index 0000000..7baf254 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/SessionUtil.java @@ -0,0 +1,187 @@ +/** + * + */ +package org.gcube.portlets.user.accountingdashboard.server; + +import javax.servlet.http.HttpServletRequest; + + +import org.gcube.common.authorization.library.provider.SecurityTokenProvider; +import org.gcube.common.portal.PortalContext; +import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.portlets.user.accountingdashboard.server.util.ServiceCredentials; +import org.gcube.portlets.user.accountingdashboard.shared.Constants; +import org.gcube.portlets.user.accountingdashboard.shared.exception.ServiceException; +import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager; +import org.gcube.vomanagement.usermanagement.model.GCubeGroup; +import org.gcube.vomanagement.usermanagement.model.GCubeUser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class SessionUtil { + + private static final Logger logger = LoggerFactory.getLogger(SessionUtil.class); + + /** + * + * @param httpServletRequest + * http servlet request + * @return service credentials + * @throws ServiceException + * exception + */ + public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest) + throws ServiceException { + return getServiceCredentials(httpServletRequest, null); + } + + /** + * + * @param httpServletRequest + * http servlet request + * @param scopeGroupId + * scope group id + * @return service credentials + * @throws ServiceException + * exception + */ + public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest, String scopeGroupId) + throws ServiceException { + + ServiceCredentials sCredentials = null; + String userName = null; + String scope = null; + String token = null; + String groupId = null; + String groupName = null; + + if (Constants.DEBUG_MODE) { + logger.debug("No credential found in session, use test user!"); + /* + * InfoLocale infoLocale = getInfoLocale(httpServletRequest, null); + * Locale locale = new Locale(infoLocale.getLanguage()); + * + * ResourceBundle messages = ResourceBundle.getBundle( + * StatAlgoImporterServiceMessagesConstants.TDGWTServiceMessages, + * locale); + */ + userName = Constants.DEFAULT_USER; + scope = Constants.DEFAULT_SCOPE; + token = Constants.DEFAULT_TOKEN; + + logger.debug("Set SecurityToken: " + token); + SecurityTokenProvider.instance.set(token); + logger.debug("Set ScopeProvider: " + scope); + ScopeProvider.instance.set(scope); + + sCredentials = new ServiceCredentials(userName, scope, token); + + } else { + logger.debug("Retrieving credential in session!"); + PortalContext pContext = PortalContext.getConfiguration(); + boolean hasScopeGroupId = false; + + if (scopeGroupId != null && !scopeGroupId.isEmpty()) { + hasScopeGroupId = true; + + } else { + hasScopeGroupId = false; + } + + if (hasScopeGroupId) { + scope = pContext.getCurrentScope(scopeGroupId); + } else { + scope = pContext.getCurrentScope(httpServletRequest); + } + + if (scope == null || scope.isEmpty()) { + String error = "Error retrieving scope: " + scope; + logger.error(error); + throw new ServiceException(error); + } + + GCubeUser gCubeUser = pContext.getCurrentUser(httpServletRequest); + + if (gCubeUser == null) { + String error = "Error retrieving gCubeUser in scope " + scope + ": " + gCubeUser; + logger.error(error); + throw new ServiceException(error); + } + + userName = gCubeUser.getUsername(); + + if (userName == null || userName.isEmpty()) { + String error = "Error retrieving username in scope " + scope + ": " + userName; + logger.error(error); + throw new ServiceException(error); + } + + token = pContext.getCurrentUserToken(scope, userName); + + if (token == null || token.isEmpty()) { + String error = "Error retrieving token for " + userName + " in " + scope + ": " + token; + logger.error(error); + throw new ServiceException(error); + } + + String name = gCubeUser.getFirstName(); + String lastName = gCubeUser.getLastName(); + String fullName = gCubeUser.getFullname(); + + String userAvatarURL = gCubeUser.getUserAvatarURL(); + + String email = gCubeUser.getEmail(); + + if (hasScopeGroupId) { + logger.debug("Set SecurityToken: " + token); + SecurityTokenProvider.instance.set(token); + logger.debug("Set ScopeProvider: " + scope); + ScopeProvider.instance.set(scope); + + groupId = scopeGroupId; + + long gId; + + try { + gId = Long.parseLong(scopeGroupId); + } catch (Throwable e) { + String error = "Error retrieving groupId: " + scopeGroupId; + logger.error(error, e); + throw new ServiceException(error); + } + + GCubeGroup group; + try { + group = new LiferayGroupManager().getGroup(gId); + } catch (Throwable e) { + String error = "Error retrieving group: " + groupName; + logger.error(error); + throw new ServiceException(error); + } + + groupName = group.getGroupName(); + + } else { + + groupId = String.valueOf(pContext.getCurrentGroupId(httpServletRequest)); + + groupName = pContext.getCurrentGroupName(httpServletRequest); + + } + + sCredentials = new ServiceCredentials(userName, fullName, name, lastName, email, scope, groupId, groupName, + userAvatarURL, token); + } + + logger.debug("ServiceCredentials: " + sCredentials); + + return sCredentials; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/AccountingService.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/AccountingService.java new file mode 100644 index 0000000..eb710e1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/accounting/AccountingService.java @@ -0,0 +1,33 @@ +package org.gcube.portlets.user.accountingdashboard.server.accounting; + +import org.gcube.data.access.accounting.summary.access.AccountingDao; +import org.gcube.data.access.accounting.summary.access.model.ScopeDescriptor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Giancarlo Panichi + * + */ +public class AccountingService { + + private static Logger logger = LoggerFactory.getLogger(AccountingService.class); + + private AccountingDao dao; + + public AccountingService() { + dao = AccountingDao.get(); + } + + public void getTree() { + try { + logger.debug("AccountingService GetTree()"); + ScopeDescriptor scopeDescriptor = dao.getTree(null); + logger.debug("ScopeDescriptor: "+scopeDescriptor); + + } catch (Exception e) { + logger.error("Error retrieving Tree: "+e.getLocalizedMessage(),e); + } + } +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/server/util/ServiceCredentials.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/util/ServiceCredentials.java new file mode 100644 index 0000000..c3ac869 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/server/util/ServiceCredentials.java @@ -0,0 +1,141 @@ +package org.gcube.portlets.user.accountingdashboard.server.util; + +import java.io.Serializable; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceCredentials implements Serializable { + + private static final long serialVersionUID = -2151806926120378275L; + private String userName; + private String fullName; + private String name; + private String lastName; + private String email; + private String scope; + private String groupId; + private String groupName; + private String userAvatarURL; + private String token; + + public ServiceCredentials() { + super(); + } + + public ServiceCredentials(String userName, String scope, String token) { + super(); + this.userName = userName; + this.scope = scope; + this.token = token; + } + + public ServiceCredentials(String userName, String fullName, String name, + String lastName, String email, String scope, String groupId, + String groupName, String userAvatarURL, String token) { + super(); + this.userName = userName; + this.fullName = fullName; + this.name = name; + this.lastName = lastName; + this.email = email; + this.scope = scope; + this.groupId = groupId; + this.groupName = groupName; + this.userAvatarURL = userAvatarURL; + this.token = token; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getUserAvatarURL() { + return userAvatarURL; + } + + public void setUserAvatarURL(String userAvatarURL) { + this.userAvatarURL = userAvatarURL; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + @Override + public String toString() { + return "ServiceCredentials [userName=" + userName + ", fullName=" + + fullName + ", name=" + name + ", lastName=" + lastName + + ", email=" + email + ", scope=" + scope + ", groupId=" + + groupId + ", groupName=" + groupName + ", userAvatarURL=" + + userAvatarURL + ", token=" + token + "]"; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/Constants.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/Constants.java new file mode 100644 index 0000000..67c2a2b --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/Constants.java @@ -0,0 +1,37 @@ +package org.gcube.portlets.user.accountingdashboard.shared; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class Constants { + + public static final boolean DEBUG_MODE = false; + public static final boolean TEST_ENABLE = false; + + public static final String APPLICATION_ID = "org.gcube.portlets.user.accountingdashboard.server.portlet.AccountingDashboardPortlet"; + public static final String CMEMS_IMPORTER_ID = "AccountingDashboardId"; + public static final String CMEMS_IMPORTER_COOKIE = "AccountingDashboardLangCookie"; + public static final String CMEMS_IMPORTER_LANG = "AccountingDashBoradLang"; + + public static final String DEFAULT_USER = "giancarlo.panichi"; + public static final String DEFAULT_SCOPE = "/gcube/devNext/NextNext"; + public static final String DEFAULT_TOKEN = ""; + public static final String DEFAULT_ROLE = "OrganizationMember"; + + // + public static final int PAGE_SIZE_DEFAULT = 20; + public static final int PAGE_SIZE_IN_FORM_DEFAULT = 10; + + // Session + public static final String CURR_GROUP_ID = "CURR_GROUP_ID"; + public static final String CURR_USER_ID = "CURR_USER_ID"; + + + // Service + public static final int CLIENT_MONITOR_PERIODMILLIS = 2000; + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/ScopeData.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/ScopeData.java new file mode 100644 index 0000000..8600861 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/ScopeData.java @@ -0,0 +1,89 @@ +package org.gcube.portlets.user.accountingdashboard.shared.data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Comparator; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ScopeData implements Serializable, Comparator, Comparable { + + private static final long serialVersionUID = -8445665293115680236L; + private String id; + private String name; + private ArrayList children; + + public ScopeData() { + super(); + } + + public ScopeData(String id, String name, ArrayList children) { + super(); + this.id = id; + this.name = name; + this.children = children; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ArrayList getChildren() { + return children; + } + + public void setChildren(ArrayList children) { + this.children = children; + } + + @Override + public int compare(ScopeData o1, ScopeData o2) { + if (o1 == o2) { + return 0; + } + + if (o1 == null) { + return -1; + } else { + if (o2 == null) { + return 1; + } else { + int diff = -1; + if (o1 != null) { + if (o1.getId() != null) { + diff = ((o2 != null) && (o2.getId() != null)) ? o1.getId().compareTo(o2.getId()) : 1; + } + } + return diff; + + } + } + } + + @Override + public int compareTo(ScopeData o) { + return compare(this, o); + } + + @Override + public String toString() { + return "ScopeData [id=" + id + ", name=" + name + ", children=" + children + "]"; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/TreatmentData.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/TreatmentData.java new file mode 100644 index 0000000..b0484d1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/data/TreatmentData.java @@ -0,0 +1,79 @@ +package org.gcube.portlets.user.accountingdashboard.shared.data; + +import java.io.Serializable; +import java.util.Comparator; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class TreatmentData implements Serializable, Comparator, Comparable { + + private static final long serialVersionUID = -8445665293115680236L; + private int id; + private String treatmentType; + private Integer numberOfTreatments; + + public TreatmentData() { + super(); + } + + public TreatmentData(int id, String treatmentType, Integer numberOfTreatments) { + super(); + this.id = id; + this.treatmentType = treatmentType; + this.numberOfTreatments = numberOfTreatments; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getTreatmentType() { + return treatmentType; + } + + public void setTreatmentType(String treatmentType) { + this.treatmentType = treatmentType; + } + + public Integer getNumberOfTreatments() { + return numberOfTreatments; + } + + public void setNumberOfTreatments(Integer numberOfTreatments) { + this.numberOfTreatments = numberOfTreatments; + } + + @Override + public int compare(TreatmentData o1, TreatmentData o2) { + if (o1 == null) { + return -1; + } else { + if (o2 == null) { + return 1; + } else { + return (o1.getId() < o2.getId()) ? -1 : ((o1.getId() == o2.getId()) ? 0 : 1); + + } + } + } + + @Override + public int compareTo(TreatmentData o) { + return compare(this, o); + } + + @Override + public String toString() { + return "TreatmentData [id=" + id + ", treatmentType=" + treatmentType + ", numberOfTreatments=" + + numberOfTreatments + "]"; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/ServiceException.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/ServiceException.java new file mode 100644 index 0000000..c6b48a7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/ServiceException.java @@ -0,0 +1,44 @@ +package org.gcube.portlets.user.accountingdashboard.shared.exception; + +/** + * + */ + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class ServiceException extends Exception { + + private static final long serialVersionUID = -2255657546267656458L; + + /** + * + */ + public ServiceException() { + super(); + } + + /** + * @param message + * message + */ + public ServiceException(String message) { + super(message); + } + + /** + * + * @param message + * message + * @param throwable + * throwable + * + */ + public ServiceException(String message, Throwable throwable) { + super(message, throwable); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/SessionExpiredException.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/SessionExpiredException.java new file mode 100644 index 0000000..c3068cf --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/exception/SessionExpiredException.java @@ -0,0 +1,39 @@ +package org.gcube.portlets.user.accountingdashboard.shared.exception; + +/** + * ASL Session Expired Exception + * + * @author Giancarlo Panichi + * + */ +public class SessionExpiredException extends ServiceException { + + private static final long serialVersionUID = -4831171355042165166L; + + /** + * + */ + public SessionExpiredException() { + super(); + } + + /** + * @param message + * message + */ + public SessionExpiredException(String message) { + super(message); + } + + /** + * + * @param message + * message + * @param throwable + * throwable + */ + public SessionExpiredException(String message, Throwable throwable) { + super(message, throwable); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/SessionConstants.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/SessionConstants.java new file mode 100644 index 0000000..e21a1f5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/SessionConstants.java @@ -0,0 +1,18 @@ +package org.gcube.portlets.user.accountingdashboard.shared.session; + + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class SessionConstants { + + public static final String SAI_DESCRIPTOR="SAI_DESCRIPTOR"; + public static final String FILE_UPLOAD_MONITOR="FILE_UPLOAD_MONITOR"; + public static final String IMPORT_CODE_FILE_UPLOAD_SESSION = "IMPORT_CODE_FILE_UPLOAD_SESSION"; + public static final String PROJECT = "PROJECT"; + + +} diff --git a/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/UserInfo.java b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/UserInfo.java new file mode 100644 index 0000000..27720d2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/accountingdashboard/shared/session/UserInfo.java @@ -0,0 +1,107 @@ +package org.gcube.portlets.user.accountingdashboard.shared.session; + + +import java.io.Serializable; + +/** + * + * @author Giancarlo Panichi + * + * + */ +public class UserInfo implements Serializable { + + private static final long serialVersionUID = -2826549639677017234L; + + private String username; + private String groupId; + private String groupName; + private String scope; + private String userEmailAddress; + private String userFullName; + + public UserInfo() { + super(); + } + + /** + * + * @param username + * user name + * @param groupId + * group id + * @param groupName + * group name + * @param scope + * scope + * @param userEmailAddress + * email + * @param userFullName + * full name + */ + public UserInfo(String username, String groupId, String groupName, String scope, String userEmailAddress, + String userFullName) { + super(); + this.username = username; + this.groupId = groupId; + this.groupName = groupName; + this.scope = scope; + this.userEmailAddress = userEmailAddress; + this.userFullName = userFullName; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getScope() { + return scope; + } + + public void setScope(String scope) { + this.scope = scope; + } + + public String getUserEmailAddress() { + return userEmailAddress; + } + + public void setUserEmailAddress(String userEmailAddress) { + this.userEmailAddress = userEmailAddress; + } + + public String getUserFullName() { + return userFullName; + } + + public void setUserFullName(String userFullName) { + this.userFullName = userFullName; + } + + @Override + public String toString() { + return "UserInfo [username=" + username + ", groupId=" + groupId + ", groupName=" + groupName + ", scope=" + + scope + ", userEmailAddress=" + userEmailAddress + ", userFullName=" + userFullName + "]"; + } + +} diff --git a/src/main/resources/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml b/src/main/resources/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml new file mode 100644 index 0000000..6ebd420 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/accountingdashboard/accountingdashb.gwt.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/AccountingDashboard.css b/src/main/webapp/AccountingDashboard.css new file mode 100644 index 0000000..18c44cf --- /dev/null +++ b/src/main/webapp/AccountingDashboard.css @@ -0,0 +1,55 @@ +/* FIX FOR Portal Theme +.aui body { + color: #000; + font-weight: normal !important; +} + +.aui input[type="text"], .aui select, .aui textarea, .aui .uneditable-input + { + margin-bottom: 1px !important; + padding: 0px !important; +} + +.aui input[type="radio"], .aui input[type="checkbox"] { + margin: 0px !important; + width: 10px !important; +} + +.aui input, .aui textarea, .aui .uneditable-input { + width: 100% !important; +} + +.aui p { + margin: 0px !important; +} + +.aui img { + vertical-align: baseline !important; +} + +.aui fieldset { + padding: 9px !important; + border: 1px solid rgb(181, 184, 200) !important; +} + +.aui legend { + margin-bottom: 0px !important; + width: auto !important; + border-bottom: none !important; +} + +.aui label { + display: inline !important; + + } + +.aui ul, .aui ol { + margin: 0px !important; +} +*/ +/* Workspace Explorer */ +/* +#drop_target_inner { + background-image: url("statalgoimporter/images/upload_128.png") !important; +} +*/ diff --git a/src/main/webapp/AccountingDashboard.html b/src/main/webapp/AccountingDashboard.html new file mode 100644 index 0000000..4394751 --- /dev/null +++ b/src/main/webapp/AccountingDashboard.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + +Accounting Dashboard + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/AccountingDashboardPortlet_view.jsp b/src/main/webapp/WEB-INF/jsp/AccountingDashboardPortlet_view.jsp new file mode 100644 index 0000000..c9b7bff --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/AccountingDashboardPortlet_view.jsp @@ -0,0 +1,14 @@ +<%@page contentType="text/html"%> +<%@page pageEncoding="UTF-8"%> + + + + +<%-- --%> + + + + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml new file mode 100644 index 0000000..94e7f24 --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-display.xml @@ -0,0 +1,9 @@ + + + + + + + + diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..803e386 --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,9 @@ +name=AccountingDashboard +module-group-id=liferay +module-incremental-version=1 +tags= +short-description= +change-log= +page-url=http://www.d4science.eu +author=D4Science EU +licenses= diff --git a/src/main/webapp/WEB-INF/liferay-portlet.xml b/src/main/webapp/WEB-INF/liferay-portlet.xml new file mode 100644 index 0000000..397c20e --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -0,0 +1,14 @@ + + + + + + AccountingDashboard + /icon.png + false + false + false + AccountingDashboardCSS + + diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml new file mode 100644 index 0000000..45b591f --- /dev/null +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -0,0 +1,27 @@ + + + + AccountingDashboard + AccountingDashboard + AccountingDashboard + org.gcube.portlets.user.accountingdashboard.portlet.AccountingDashboardPortlet + 0 + + text/html + view + + + AccountingDashboard + AccountingDashboard + + + + portletSetupShowBorders + false + + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..2eedabb --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,22 @@ + + + + jUnitHostImpl + com.google.gwt.junit.server.JUnitHostImpl + + + AccountingDashboardService + org.gcube.portlets.user.accountingdashboard.server.AccountingDashboardServiceImpl + + + jUnitHostImpl + /accountingdashb/junithost/* + + + AccountingDashboardService + /accountingdashb/accountingdashboardservice + + + AccountingDashboard.html + + \ No newline at end of file diff --git a/src/main/webapp/icon.png b/src/main/webapp/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..a0c3310077169dac868cda635e2a2b6ee25a8639 GIT binary patch literal 3041 zcmV<73m)`|P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^t? z4gf0}gK-o9000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000X-Nklsfo&yR&oIxqkQWd;151 z6ooY8{P#*nzw_uE>HVD}_yBS5eb2JVymv&z|HJSR;z<2J=4VoN0dWN2)Av39*sIRSI=snELRTGxeGS{se zA3HwVzHW4U^QYeU;Va#b-*r8f=cB0*hEnz>;^O#RS^i&r<^78O&g1_Iz#o48KmNYj zX&w2`*ALvgxKfm}XHKETEomlv5lV~vP?}sJ%UYvC*Y65fdeRLn`Um=@5F)u)7IOYP zTqvuYUJ|0(Pzb`{J+04n?|43g3Ia*ARAp@1VQwZ0si(c@8UNec+o7$2v-x`gWMn1vziu0 zK6&dPU;WyvfA`%Vls>Ad9XT=Ja?NB+)Y=}Fy~JB5b$;`vtfgv1Q|B4EANfX`oBm3Z55& z?U0PAn1;?`!xrskRq9&&j%0drTenp__MQ>+_lT=5+vsrV7L7=1gkebF4)EfIenzrO zJb9;y9)az}W$Vd^6 z?P{v3KLOmG?pyyhKyCk_^edf+y+<=r*M#uGh`yvoCZV7k1}Qy`8IR-n0Y<71!*jUu zsw+5MKEXs|J+nt%$4n;i0|yxyeE9ZzST2__%pMlbEpWDY3Qdg&Wr#q?Fp7RPm)o2z zmrvFd06WwFgyn~1(~20*YV;))rgCu%U0_El&%azImsg081VSa1?x)(kz~sOXN8Wsm zOK-TDsp)GO8sA8Mbc%eTKyPm^&1MbPx6w3(C<=+`8W0IZNNnHx!jDEEqw8E>V!NRX zA}L%yq}*^(6&UE#$WP|@%$JWcHf)m5rP;J$hz;vDF}m>7>jC$M0 zRdv30{|36&ICuT=Zpu}agGW#DYjSMwIH2PRgkkD32q+lIi9W5>>JBtpQMTLZh&>1Ev|BBrxXJA4DwBDg+cx-w zW)ii-h-;W|O+lSyW9-H@+*aVMqoP42wsM)n-sO*%b7yKP}L zB&zbZ_c^Xb7^uQD6ItERvzp_EX3dVwf>~utE=g}sA4Vq4tIh(`V-f%I?IS#RaFsV^ ziewWy$BxX?-+whXY`=uze2#8?k>kftuJyR}Gjt;NV>oHHkU zOf!yQn{?V9K@gcy;F-$oyd%%AbTEtr2No_6m?@;txomojgT+36@IN(H8$P-!iN|#m z73SxQqoXRZ#$qOkTOD3 z6|}keuAR<$*4@9jHU6DF4UW#ua`mOtqQyx$;>KT^n00_@E91%FgZEGw#znSCJlIHsP`}{+B=Yhxm zd+EZ;@r{>HnXF~|nW|PBUkyy}%~$Qz&uR8`>n0XP2K4l46C z)~y?1{&bNI8^&-Q8{2CjOar^>GCUEd(-atnj^{-}kLed{s|!sH!1t5;<5In4=2VSB zYKg)pcJNn!_8p3)CWaAb^X3sAdHCZblLn<#mmmreLZTqhRA@9>Y~Q{O*Yg=1>?f5> zV8nGw=hqlW>%>R<2qKRl^oUd;g{}%EW*&RbPWb2-z9&~!&&oc-5#y5ucI`ULTD?MF zkIKcBRo1W1@#I%NOWo6$8Z<#jG(`|f$(Nscj-j|kB5C0H0g3`Izr2_7@+voc_+}n@ z_(1~SB?u$@FeD5m^{$wC@nB>7yJi$qVqZ-eJr5}{jfD#fTs}R{;UgB!c8f$Z!R(18 z+8qb8CxaVC2*6h$3L~nuCZ+N@a)m6j$LEO~I*mpLMOCO*9ir3<)$Ro%86jmP?XV*z zk~`9!?y~kSKq{GdCZT2TZ+0p@o7P<_jChK*W)sitwCU#=)ogyDCL3uWvbPdxb_O2;$j>bc{oew2v#DRtrm)iD3w-Fh%i$o!b>tf zo@4Wtb?BNxBqQeLT*5E{BI3Hhj0tp2l8A#JMA)A9-j(dW-@ED27yfDg$n;gi_wL`n zpKPBdM~8-lnP}s?P-{B$_Zoy!#}7UF1_p@2fK0~3b3OL%n<0!s0^cJ$kYe3bfmlpM zN=dEl)3F0wKcrNbM3KaHgZBb_GieqUT8xeK zkV++q$8{XXCLU8!R7olsL)R24)jCTT%QRaZ7SET6$0Dwt+$0r&xTIi`HdTtNHj_gp z-#xIV1%dzmm(dsh=0I|-(tf61YyOt!T5@bSDG~{VmvEvk-SNUTJAV6xW}~SGVTk4W*ly4|v($d|eF5(H#4i5* zg^h)AY;VqzrM z!)tqwQCeCd@Es}eh3~cLcB)9cr=l==wpl-W?*G&Oz{e@TXFj*{vBgsLL%!1;J%6Fx z9|U${>m_+&T4c}6&esF4Q(7u5?rYTM{``Y#{!9Sx{+f^dwfgGbQ(4<;C6-Dn