From b3923bd2fbf3b0b604385bb9dedc3619e61b1485 Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sat, 12 May 2012 17:26:21 +0200 Subject: [PATCH] Added pdf export support, export servlet support, renamed frontends without s and made vasc config object. --- todo.txt | 11 + .../jpa/XpqlHibernateVascBackend.java | 2 +- .../jpa/XpqlPersistanceVascBackend.java | 2 +- .../metamodel/MetaModelVascBackend.java | 2 +- .../backend/mongodb/MongodbVascBackend.java | 2 +- vasc-core/pom.xml | 5 + .../backend/data/BeanVascEntryFieldValue.java | 2 +- .../data/BeanVascEntryRecordCreator.java | 8 +- .../backend/data/MapVascEntryFieldValue.java | 8 +- .../data/MapVascEntryRecordCreator.java | 8 +- .../proxy/AbstractVascBackendProxy.java | 27 +- .../vasc/backend/proxy/VascBackendProxy.java | 41 + .../backend/proxy/VascBackendProxyCache.java | 47 +- .../proxy/VascBackendProxyEventExecutor.java | 35 +- .../backend/proxy/VascBackendProxyFilter.java | 47 +- .../backend/proxy/VascBackendProxyPaged.java | 24 +- .../backend/proxy/VascBackendProxySearch.java | 26 +- .../backend/proxy/VascBackendProxySort.java | 25 +- .../proxy/VascBackendProxyTimerLogger.java | 18 +- .../forwardfire/vasc/core/VascController.java | 5 + .../vasc/core/VascControllerProvider.java | 37 + .../net/forwardfire/vasc/core/VascEntry.java | 20 + .../vasc/core/VascEntryConfigController.java | 93 + ...zer.java => VascEntryConfigFinalizer.java} | 6 +- .../vasc/core/VascEntryController.java | 2 - .../vasc/core/VascEntryControllerLocal.java | 6 +- .../forwardfire/vasc/core/VascLinkEntry.java | 36 +- .../vasc/core/entry/VascEntryExporter.java | 4 +- .../entry/VascEntryFieldValidatorService.java | 9 + .../vasc/impl/DefaultVascController.java | 16 + .../vasc/impl/DefaultVascEntry.java | 42 +- .../DefaultVascEntryConfigController.java | 289 +++ .../vasc/impl/DefaultVascEntryController.java | 49 +- .../vasc/impl/DefaultVascFactory.java | 118 +- .../vasc/impl/DefaultVascFrontendData.java | 10 +- .../vasc/impl/DefaultVascLinkEntry.java | 16 + .../impl/actions/ExportDataGlobalAction.java | 72 + .../entry/config/VascActionsFinalizer.java | 71 + .../config/VascDefaultsFinalizer.java} | 239 +-- .../entry/config/VascHelpIdFinalizer.java | 137 ++ .../impl/entry/config/VascI18nFinalizer.java | 190 ++ .../entry/config/VascIdAutoFinalizer.java | 126 ++ .../entry/config/VascIdCheckFinalizer.java | 124 ++ .../export/JRDynamicDataSourceVascEntry.java | 169 ++ .../export/VascEntryExporterCsv.java} | 45 +- .../entry/export/VascEntryExporterJR4O.java | 128 ++ .../export/VascEntryExporterXml.java} | 66 +- .../export/VascEntryExporterXmlTree.java | 50 + .../impl/ui/VascSelectItemModelEntry.java | 17 +- .../x4o/VascEntryElementConfigurator.java | 11 +- vasc-demo/vasc-demo-tech/pom.xml | 1 + .../vasc-demo-tech-core/.project | 36 + .../vasc-demo-tech-core/pom.xml | 19 + .../tech/core/DemoVascControllerProvider.java | 21 +- .../vasc/demo/tech/core/DemoVascManager.java | 128 ++ .../vasc-demo-tech/vasc-demo-tech-ui/pom.xml | 25 +- .../forwardfire/vasc/demo/tech/ui/TechUI.java | 7 +- ...ager.java => VascAutoSchemaMetaModel.java} | 113 +- .../demo/tech/ui/actions/JDialogMetaCsv.java | 6 +- .../demo/tech/ui/actions/JDialogMetaJdbc.java | 6 +- .../tech/ui/actions/JDialogMetaMongodb.java | 6 +- .../demo/tech/ui/components/JMainPanel.java | 8 +- .../demo/tech/ui/resources/TechUI.properties | 27 +- .../vasc-demo-tech/vasc-demo-tech-web/pom.xml | 6 + .../tech/web/beans/VascFacesController.java | 20 +- .../src/main/webapp/WEB-INF/web.xml | 57 +- vasc-frontend/pom.xml | 2 + vasc-frontend/vasc-frontend-cxf/.project | 17 + vasc-frontend/vasc-frontend-cxf/pom.xml | 17 + .../vasc-frontend-cxf-client/.project | 23 + .../vasc-frontend-cxf-client/pom.xml | 19 + .../frontend/cxf/client/VascEntryService.java | 10 + .../vasc-frontend-cxf-server/.project | 23 + .../vasc-frontend-cxf-server/pom.xml | 51 + .../cxf/server/VascEntryServiceImpl.java | 10 + .../cxf/server/web/VascCXFServlet.java | 89 + .../swing/SwingActionPanel.java | 13 +- .../swing/SwingPagerPanel.java | 2 +- .../swing/SwingPanelFrame.java | 2 +- .../swing/SwingPanelIntegration.java | 2 +- .../swing/SwingPanelTabbed.java | 2 +- .../swing/SwingVascEditDialog.java | 2 +- .../swing/SwingVascFrontend.java | 18 +- .../swing/SwingVascTableModel.java | 2 +- .../swing/ui/SwingBoolean.java | 2 +- .../swing/ui/SwingButton.java | 2 +- .../swing/ui/SwingColorChooser.java | 2 +- .../swing/ui/SwingDate.java | 2 +- .../swing/ui/SwingLabel.java | 2 +- .../swing/ui/SwingList.java | 2 +- .../swing/ui/SwingText.java | 2 +- .../swing/ui/SwingTextArea.java | 2 +- .../java/net/forwardfire/vasc/SwingTest.java | 4 +- .../net/forwardfire/vasc/SwingTestTabbed.java | 4 +- .../swt/SwtActionPanel.java | 8 +- .../swt/SwtPagerPanel.java | 2 +- .../swt/SwtVascEditDialog.java | 2 +- .../swt/SwtVascFrontend.java | 14 +- .../swt/ui/SwtBoolean.java | 2 +- .../swt/ui/SwtButton.java | 2 +- .../swt/ui/SwtLabel.java | 2 +- .../swt/ui/SwtList.java | 2 +- .../swt/ui/SwtText.java | 2 +- .../swt/ui/SwtTextArea.java | 2 +- .../java/net/forwardfire/vasc/SWTTest.java | 2 +- .../vasc-frontend-web-export/.project | 23 + .../vasc-frontend-web-export/pom.xml | 32 + .../web/export/VascExportServlet.java | 163 ++ vasc-frontend/vasc-frontend-web-jsf/pom.xml | 2 - .../AbstractJSFVascFacesControllerBase.java | 2 +- .../AbstractJSFVascFacesControllerEJB.java | 21 +- .../AbstractJSFVascFacesControllerLocal.java | 2 +- .../web/jsf/JSFVascEntryEventListener.java | 2 +- .../web/jsf/JSFVascEntrySupportBean.java | 20 +- .../web/jsf/JSFVascFrontendRenderer.java | 12 +- .../web/jsf/JSFVascUIComponent.java | 19 +- .../web/jsf/JSFVascUIComponentRenderer.java | 2 +- .../web/jsf/JSFVascUIComponentTag.java | 2 +- .../web/jsf/JSFVascValidatePhaseListener.java | 4 +- .../web/jsf/VascDataBackendBean.java | 2 +- .../web/jsf/VascRequestFacesFilter.java | 2 +- .../web/jsf/VascViewHandler.java | 2 +- .../web/jsf/ui/AbstractJSFBaseComponent.java | 4 +- .../web/jsf/ui/JSFBoolean.java | 4 +- .../web/jsf/ui/JSFLabel.java | 2 +- .../web/jsf/ui/JSFList.java | 4 +- .../web/jsf/ui/JSFListModel.java | 2 +- .../web/jsf/ui/JSFText.java | 4 +- .../web/jsf/ui/JSFTextArea.java | 4 +- .../frontends/web/jsf/OldVascUIComponent.java | 1744 ----------------- .../main/resources/META-INF/faces-config.xml | 6 +- .../src/main/resources/META-INF/vasc.tld | 2 +- vasc-lib/pom.xml | 1 + vasc-lib/vasc-lib-jr4o/.project | 23 + vasc-lib/vasc-lib-jr4o/pom.xml | 24 + .../vasc/lib/jr4o/JR4ODesignManager.java | 202 ++ .../forwardfire/vasc/lib/jr4o/JR4OParser.java | 105 + .../data/AbstractJRDynamicDataSource.java | 69 + .../lib/jr4o/data/JRDynamicDataSource.java | 53 + .../data/JRDynamicDataSourceTableModel.java | 148 ++ .../vasc/lib/jr4o/x4o/ColorConverter.java | 64 + .../vasc/lib/jr4o/x4o/ImageElement.java | 57 + .../jr4o/x4o/JR4OElementBindingHandler.java | 70 + .../x4o/JR4OElementGroupBindingHandler.java | 66 + .../x4o/JR4OJasperDesignBindingHandler.java | 74 + .../lib/jr4o/x4o/JRDynamicCardsElement.java | 133 ++ .../lib/jr4o/x4o/JRDynamicColumnElement.java | 92 + .../x4o/JRDynamicColumnHeaderElement.java | 91 + .../lib/jr4o/x4o/JRExpressionConverter.java | 84 + .../x4o/JasperDesignPageBinderElement.java | 78 + .../lib/jr4o/x4o/JasperReportElement.java | 53 + .../x4o/ValueBodyImageExpressionElement.java | 65 + .../x4o/ValueBodyPrintExpressionElement.java | 59 + .../lib/jr4o/x4o/ValueBodyTextElement.java | 52 + .../x4o/ValueBodyTextExpressionElement.java | 59 + .../resources/META-INF/jr4o/jr4o-lang.eld | 187 ++ .../META-INF/jr4o/jr4o-namespaces.xml | 7 + .../vasc/lib/jr4o/reports/dynamic-reports.xml | 100 + .../test/frontend/data/TestModelData.java | 42 +- .../data/TestModelVascDataSource.java | 10 +- 160 files changed, 5001 insertions(+), 2552 deletions(-) create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/core/VascControllerProvider.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java rename vasc-core/src/main/java/net/forwardfire/vasc/core/{VascEntryFinalizer.java => VascEntryConfigFinalizer.java} (88%) create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/ExportDataGlobalAction.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascActionsFinalizer.java rename vasc-core/src/main/java/net/forwardfire/vasc/impl/{DefaultVascBackedEntryFinalizer.java => entry/config/VascDefaultsFinalizer.java} (52%) create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascHelpIdFinalizer.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascI18nFinalizer.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascIdAutoFinalizer.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascIdCheckFinalizer.java create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/JRDynamicDataSourceVascEntry.java rename vasc-core/src/main/java/net/forwardfire/vasc/impl/{actions/CSVExportGlobalAction.java => entry/export/VascEntryExporterCsv.java} (77%) create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterJR4O.java rename vasc-core/src/main/java/net/forwardfire/vasc/impl/{actions/XMLExportGlobalAction.java => entry/export/VascEntryExporterXml.java} (67%) create mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXmlTree.java create mode 100644 vasc-demo/vasc-demo-tech/vasc-demo-tech-core/.project create mode 100644 vasc-demo/vasc-demo-tech/vasc-demo-tech-core/pom.xml rename vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendEntryFinalizer.java => vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascControllerProvider.java (73%) create mode 100644 vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascManager.java rename vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/{VascManager.java => VascAutoSchemaMetaModel.java} (71%) create mode 100644 vasc-frontend/vasc-frontend-cxf/.project create mode 100644 vasc-frontend/vasc-frontend-cxf/pom.xml create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/.project create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/pom.xml create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/src/main/java/net/forwardfire/vasc/frontend/cxf/client/VascEntryService.java create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/.project create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/pom.xml create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/VascEntryServiceImpl.java create mode 100644 vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/web/VascCXFServlet.java rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingActionPanel.java (96%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingPagerPanel.java (99%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingPanelFrame.java (99%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingPanelIntegration.java (91%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingPanelTabbed.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingVascEditDialog.java (99%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingVascFrontend.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/SwingVascTableModel.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingBoolean.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingButton.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingColorChooser.java (99%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingDate.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingLabel.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingList.java (99%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingText.java (98%) rename vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swing/ui/SwingTextArea.java (99%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/SwtActionPanel.java (97%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/SwtPagerPanel.java (98%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/SwtVascEditDialog.java (99%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/SwtVascFrontend.java (98%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/ui/SwtBoolean.java (98%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/ui/SwtButton.java (98%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/ui/SwtLabel.java (98%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/ui/SwtList.java (99%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/ui/SwtText.java (98%) rename vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/{frontends => frontend}/swt/ui/SwtTextArea.java (99%) create mode 100644 vasc-frontend/vasc-frontend-web-export/.project create mode 100644 vasc-frontend/vasc-frontend-web-export/pom.xml create mode 100644 vasc-frontend/vasc-frontend-web-export/src/main/java/net/forwardfire/vasc/frontend/web/export/VascExportServlet.java rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/AbstractJSFVascFacesControllerBase.java (98%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/AbstractJSFVascFacesControllerEJB.java (95%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/AbstractJSFVascFacesControllerLocal.java (99%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascEntryEventListener.java (98%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascEntrySupportBean.java (98%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascFrontendRenderer.java (94%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascUIComponent.java (97%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascUIComponentRenderer.java (99%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascUIComponentTag.java (99%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/JSFVascValidatePhaseListener.java (96%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/VascDataBackendBean.java (99%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/VascRequestFacesFilter.java (99%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/VascViewHandler.java (98%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/AbstractJSFBaseComponent.java (95%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/JSFBoolean.java (96%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/JSFLabel.java (98%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/JSFList.java (98%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/JSFListModel.java (99%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/JSFText.java (97%) rename vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/{frontends => frontend}/web/jsf/ui/JSFTextArea.java (96%) delete mode 100644 vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/OldVascUIComponent.java create mode 100644 vasc-lib/vasc-lib-jr4o/.project create mode 100644 vasc-lib/vasc-lib-jr4o/pom.xml create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4ODesignManager.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4OParser.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/AbstractJRDynamicDataSource.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSource.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSourceTableModel.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ColorConverter.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ImageElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementBindingHandler.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementGroupBindingHandler.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OJasperDesignBindingHandler.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRDynamicCardsElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRDynamicColumnElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRDynamicColumnHeaderElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRExpressionConverter.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JasperDesignPageBinderElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JasperReportElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyImageExpressionElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyPrintExpressionElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextExpressionElement.java create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-lang.eld create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-namespaces.xml create mode 100644 vasc-lib/vasc-lib-jr4o/src/main/resources/net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml diff --git a/todo.txt b/todo.txt index 1751146..a525125 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,16 @@ == TODO == +- demo user +- demo user_groups +- user log +- demo vasc_settings +- demo vasc_audit_log +- demo menu +- demo wiki + + +- encodeing select model +- lcoale select model - x4o template - swing readonly field editor - order by list and edit. diff --git a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java index f142972..3acc783 100644 --- a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java +++ b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java @@ -101,7 +101,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { } i++; } - if (isPageable()) { + if (isPageable() && state.getPageSize()>0) { q.setFirstResult(state.getPageIndex()); q.setMaxResults(state.getPageSize()); } diff --git a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java index 180e4ce..85ccfde 100644 --- a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java +++ b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java @@ -101,7 +101,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend //System.out.println("Set para index: "+i+" value: "+valueObject+" valueClass: "+valueObject.getClass()+" valueType: "+value.getValueType()); i++; } - if (isPageable()) { + if (isPageable() && state.getPageSize()>0) { q.setFirstResult(state.getPageIndex()); q.setMaxResults(state.getPageSize()); } diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java index 140645c..8c693d1 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java +++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java @@ -158,7 +158,7 @@ public class MetaModelVascBackend extends AbstractVascBackend { Schema schema = dataContext.getDefaultSchema(); Table t = schema.getTableByName(table); Query q = createFilterQuery(state,t,false); - if (isPageable()) { + if (isPageable() && state.getPageSize()>0) { q.setFirstRow(state.getPageIndex()); q.setMaxRows(state.getPageSize()); } diff --git a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java index f26200a..88d8b87 100644 --- a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java +++ b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java @@ -93,7 +93,7 @@ public class MongodbVascBackend extends AbstractVascBackend { DBCollection coll = getDBCollection(); DBObject query = createFilterQuery(state); DBCursor cur = coll.find(query); - if (isPageable()) { + if (isPageable() && state.getPageSize()>0) { cur.limit(state.getPageSize()); cur.skip(state.getPageIndex()); } diff --git a/vasc-core/pom.xml b/vasc-core/pom.xml index 27888b7..05e4dc9 100644 --- a/vasc-core/pom.xml +++ b/vasc-core/pom.xml @@ -21,6 +21,11 @@ vasc-xpql ${project.version} + + net.forwardfire.vasc.lib + vasc-lib-jr4o + ${project.version} + javax.persistence persistence-api diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java index 6ddeab9..aa38bf9 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java @@ -22,7 +22,6 @@ package net.forwardfire.vasc.backend.data; - import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.entry.VascEntryFieldValue; @@ -30,6 +29,7 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import org.x4o.xml.impl.DefaultElementObjectPropertyValue; /** + * BeanVascEntryFieldValue provides get/set support for bean based backends. * * @author Willem Cazander * @version 1.0 Dec 05, 2009 diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java index ad647c5..09aef19 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java @@ -25,11 +25,11 @@ package net.forwardfire.vasc.backend.data; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; - - /** - * @author willemc - * + * BeanVascEntryRecordCreator creates a new backend record based on class object. + * + * @author Willem Cazander + * @version 1.0 Dec 05, 2009 */ public class BeanVascEntryRecordCreator implements VascEntryRecordCreator { diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java index fbd5b0e..f737126 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java @@ -28,11 +28,11 @@ import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.entry.VascEntryFieldValue; - - /** - * @author willemc - * + * MapVascEntryFieldValue provides get/set support on Map record object. + * + * @author Willem Cazander + * @version 1.0 Dec 05, 2009 */ public class MapVascEntryFieldValue implements VascEntryFieldValue { diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java index 69fd620..91dfa2d 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java @@ -28,11 +28,11 @@ import java.util.Map; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; - - /** - * @author willemc - * + * MapVascEntryRecordCreator creates a new HashMap for Map based record backends. + * + * @author Willem Cazander + * @version 1.0 Dec 05, 2009 */ public class MapVascEntryRecordCreator implements VascEntryRecordCreator { diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java index 6a08a3a..1589381 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java @@ -35,22 +35,39 @@ import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; /** - * AbstractVascBackendProxy to implement missing features of the backend. + * VascBackendProxy to implement missing features of the backend. * * @author Willem Cazander * @version 1.0 Apr 1, 2009 */ -abstract public class AbstractVascBackendProxy implements VascBackend { +abstract public class AbstractVascBackendProxy implements VascBackendProxy { protected VascBackend backend = null; + protected VascEntry entry = null; - public AbstractVascBackendProxy(VascBackend backend) { + abstract public VascBackendProxy clone() throws CloneNotSupportedException; + + /** + * @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#initProxy(net.forwardfire.vasc.backend.VascBackend, net.forwardfire.vasc.core.VascEntry) + */ + public void initProxy(VascBackend backend, VascEntry entry) { if (backend==null) { - throw new NullPointerException("backend object mey not be null."); + throw new NullPointerException("backend object may not be null."); + } + if (entry==null) { + throw new NullPointerException("entry object may not be null."); } this.backend=backend; + this.entry=entry; } - + + /** + * @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#isProxyNeeded() + */ + public boolean isProxyNeeded() { + return true; + } + /** * @see net.forwardfire.vasc.backend.VascBackend#isReadOnly() */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java new file mode 100644 index 0000000..bdb10aa --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java @@ -0,0 +1,41 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.backend.proxy; + +import net.forwardfire.vasc.backend.VascBackend; +import net.forwardfire.vasc.core.VascEntry; + +/** + * VascBackendProxy interface to make proxies configable. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public interface VascBackendProxy extends VascBackend,Cloneable { + + public void initProxy(VascBackend backend,VascEntry entry); + + public boolean isProxyNeeded(); + + public VascBackendProxy clone() throws CloneNotSupportedException; +} diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java index d5edb4a..78ed2c6 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java @@ -26,9 +26,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; /** @@ -41,14 +39,27 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { private Long records = null; private List data = null; - private String dataSearchString = null; + private String searchString = null; private Map dataState = null; + private int pageIndex = 0; + private int pageSize = 0; + private int pageSizeMax = 0; + private String sortField = null; + private boolean sortDir = true; - public VascBackendProxyCache(VascBackend backend,VascEntry entry) { - super(backend); + public VascBackendProxyCache() { dataState = new HashMap(10); } + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxyCache result = new VascBackendProxyCache(); + return result; + } + private boolean isStateChanged(VascBackendState state) { boolean changed = false; for (String key:state.getDataParameterKeys()) { @@ -68,10 +79,32 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { } } - if (state.getSearchString()!=null && state.getSearchString().equals(dataSearchString)==false) { + if (state.getSortField()!=null && state.getSortField().equals(sortField)==false) { changed = true; } - dataSearchString = state.getSearchString(); + sortField = state.getSortField(); + if (state.isSortAscending()==sortDir) { + changed = true; + } + sortDir = state.isSortAscending(); + + if (state.getPageSizeMax()==pageSizeMax) { + changed = true; + } + pageSizeMax = state.getPageSizeMax(); + if (state.getPageSize()==pageSize) { + changed = true; + } + pageSize = state.getPageSize(); + if (state.getPageIndex()==pageIndex) { + changed = true; + } + pageIndex = state.getPageIndex(); + + if (state.getSearchString()!=null && state.getSearchString().equals(searchString)==false) { + changed = true; + } + searchString = state.getSearchString(); return changed; } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java index a55843d..6146197 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java @@ -32,9 +32,6 @@ import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener; import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener.VascBackendEventType; - - - /** * Holds !! and fires the backend event listeners. * @@ -44,10 +41,18 @@ import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener.VascBackend public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { private List listeners = null; - private VascEntry entry = null; - public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry) { - super(backend); + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxyEventExecutor result = new VascBackendProxyEventExecutor(); + return result; + } + + public void initProxy(VascBackend backend,VascEntry entry) { + super.initProxy(backend, entry); this.entry=entry; this.listeners=new ArrayList(10); ClassLoader cl = Thread.currentThread().getContextClassLoader(); @@ -64,13 +69,19 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { listeners.add(listener); } } - - public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry,List listeners) { - super(backend); - this.entry=entry; - this.listeners=listeners; - } + public void addVascEntryBackendEventListener(VascEntryBackendEventListener listener) { + listeners.add(listener); + } + + public void removeVascEntryBackendEventListener(VascEntryBackendEventListener listener) { + listeners.remove(listener); + } + + public List getVascEntryBackendEventListeners() { + return listeners; + } + private void fireVascEvent(VascBackendEventType type, Object data) { for (int i=0;i filters = null; - public VascBackendProxyFilter(VascBackend backend,VascEntry entry,VascBackendFilter filter) { - super(backend); - this.filter=filter; + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxyFilter result = new VascBackendProxyFilter(); + return result; + } + + /** + * @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#initProxy(net.forwardfire.vasc.backend.VascBackend, net.forwardfire.vasc.core.VascEntry) + */ + public void initProxy(VascBackend backend, VascEntry entry) { + super.initProxy(backend,entry); + filters = entry.getVascBackendFilters(); + for (VascBackendFilter filter:filters) { + filter.initFilter(entry); + } + } + + /** + * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded() + */ + @Override + public boolean isProxyNeeded() { + if (entry.getVascBackendFilters().isEmpty()) { + return false; + } + return true; } /** @@ -55,14 +81,19 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy { @Override public List execute(VascBackendState state) throws VascException { List result = backend.execute(state); - if (filter==null) { + if (filters==null) { + return result; + } + if (filters.isEmpty()) { return result; } List search = new ArrayList(result.size()/2); for (Object o:result) { - Object r = filter.filterObject(o); - if (r!=null) { - search.add(r); + for (VascBackendFilter filter:filters) { + Object r = filter.filterObject(o); + if (r!=null) { + search.add(r); + } } } records = search.size(); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java index a93aef7..0fabb1b 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java @@ -25,13 +25,9 @@ package net.forwardfire.vasc.backend.proxy; import java.util.ArrayList; import java.util.List; -import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; - - /** * Simulates a real pages backend. * @@ -42,10 +38,26 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy { private long records = 0; - public VascBackendProxyPaged(VascBackend backend,VascEntry entry) { - super(backend); + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxyPaged result = new VascBackendProxyPaged(); + return result; } + /** + * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded() + */ + @Override + public boolean isProxyNeeded() { + if (backend.isPageable()) { + return false; + } + return true; + } + /** * @see net.forwardfire.vasc.backend.VascBackend#isPageable() */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java index bcdab67..7cb3b99 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java @@ -25,9 +25,7 @@ package net.forwardfire.vasc.backend.proxy; import java.util.ArrayList; import java.util.List; -import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.entry.VascEntryFieldValue; @@ -41,13 +39,27 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue; public class VascBackendProxySearch extends AbstractVascBackendProxy { private long records = 0; - private VascEntry entry = null; - public VascBackendProxySearch(VascBackend backend,VascEntry entry) { - super(backend); - this.entry=entry; + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxySearch result = new VascBackendProxySearch(); + return result; } - + + /** + * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded() + */ + @Override + public boolean isProxyNeeded() { + if (backend.isSearchable()) { + return false; + } + return true; + } + /** * @see net.forwardfire.vasc.backend.VascBackend#isSearchable() */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java index 99913d6..f4ecf82 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java @@ -26,9 +26,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.entry.VascEntryFieldValue; @@ -40,15 +38,26 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue; * @version 1.0 Oct 27, 2007 */ public class VascBackendProxySort extends AbstractVascBackendProxy { - - private VascEntry entry = null; - public VascBackendProxySort(VascBackend backend,VascEntry entry) { - super(backend); - this.entry=entry; + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxySort result = new VascBackendProxySort(); + return result; } - // sort stuff + /** + * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#isProxyNeeded() + */ + @Override + public boolean isProxyNeeded() { + if (backend.isSortable()) { + return false; + } + return true; + } /** * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java index 2c2232a..4b60c85 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java @@ -26,14 +26,11 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; -import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; - /** -* Does simple caching for the data. +* Does simple timer logging for the backend actions. * * @author Willem Cazander * @version 1.0 Nov 19, 2009 @@ -43,11 +40,20 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { protected Logger logger = null; protected Level logLevel = Level.INFO; - public VascBackendProxyTimerLogger(VascBackend backend,VascEntry entry) { - super(backend); + public VascBackendProxyTimerLogger() { logger = Logger.getLogger(VascBackendProxyTimerLogger.class.getName()); } + /** + * @see java.lang.Object#clone() + */ + @Override + public VascBackendProxy clone() throws CloneNotSupportedException { + VascBackendProxyTimerLogger result = new VascBackendProxyTimerLogger(); + result.logLevel=logLevel; + return result; + } + /** * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascController.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascController.java index cf0ed59..20e9e22 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascController.java @@ -34,6 +34,11 @@ import net.forwardfire.vasc.backend.VascBackendController; */ public interface VascController { + /** + * @return Returns the VascConfigController + */ + public VascEntryConfigController getVascEntryConfigController(); + /** * @return Returns the VascBackendController */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascControllerProvider.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascControllerProvider.java new file mode 100644 index 0000000..1a0e0cc --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascControllerProvider.java @@ -0,0 +1,37 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.core; + +/** + * Interface to get an VascController from somewhere. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public interface VascControllerProvider { + + /** + * @return Returns the VascController + */ + public VascController getVascController(); +} \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java index 277165f..f903712 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java @@ -304,6 +304,26 @@ public interface VascEntry extends Cloneable,Serializable { */ public void removeGlobalAction(GlobalVascAction globalAction); + /** + * @return the exportActions + */ + public List getExportActions(); + + /** + * @return the GlobalVascAction exportAction + */ + public GlobalVascAction getExportActionById(String actionId); + + /** + * @param exportAction the exportAction to add + */ + public void addExportAction(GlobalVascAction exportAction); + + /** + * @param exportAction the exportAction to remove + */ + public void removeExportAction(GlobalVascAction exportAction); + /** * @return the vascEntryFieldSets */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java new file mode 100644 index 0000000..3999e2e --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java @@ -0,0 +1,93 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.core; + +import java.util.List; +import java.util.Locale; + +import net.forwardfire.vasc.backend.VascBackend; +import net.forwardfire.vasc.backend.proxy.VascBackendProxy; +import net.forwardfire.vasc.core.entry.VascEntryExporter; +import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService; + +/** + * Interface to make default fill/etc config plugable. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public interface VascEntryConfigController { + + public VascEntry configVascEntry(VascController vascController,String entryId) throws VascException; + + public void configVascEntry(VascController vascController,VascEntry vascEntry) throws VascException; + + + public void addVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer); + + public void removeVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer); + + public List getVascEntryConfigFinalizers(); + + + public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException; + + public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry,VascBackend realBackend) throws VascException; + + public void addVascBackendProxy(VascBackendProxy proxy); + + public void removeVascBackendProxy(VascBackendProxy proxy); + + public List getVascBackendProxies(); + + + public VascEntryExporter getVascEntryExporterById(String exporterId); + + public void addVascEntryExporter(VascEntryExporter exporter); + + public void removeVascEntryExporter(VascEntryExporter exporter); + + public List getVascEntryExporters(); + + + public void configVascFrontendData(VascController vascController,VascEntry entry,Locale locale) throws VascException; + + public String getResourceBundle(); + + public void setResourceBundle(String resourceBundle); + + public int getDefaultPageSizeMax(); + + public void setDefaultPageSizeMax(int max); + + public int getDefaultPageSize(); + + public void setDefaultPageSize(int size); + + public void addVascEntryFieldValidatorService(VascEntryFieldValidatorService validator); + + public void removeVascEntryFieldValidatorService(VascEntryFieldValidatorService validator); + + public List getVascEntryFieldValidatorServices(); + +} \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFinalizer.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigFinalizer.java similarity index 88% rename from vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFinalizer.java rename to vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigFinalizer.java index 0788399..b91af16 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFinalizer.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigFinalizer.java @@ -22,13 +22,13 @@ package net.forwardfire.vasc.core; - /** + * Finalizes the VascEntry so it is ready to use. * * @author Willem Cazander * @version 1.0 Sep 9, 2008 */ -public interface VascEntryFinalizer { +public interface VascEntryConfigFinalizer { - public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException; + public void configVascEntry(VascController vascController,VascEntry entry) throws VascException; } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryController.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryController.java index 1bc86fa..7216686 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryController.java @@ -35,6 +35,4 @@ public interface VascEntryController { public VascEntry getVascEntryById(String id); public List getVascEntryIds(); - - public List getVascEntryAdminIds(); } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryControllerLocal.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryControllerLocal.java index d1c9374..4772a3a 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryControllerLocal.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryControllerLocal.java @@ -32,7 +32,9 @@ package net.forwardfire.vasc.core; */ public interface VascEntryControllerLocal extends VascEntryController { - public void addVascEntry(VascEntry entry,VascController vascController) throws VascException; + public void addVascEntry(VascEntry entry); - public VascEntry getMasterVascEntryById(String id); + public void removeVascEntry(String entryId); + + public VascEntry getMasterVascEntryById(String entryId); } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascLinkEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascLinkEntry.java index 020d207..031abf9 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascLinkEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascLinkEntry.java @@ -27,17 +27,13 @@ import java.util.List; /** + * VascLinkEntry * * @author Willem Cazander * @version 1.0 Sep 7, 2008 */ public interface VascLinkEntry extends Cloneable,Serializable { - public String getId(); - public void setId(String id); - - public String getVascEntryId(); - public void setVascEntryId(String vascEntryId); public String getEntryParameterFieldId(String parameterName); public void addEntryParameterFieldId(String parameterName,String valueFieldId); @@ -47,6 +43,26 @@ public interface VascLinkEntry extends Cloneable,Serializable { public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId); public List getEntryCreateFieldValueKeys(); + /** + * @return the id + */ + public String getId(); + + /** + * @param id the id to set + */ + public void setId(String id); + + /** + * @return the vascEntryId + */ + public String getVascEntryId(); + + /** + * @param vascEntryId the vascEntryId to set + */ + public void setVascEntryId(String vascEntryId); + /** * @return the vascLinkEntryType */ @@ -77,6 +93,16 @@ public interface VascLinkEntry extends Cloneable,Serializable { */ public void setName(String name); + /** + * @return the helpId + */ + public String getHelpId(); + + /** + * @param helpId the helpId to set + */ + public void setHelpId(String helpId); + /** * Force impl to have public clone methode * @return diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryExporter.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryExporter.java index 69f8f2e..53ff540 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryExporter.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryExporter.java @@ -37,10 +37,12 @@ import net.forwardfire.vasc.core.VascException; */ public interface VascEntryExporter extends Serializable { + public String getId(); + public void doExport(OutputStream out,VascEntry vascEntry) throws VascException; public String getMineType(); - public String getType(); + public String getFileType(); } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValidatorService.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValidatorService.java index f91e5b7..b31cb9b 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValidatorService.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValidatorService.java @@ -37,5 +37,14 @@ import net.forwardfire.vasc.core.VascException; */ public interface VascEntryFieldValidatorService { + /** + * Validated a field and returns zero or more error messsages. + * + * @param field + * @param selectedRecord + * @param objectValue + * @return + * @throws VascException + */ public List validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException; } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascController.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascController.java index cd26a07..006d229 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascController.java @@ -23,6 +23,7 @@ package net.forwardfire.vasc.impl; import net.forwardfire.vasc.backend.VascBackendController; +import net.forwardfire.vasc.core.VascEntryConfigController; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntryController; import net.forwardfire.vasc.core.VascEntryFieldTypeController; @@ -37,12 +38,27 @@ import net.forwardfire.vasc.core.VascUserRoleController; */ public class DefaultVascController implements VascController { + private VascEntryConfigController vascEntryConfigController = null; private VascBackendController vascBackendController = null; private VascEntryController vascEntryController = null; private VascEntryFieldTypeController vascEntryFieldTypeController = null; private VascEventChannelController vascEventChannelController = null; private VascUserRoleController vascUserRoleController = null; + /** + * @return the vascEntryConfigController + */ + public VascEntryConfigController getVascEntryConfigController() { + return vascEntryConfigController; + } + + /** + * @param vascEntryConfigController the vascEntryConfigController to set + */ + public void setVascEntryConfigController(VascEntryConfigController vascEntryConfigController) { + this.vascEntryConfigController = vascEntryConfigController; + } + /** * @return the vascEventChannelController */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntry.java index 544e7ca..fe8e9ee 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntry.java @@ -78,6 +78,7 @@ public class DefaultVascEntry implements VascEntry { private List rowActions = null; private List columnActions = null; private List globalActions = null; + private List exportActions = null; private List vascEntryFieldSets = null; private List vascLinkEntries = null; @@ -99,8 +100,9 @@ public class DefaultVascEntry implements VascEntry { vascFields = new ArrayList(20); rowActions = new ArrayList(10); - columnActions = new ArrayList(10); - globalActions = new ArrayList(10); + columnActions = new ArrayList(5); + globalActions = new ArrayList(5); + exportActions = new ArrayList(10); vascEntryFieldSets = new ArrayList(10); vascLinkEntries = new ArrayList(10); @@ -160,6 +162,9 @@ public class DefaultVascEntry implements VascEntry { for (VascAction a:globalActions) { result.globalActions.add((GlobalVascAction)a.clone()); } + for (VascAction a:exportActions) { + result.exportActions.add((GlobalVascAction)a.clone()); + } for (VascEntryFieldSet s:vascEntryFieldSets) { result.vascEntryFieldSets.add(s.clone()); } @@ -572,6 +577,39 @@ public class DefaultVascEntry implements VascEntry { globalActions.remove(globalAction); } + /** + * @return the exportActions + */ + public List getExportActions() { + return exportActions; + } + + /** + * @return the GlobalVascAction exportAction + */ + public GlobalVascAction getExportActionById(String actionId) { + for (GlobalVascAction a:exportActions) { + if (a.getId().equals(actionId)) { + return a; + } + } + return null; + } + + /** + * @param exportAction the exportAction to add + */ + public void addExportAction(GlobalVascAction exportAction) { + exportActions.add(exportAction); + } + + /** + * @param exportAction the exportAction to remove + */ + public void removeExportAction(GlobalVascAction exportAction) { + exportActions.remove(exportAction); + } + /** * @return the vascEntryFieldSets */ diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java new file mode 100644 index 0000000..b9aed72 --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java @@ -0,0 +1,289 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; + +import net.forwardfire.vasc.backend.VascBackend; +import net.forwardfire.vasc.backend.proxy.VascBackendProxy; +import net.forwardfire.vasc.core.VascController; +import net.forwardfire.vasc.core.VascEntry; +import net.forwardfire.vasc.core.VascEntryConfigController; +import net.forwardfire.vasc.core.VascEntryConfigFinalizer; +import net.forwardfire.vasc.core.VascEntryField; +import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.core.entry.VascEntryExporter; +import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService; +import net.forwardfire.vasc.core.entry.VascEntryFieldValue; +import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver; + +/** + * DefaultVascEntryConfigController runs all VascEntryConfigFinalizers on VascEntry. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public class DefaultVascEntryConfigController implements VascEntryConfigController { + + private List configFinalizers = null; + private List backendProxies = null; + private Map dataExporters = null; + private List fieldValidators = null; + private int defaultPageSize = 100; + private int defaultPageSizeMax = 1000; + private String resourceBundle = null; + + public DefaultVascEntryConfigController() { + configFinalizers = new ArrayList(10); + backendProxies = new ArrayList(10); + dataExporters = new HashMap(10); + fieldValidators = new ArrayList(5); + } + + public VascEntry configVascEntry(VascController vascController,String entryId) throws VascException { + VascEntry vascEntry = vascController.getVascEntryController().getVascEntryById(entryId); + configVascEntry(vascController,vascEntry); + return vascEntry; + } + + public void configVascEntry(VascController vascController,VascEntry vascEntry) throws VascException { + for (VascEntryConfigFinalizer finalizer:configFinalizers) { + finalizer.configVascEntry(vascController,vascEntry); + } + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#configVascBackendProxied(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry) + */ + public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException { + VascBackend realBackend = vascController.getVascBackendController().getVascBackendById(vascEntry.getBackendId()); + return configVascBackendProxied(vascController,vascEntry,realBackend); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#configVascBackendProxied(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry, net.forwardfire.vasc.backend.VascBackend) + */ + public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry, VascBackend realBackend) throws VascException { + VascBackend backend = realBackend; + for (VascBackendProxy proxy:backendProxies) { + VascBackendProxy proxyClone; + try { + proxyClone = proxy.clone(); + } catch (CloneNotSupportedException e) { + throw new VascException(e); + } + proxyClone.initProxy(backend, vascEntry); + if (proxyClone.isProxyNeeded()==false) { + continue; + } + backend = proxyClone; + } + return backend; + } + + + + /** + * @throws VascException + * @see net.forwardfire.vasc.core.VascEntryConfigController#configVascFrontendData(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry, java.util.Locale) + */ + public void configVascFrontendData(VascController vascController,VascEntry entry, Locale locale) throws VascException { + + + DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); + DefaultVascEntryState state = new DefaultVascEntryState(); + DefaultVascBackendState backendState = new DefaultVascBackendState(); + + backendState.setPageSize(vascController.getVascEntryConfigController().getDefaultPageSize()); + backendState.setPageSizeMax(vascController.getVascEntryConfigController().getDefaultPageSizeMax()); + + state.setVascBackendState(backendState); + vascFrontendData.setVascEntryState(state); + + // init resource resultsers + vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(ResourceBundle.getBundle(vascController.getVascEntryConfigController().getResourceBundle(), locale))); + vascFrontendData.setVascFrontendHelper(new DefaultVascFrontendHelper()); + //vascFrontendData.setVascEntryResourceImageResolver(new ImageResources()); + + for(VascEntryFieldValidatorService validator:vascController.getVascEntryConfigController().getVascEntryFieldValidatorServices()) { + vascFrontendData.addVascValidatorService(validator); + } + + + vascFrontendData.setVascController(vascController); + entry.setVascFrontendData(vascFrontendData); + VascBackend backend = vascController.getVascEntryConfigController().configVascBackendProxied(vascController, entry); + vascFrontendData.getVascEntryState().setVascBackend(backend); + vascFrontendData.getVascEntryState().setVascEntry(entry); + + for (VascEntryField field:entry.getVascEntryFields()) { + if (field.getVascEntryFieldValue()==null) { + VascEntryFieldValue v = backend.provideVascEntryFieldValue(field); + field.setVascEntryFieldValue(v); + } + } + + vascFrontendData.setVascFrontendPager(new DefaultVascFrontendPager(entry)); + vascFrontendData.setVascFrontendActions(new DefaultVascFrontendActions(entry)); + } + + + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryConfigFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer) + */ + public void addVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer) { + configFinalizers.add(vascEntryConfigFinalizer); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryConfigFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer) + */ + public void removeVascEntryConfigFinalizer(VascEntryConfigFinalizer vascEntryConfigFinalizer) { + configFinalizers.remove(vascEntryConfigFinalizer); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryConfigFinalizers() + */ + public List getVascEntryConfigFinalizers() { + return configFinalizers; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#addVascBackendProxy(net.forwardfire.vasc.backend.proxy.VascBackendProxy) + */ + public void addVascBackendProxy(VascBackendProxy proxy) { + backendProxies.add(proxy); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascBackendProxy(net.forwardfire.vasc.backend.proxy.VascBackendProxy) + */ + public void removeVascBackendProxy(VascBackendProxy proxy) { + backendProxies.remove(proxy); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getVascBackendProxies() + */ + public List getVascBackendProxies() { + return backendProxies; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryExporterById(java.lang.String) + */ + public VascEntryExporter getVascEntryExporterById(String exporterId) { + return dataExporters.get(exporterId); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExporter) + */ + public void addVascEntryExporter(VascEntryExporter exporter) { + dataExporters.put(exporter.getId(),exporter); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExporter) + */ + public void removeVascEntryExporter(VascEntryExporter exporter) { + dataExporters.remove(exporter.getId()); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryExporters() + */ + public List getVascEntryExporters() { + return new ArrayList(dataExporters.values()); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getResourceBundle() + */ + public String getResourceBundle() { + return resourceBundle; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#setResourceBundle(java.lang.String) + */ + public void setResourceBundle(String resourceBundle) { + this.resourceBundle=resourceBundle; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getDefaultPageSizeMax() + */ + public int getDefaultPageSizeMax() { + return defaultPageSizeMax; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#setDefaultPageSizeMax(int) + */ + public void setDefaultPageSizeMax(int defaultPageSizeMax) { + this.defaultPageSizeMax=defaultPageSizeMax; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getDefaultPageSize() + */ + public int getDefaultPageSize() { + return defaultPageSize; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#setDefaultPageSize(int) + */ + public void setDefaultPageSize(int defaultPageSize) { + this.defaultPageSize=defaultPageSize; + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryFieldValidatorService(net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService) + */ + public void addVascEntryFieldValidatorService(VascEntryFieldValidatorService validator) { + fieldValidators.add(validator); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryFieldValidatorService(net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService) + */ + public void removeVascEntryFieldValidatorService(VascEntryFieldValidatorService validator) { + fieldValidators.remove(validator); + } + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryFieldValidatorServices() + */ + public List getVascEntryFieldValidatorServices() { + return fieldValidators; + } +} \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryController.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryController.java index f39055e..ccf59d9 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryController.java @@ -28,14 +28,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryControllerLocal; -import net.forwardfire.vasc.core.VascException; - /** - * + * DefaultVascEntryController holds the VascEntries which we can work with. * * @author Willem Cazander * @version 1.0 Sep 18, 2008 @@ -47,13 +44,27 @@ public class DefaultVascEntryController implements VascEntryControllerLocal { public DefaultVascEntryController() { entries = new HashMap(); } - - public void addVascEntry(VascEntry entry,VascController vascController) throws VascException { - DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer(); - entry = f.finalizeVascEntry(entry,vascController); + + /** + * @see net.forwardfire.vasc.core.VascEntryControllerLocal#addVascEntry(net.forwardfire.vasc.core.VascEntry) + */ + public void addVascEntry(VascEntry entry) { + if (entry==null) { + throw new NullPointerException("Can't add null VascEntry."); + } + if (entry.getId()==null) { + throw new NullPointerException("Can't add VascEntry with null Id."); + } entries.put(entry.getId(), entry); } + /** + * @see net.forwardfire.vasc.core.VascEntryControllerLocal#removeVascEntry(java.lang.String) + */ + public void removeVascEntry(String entryId) { + entries.remove(entryId); + } + /** * @see net.forwardfire.vasc.core.VascEntryController#getVascEntryById(java.lang.String) */ @@ -69,9 +80,11 @@ public class DefaultVascEntryController implements VascEntryControllerLocal { } } - - public VascEntry getMasterVascEntryById(String id) { - VascEntry entry = entries.get(id); + /** + * @see net.forwardfire.vasc.core.VascEntryControllerLocal#getMasterVascEntryById(java.lang.String) + */ + public VascEntry getMasterVascEntryById(String entryId) { + VascEntry entry = entries.get(entryId); return entry; } @@ -83,18 +96,4 @@ public class DefaultVascEntryController implements VascEntryControllerLocal { Collections.sort(result); // lets do abc for consistance behauvior. return result; } - - /** - * Retuns only the adminList table entries - */ - public List getVascEntryAdminIds() { - List adminIds = new ArrayList(30); - for (VascEntry e:entries.values()) { - if (Boolean.TRUE.equals(e.isVascAdminList())) { - adminIds.add(e.getId()); - } - } - Collections.sort(adminIds); // lets do abc for consistance behauvior. - return adminIds; - } } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java index 2d3c93f..5942c60 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java @@ -26,7 +26,6 @@ import java.util.Locale; import java.util.ResourceBundle; import net.forwardfire.vasc.backend.VascBackend; -import net.forwardfire.vasc.backend.VascBackendFilter; import net.forwardfire.vasc.backend.proxy.VascBackendProxyCache; import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor; import net.forwardfire.vasc.backend.proxy.VascBackendProxyFilter; @@ -41,14 +40,17 @@ import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.impl.actions.AddRowAction; -import net.forwardfire.vasc.impl.actions.CSVExportGlobalAction; -import net.forwardfire.vasc.impl.actions.DeleteRowAction; -import net.forwardfire.vasc.impl.actions.EditRowAction; -import net.forwardfire.vasc.impl.actions.RefreshDataGlobalAction; -import net.forwardfire.vasc.impl.actions.XMLExportGlobalAction; import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver; import net.forwardfire.vasc.impl.entry.VascValidatorsValidatorService; +import net.forwardfire.vasc.impl.entry.config.VascActionsFinalizer; +import net.forwardfire.vasc.impl.entry.config.VascDefaultsFinalizer; +import net.forwardfire.vasc.impl.entry.config.VascHelpIdFinalizer; +import net.forwardfire.vasc.impl.entry.config.VascI18nFinalizer; +import net.forwardfire.vasc.impl.entry.config.VascIdAutoFinalizer; +import net.forwardfire.vasc.impl.entry.config.VascIdCheckFinalizer; +import net.forwardfire.vasc.impl.entry.export.VascEntryExporterCsv; +import net.forwardfire.vasc.impl.entry.export.VascEntryExporterXml; +import net.forwardfire.vasc.impl.entry.export.VascEntryExporterXmlTree; import net.forwardfire.vasc.impl.type.DefaultVascEntryFieldTypeController; /** @@ -62,8 +64,35 @@ public class DefaultVascFactory { static public VascController getDefaultVascController(Long userId,String userName,String...roles) throws VascException { - // config full controller for local jvm use + DefaultVascEntryConfigController vascConfig = new DefaultVascEntryConfigController(); + + // Add all backend proxy in ORDER + vascConfig.addVascBackendProxy(new VascBackendProxyTimerLogger()); + vascConfig.addVascBackendProxy(new VascBackendProxyEventExecutor()); + vascConfig.addVascBackendProxy(new VascBackendProxyCache()); + vascConfig.addVascBackendProxy(new VascBackendProxyFilter()); + vascConfig.addVascBackendProxy(new VascBackendProxySearch()); + vascConfig.addVascBackendProxy(new VascBackendProxySort()); + vascConfig.addVascBackendProxy(new VascBackendProxyPaged()); + + // Add all finalizers in ORDER + vascConfig.addVascEntryConfigFinalizer(new VascActionsFinalizer()); + vascConfig.addVascEntryConfigFinalizer(new VascIdAutoFinalizer()); + vascConfig.addVascEntryConfigFinalizer(new VascIdCheckFinalizer()); + vascConfig.addVascEntryConfigFinalizer(new VascI18nFinalizer()); + vascConfig.addVascEntryConfigFinalizer(new VascHelpIdFinalizer()); + vascConfig.addVascEntryConfigFinalizer(new VascDefaultsFinalizer()); + + // Add all exporters in reverse ORDER + vascConfig.addVascEntryExporter(new VascEntryExporterXmlTree()); + vascConfig.addVascEntryExporter(new VascEntryExporterXml()); + vascConfig.addVascEntryExporter(new VascEntryExporterCsv()); + + // Add per default the internal vasc validator + vascConfig.addVascEntryFieldValidatorService(new VascValidatorsValidatorService()); + DefaultVascController c = new DefaultVascController(); + c.setVascEntryConfigController(vascConfig); DefaultVascBackendController vascBackendController = new DefaultVascBackendController(); c.setVascBackendController(vascBackendController); @@ -90,7 +119,7 @@ public class DefaultVascFactory { DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); // vascFrontendData.setVascEntryState(new DefaultVascEntryState()); vascFrontendData.getVascEntryState().setVascBackendState(new DefaultVascBackendState()); - vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); // default page size is zero aka disabled + vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); vascFrontendData.getVascEntryState().getVascBackendState().setPageSizeMax(1000); // max 1k records on screen. // init resource resultsers @@ -102,65 +131,17 @@ public class DefaultVascFactory { return vascFrontendData; } - /** - * Gets a backend of the backend controller and addes all the proxy classes. - * @param entry - * @return - */ - static public VascBackend getProxyVascBackend(VascEntry entry) { - // Get the 'real' backend - VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId()); - - // logs all actions log logger - backend = new VascBackendProxyTimerLogger(backend,entry); - - // Fire event listeners before caching. - backend = new VascBackendProxyEventExecutor(backend,entry); - - // only cached one result, checks for paramater differnce - backend = new VascBackendProxyCache(backend,entry); - - for (VascBackendFilter filter:entry.getVascBackendFilters()) { - filter.initFilter(entry); - backend = new VascBackendProxyFilter(backend,entry,filter); - } - if (backend.isSearchable()==false) { - backend = new VascBackendProxySearch(backend,entry); - } - if (backend.isSortable()==false) { - backend = new VascBackendProxySort(backend,entry); - } - if (backend.isPageable()==false) { - backend = new VascBackendProxyPaged(backend,entry); - } - - // return the configed backend. - return backend; - } - static public void fillVascControllerLocalEntries(VascEntryControllerLocal c,VascController con) throws VascException { + + + static public void fillVascControllerLocalEntries(VascEntryControllerLocal c,VascController vascController) throws VascException { for (String id:c.getVascEntryIds()) { VascEntry entry = c.getMasterVascEntryById(id); - - // hackje for calling multiple times on same entries. - if (entry.getGlobalActionById(XMLExportGlobalAction.ACTION_ID)==null) { - - if (entry.isVascDisplayOnly()==false) { - if (entry.isVascAdminCreate()) { - entry.addRowAction(new AddRowAction()); - } - if (entry.isVascAdminEdit()) { - entry.addRowAction(new EditRowAction()); - } - if (entry.isVascAdminDelete()) { - entry.addRowAction(new DeleteRowAction()); - } - } - entry.addGlobalAction(new XMLExportGlobalAction()); - entry.addGlobalAction(new CSVExportGlobalAction()); - entry.addGlobalAction(new RefreshDataGlobalAction()); - } - + vascController.getVascEntryConfigController().configVascEntry(vascController, entry); + } + } + + /* MOVED to VascEntryConfigController /* DefaultVascEntryResourceResolver t = new DefaultVascEntryResourceResolver(resourceBundle); @@ -196,7 +177,7 @@ public class DefaultVascFactory { entry.getVa } - */ + // hackje om deze manuale actions van i18n keys te voorzien; // this is temp untill x4o templaing @@ -209,11 +190,12 @@ public class DefaultVascFactory { // ((VascBackendControllerLocal)c.getVascBackendController()).addVascBackend(vb); } } + */ - static public void fillVascEntryFrontend(VascEntry entry,VascController vascController,VascFrontendData frontendData) { + static public void fillVascEntryFrontend(VascEntry entry,VascController vascController,VascFrontendData frontendData) throws VascException { frontendData.setVascController(vascController); entry.setVascFrontendData(frontendData); - VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry); + VascBackend backend = vascController.getVascEntryConfigController().configVascBackendProxied(vascController, entry); frontendData.getVascEntryState().setVascBackend(backend); frontendData.getVascEntryState().setVascEntry(entry); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendData.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendData.java index 49a1344..8ebad5b 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendData.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendData.java @@ -30,7 +30,7 @@ import java.util.Map; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascEntryFinalizer; +import net.forwardfire.vasc.core.VascEntryConfigFinalizer; import net.forwardfire.vasc.core.VascEntryState; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.actions.ColumnVascAction; @@ -62,7 +62,7 @@ public class DefaultVascFrontendData implements VascFrontendData { private VascFrontend vascFrontend = null; private VascFrontendActions vascFrontendActions = null; private VascFrontendPager vascFrontendPager = null; - private VascEntryFinalizer vascEntryFinalizer = null; + private VascEntryConfigFinalizer vascEntryFinalizer = null; private VascFrontendHelper vascFrontendHelper = null; private VascEntryResourceResolver vascEntryResourceResolver = null; private VascEntryResourceImageResolver vascEntryResourceImageResolver = null; @@ -129,14 +129,14 @@ public class DefaultVascFrontendData implements VascFrontendData { /** * @see net.forwardfire.vasc.core.VascBackendData#getVascEntryFinalizer() */ - public VascEntryFinalizer getVascEntryFinalizer() { + public VascEntryConfigFinalizer getVascEntryFinalizer() { return vascEntryFinalizer; } /** - * @see net.forwardfire.vasc.core.VascBackendData#setVascEntryFinalizer(net.forwardfire.vasc.core.VascEntryFinalizer) + * @see net.forwardfire.vasc.core.VascBackendData#setVascEntryFinalizer(net.forwardfire.vasc.core.VascEntryConfigFinalizer) */ - public void setVascEntryFinalizer(VascEntryFinalizer vascEntryFinalizer) { + public void setVascEntryFinalizer(VascEntryConfigFinalizer vascEntryFinalizer) { this.vascEntryFinalizer=vascEntryFinalizer; } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascLinkEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascLinkEntry.java index 67ac175..561bfb2 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascLinkEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascLinkEntry.java @@ -48,6 +48,7 @@ public class DefaultVascLinkEntry implements VascLinkEntry { private VascLinkEntryType vascLinkEntryType = null; private String doActionId = null; private String name = null; + private String helpId = null; /** * @return the id @@ -140,6 +141,20 @@ public class DefaultVascLinkEntry implements VascLinkEntry { this.name = name; } + /** + * @return the helpId + */ + public String getHelpId() { + return helpId; + } + + /** + * @param helpId the helpId to set + */ + public void setHelpId(String helpId) { + this.helpId = helpId; + } + /** * @see java.lang.Object#clone() */ @@ -153,6 +168,7 @@ public class DefaultVascLinkEntry implements VascLinkEntry { result.entryCreateFieldValues=entryCreateFieldValues; result.id=id; result.name=name; + result.helpId=helpId; return result; } } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/ExportDataGlobalAction.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/ExportDataGlobalAction.java new file mode 100644 index 0000000..a482145 --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/ExportDataGlobalAction.java @@ -0,0 +1,72 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.impl.actions; + +import net.forwardfire.vasc.core.VascEntry; +import net.forwardfire.vasc.core.actions.AbstractVascAction; +import net.forwardfire.vasc.core.actions.GlobalVascAction; +import net.forwardfire.vasc.core.actions.VascAction; +import net.forwardfire.vasc.core.entry.VascEntryExporter; + +/** + * ExportDataGlobalAction is action per exporter. + * + * @author Willem Cazander + * @version 1.0 May 10, 2012 + */ +public class ExportDataGlobalAction extends AbstractVascAction implements GlobalVascAction { + + private static final long serialVersionUID = 1L; + private String exporterId = null; + static public final String ACTION_POSTFIX = "ExportAction"; + + public ExportDataGlobalAction(String exporterId) { + this.exporterId=exporterId; + setId(exporterId+ACTION_POSTFIX); + } + + protected String getActionId() { + return exporterId; + } + + public void doGlobalAction(VascEntry entry) throws Exception { + VascEntryExporter exporter = entry.getVascFrontendData().getVascController().getVascEntryConfigController().getVascEntryExporterById(exporterId); + entry.getVascFrontendData().getVascFrontend().renderExport(exporter); + } + + /** + * @see net.forwardfire.vasc.core.actions.AbstractVascAction#clone() + */ + @Override + public VascAction clone() throws CloneNotSupportedException { + VascAction action = new ExportDataGlobalAction(exporterId); + action.setId(getId()); + action.setName(getName()); + action.setDescription(getDescription()); + action.setImage(getImage()); + action.setHelpId(getHelpId()); + return action; + } + + +} \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascActionsFinalizer.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascActionsFinalizer.java new file mode 100644 index 0000000..ba6c546 --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascActionsFinalizer.java @@ -0,0 +1,71 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.impl.entry.config; + +import net.forwardfire.vasc.core.VascController; +import net.forwardfire.vasc.core.VascEntry; +import net.forwardfire.vasc.core.VascEntryConfigFinalizer; +import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.core.entry.VascEntryExporter; +import net.forwardfire.vasc.impl.actions.AddRowAction; +import net.forwardfire.vasc.impl.actions.DeleteRowAction; +import net.forwardfire.vasc.impl.actions.EditRowAction; +import net.forwardfire.vasc.impl.actions.ExportDataGlobalAction; +import net.forwardfire.vasc.impl.actions.RefreshDataGlobalAction; + +/** + * VascActionsFinalizer Adds all the default actions. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public class VascActionsFinalizer implements VascEntryConfigFinalizer { + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry) + */ + public void configVascEntry(VascController vascController, VascEntry entry) throws VascException { + + + if (entry.getExportActions().isEmpty()==false) { + return; // hackje for calling multiple times on same entries. + } + + if (entry.isVascDisplayOnly()==false) { // TODO: redo to flags + if (entry.isVascAdminCreate()) { + entry.addRowAction(new AddRowAction()); + } + if (entry.isVascAdminEdit()) { + entry.addRowAction(new EditRowAction()); + } + if (entry.isVascAdminDelete()) { + entry.addRowAction(new DeleteRowAction()); + } + } + entry.addGlobalAction(new RefreshDataGlobalAction()); + + // Add all exporter actions + for (VascEntryExporter export:vascController.getVascEntryConfigController().getVascEntryExporters()) { + entry.addExportAction(new ExportDataGlobalAction(export.getId())); + } + }} diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackedEntryFinalizer.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascDefaultsFinalizer.java similarity index 52% rename from vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackedEntryFinalizer.java rename to vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascDefaultsFinalizer.java index 49c970e..d1ec2a9 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackedEntryFinalizer.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascDefaultsFinalizer.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.impl; +package net.forwardfire.vasc.impl.entry.config; import java.util.Collections; import java.util.Comparator; @@ -32,49 +32,29 @@ import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascEntryFieldSet; -import net.forwardfire.vasc.core.VascEntryFinalizer; +import net.forwardfire.vasc.core.VascEntryConfigFinalizer; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.VascLinkEntry; import net.forwardfire.vasc.core.VascLinkEntryType; -import net.forwardfire.vasc.core.actions.VascAction; /** - * Checks for minimal needed stuff - * and fills up the rest. - * + * VascDefaultsFinalizer does set some default in objects of entry. * * @author Willem Cazander - * @version 1.0 Sep 14, 2008 + * @version 1.0 May 9, 2012 */ -public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { +public class VascDefaultsFinalizer implements VascEntryConfigFinalizer { /** - * @see net.forwardfire.vasc.core.VascEntryFinalizer#finalizeVascEntry(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry) */ - public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException { - + public void configVascEntry(VascController vascController, VascEntry entry) throws VascException { + // First Check if we all have ids String id = entry.getId(); - if (id==null) { - throw new IllegalArgumentException("The VascEntry need an id."); - } - if (entry.getBackendId()==null) { - throw new IllegalArgumentException("The VascEntry need an backendId in entryId: "+id); - } if (entry.getVascEntryFields().size()==0) { throw new IllegalArgumentException("We need at least one VascEntryField in entryId: "+id); } - for (VascEntryField vef:entry.getVascEntryFields()) { - if (vef.getId()==null) { - throw new IllegalArgumentException("All VascEntryField need an id in entryId: "+id); - } - } - for (VascEntryField vef:entry.getListOptions()) { - if (vef.getId()==null) { - throw new IllegalArgumentException("All listOption VascEntryField to have an id in entryId: "+id); - } - } // Check if backendId is valid VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() ); @@ -82,89 +62,13 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { throw new IllegalArgumentException("The VascEntry backend is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id); } - - // Fill up all not field i18n keys - - // entry fields - if (entry.getName()==null) { - entry.setName("vasc.entry."+id+".name"); - } - if (entry.getImage()==null) { - entry.setImage("vasc.entry."+id+".image"); - } - if (entry.getHelpId()==null) { - entry.setHelpId("vasc.entry."+id+".helpId"); - } - - if (entry.getListDescription()==null) { - entry.setListDescription("vasc.entry."+id+".listDescription"); - } - if (entry.getListImage()==null) { - entry.setListImage("vasc.entry."+id+".listImage"); - } - if (entry.getEditDescription()==null) { - entry.setEditDescription("vasc.entry."+id+".editDescription"); - } - if (entry.getEditImage()==null) { - entry.setEditImage("vasc.entry."+id+".editImage"); - } - if (entry.getDeleteDescription()==null) { - entry.setDeleteDescription("vasc.entry."+id+".deleteDescription"); - } - if (entry.getDeleteImage()==null) { - entry.setDeleteImage("vasc.entry."+id+".deleteImage"); - } - if (entry.getCreateDescription()==null) { - entry.setCreateDescription("vasc.entry."+id+".createDescription"); - } - if (entry.getCreateImage()==null) { - entry.setCreateImage("vasc.entry."+id+".createImage"); - } - // boolean view helper if (entry.isVascDisplayOnly()) { entry.setVascAdminCreate(false); entry.setVascAdminDelete(false); entry.setVascAdminEdit(false); } - - // optional field sets - for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) { - - // check id - String sid = s.getId(); - if (sid==null) { - throw new IllegalArgumentException("All VascEntryFieldSet need an id in entryId: "+id); - } - - // check if refenced ids are avalible - for (String fid:s.getVascEntryFieldIds()) { - if (entry.getVascEntryFieldById(fid)==null) { - throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid+" in entryId: "+id); - } - } - - // fill up properties - if (s.getName()==null) { - s.setName("vasc.entry."+id+"."+sid+".name"); - } - if (s.getDescription()==null) { - s.setDescription("vasc.entry."+id+"."+sid+".description"); - } - if (s.getImage()==null) { - s.setImage("vasc.entry."+id+"."+sid+".image"); - } - if (s.getHelpId()==null) { - s.setHelpId("vasc.entry."+id+"."+sid+".helpId"); - } - if (s.getStyleEdit()==null) { - s.setStyleEdit("vasc.entry."+id+"."+sid+".styleEdit"); - } - if (s.getStyleList()==null) { - s.setStyleList("vasc.entry."+id+"."+sid+".styleEdit"); - } - } - + // Set defaults field Id for key ad display if (entry.getPrimaryKeyFieldId()==null) { entry.setPrimaryKeyFieldId(entry.getVascEntryFields().get(0).getId()); @@ -174,7 +78,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { entry.setDisplayNameFieldId(entry.getVascEntryFields().get(0).getId()); } - // Check fields int orderIndex = 0; for (VascEntryField vef:entry.getVascEntryFields()) { @@ -188,32 +91,11 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { vef.setVascEntry(entry); } - //System.out.println("Field: "+vef.getId()+" order: "+vef.getOrderIndex()+" else: "+orderIndex); if (vef.getOrderIndex()==null) { vef.setOrderIndex(orderIndex); } orderIndex = orderIndex+100; - // fill up properties - if (vef.getName()==null) { - vef.setName("vasc.entry."+id+"."+vid+".name"); - } - if (vef.getDescription()==null) { - vef.setDescription("vasc.entry."+id+"."+vid+".description"); - } - if (vef.getImage()==null) { - vef.setImage("vasc.entry."+id+"."+vid+".image"); - } - if (vef.getHelpId()==null) { - vef.setHelpId("vasc.entry."+id+"."+vid+".helpId"); - } - if (vef.getStyleEdit()==null) { - vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit"); - } - if (vef.getStyleList()==null) { - vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit"); - } - //if (vef.getDefaultValue()==null) { // vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue"); //} @@ -249,7 +131,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { if (vef.getVascEntryFieldType()==null) { vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField")); } - //vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit"); } @@ -269,7 +150,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { //} } - class OrderIndexComparator implements Comparator { public int compare(VascEntryField v1, VascEntryField v2) { return v1.getOrderIndex().compareTo(v2.getOrderIndex()); @@ -277,7 +157,6 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { } Collections.sort(entry.getVascEntryFields(),new OrderIndexComparator()); - // place primary key in front int index = 0; for (VascEntryField vef:entry.getVascEntryFields()) { @@ -295,22 +174,12 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { // Check if link entries excists for (VascLinkEntry vle:entry.getVascLinkEntries()) { - - // check id - String vid = vle.getId(); - if (vid==null) { - throw new IllegalArgumentException("All VascLinkEntry need an id in entryId: "+id); - } if (vle.getVascEntryId()==null) { throw new IllegalArgumentException("All VascLinkEntry need an vascEntryId: "+id); } - if (vle.getVascLinkEntryType()==null) { vle.setVascLinkEntryType(VascLinkEntryType.DEFAULT_TYPE); } - if (vle.getName()==null) { - vle.setName("vasc.entry."+vle.getVascEntryId()+".name"); - } } for (VascEntryField vef:entry.getListOptions()) { @@ -326,27 +195,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { vef.setOrderIndex(orderIndex); } orderIndex = orderIndex+100; - - // fill up properties - if (vef.getName()==null) { - vef.setName("vasc.entry."+id+"."+vid+".name"); - } - if (vef.getDescription()==null) { - vef.setDescription("vasc.entry."+id+"."+vid+".description"); - } - if (vef.getImage()==null) { - vef.setImage("vasc.entry."+id+"."+vid+".image"); - } - if (vef.getHelpId()==null) { - vef.setHelpId("vasc.entry."+id+"."+vid+".helpId"); - } - if (vef.getStyleEdit()==null) { - vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit"); - } - if (vef.getStyleList()==null) { - vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit"); - } - + //if (vef.getDefaultValue()==null) { // vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue"); //} @@ -382,71 +231,7 @@ public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer { } vef.setDefaultValue(value); } - } - - } - - - - for (VascAction action:entry.getGlobalActions()) { - String aid = action.getId(); - if (aid==null) { - throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id); - } - if (action.getName()==null) { - action.setName("vasc.action."+aid+".name"); - } - if (action.getDescription()==null) { - action.setDescription("vasc.action."+aid+".description"); - } - if (action.getImage()==null) { - action.setImage("vasc.action."+aid+".image"); - } - if (action.getHelpId()==null) { - action.setHelpId("vasc.action."+aid+".helpId"); - } - } - for (VascAction action:entry.getRowActions()) { - String aid = action.getId(); - if (aid==null) { - throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id); - } - if (action.getName()==null) { - action.setName("vasc.action."+aid+".name"); - } - if (action.getDescription()==null) { - action.setDescription("vasc.action."+aid+".description"); - } - if (action.getImage()==null) { - action.setImage("vasc.action."+aid+".image"); - } - if (action.getHelpId()==null) { - action.setHelpId("vasc.action."+aid+".helpId"); - } - } - for (VascAction action:entry.getColumnActions()) { - String aid = action.getId(); - if (aid==null) { - throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id); - } - if (action.getName()==null) { - action.setName("vasc.action."+aid+".name"); - } - if (action.getDescription()==null) { - action.setDescription("vasc.action."+aid+".description"); - } - if (action.getImage()==null) { - action.setImage("vasc.action."+aid+".image"); - } - if (action.getHelpId()==null) { - action.setHelpId("vasc.action."+aid+".helpId"); - } - } - - - return entry; + } + } } - - - } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascHelpIdFinalizer.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascHelpIdFinalizer.java new file mode 100644 index 0000000..0d9ce93 --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/config/VascHelpIdFinalizer.java @@ -0,0 +1,137 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.impl.entry.config; + +import net.forwardfire.vasc.core.VascController; +import net.forwardfire.vasc.core.VascEntry; +import net.forwardfire.vasc.core.VascEntryField; +import net.forwardfire.vasc.core.VascEntryFieldSet; +import net.forwardfire.vasc.core.VascEntryConfigFinalizer; +import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.core.VascLinkEntry; +import net.forwardfire.vasc.core.actions.VascAction; + +/** + * VascHelpIdFinalizer copies the (optional)capitalized Id's into helpId field. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public class VascHelpIdFinalizer implements VascEntryConfigFinalizer { + + private boolean upperCase = true; + private char seperatorChar = '_'; + + /** + * @see net.forwardfire.vasc.core.VascEntryConfigFinalizer#configVascEntry(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry) + */ + public void configVascEntry(VascController vascController, VascEntry entry) throws VascException { + + String id = entry.getId(); + if (entry.getHelpId()==null) { + entry.setHelpId(format(entry.getId())); + } + for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) { + if (s.getHelpId()==null) { + s.setHelpId(format(id,s.getId())); + } + } + for (VascEntryField vef:entry.getVascEntryFields()) { + if (vef.getHelpId()==null) { + vef.setHelpId(format(id,vef.getId())); + } + } + for (VascLinkEntry vle:entry.getVascLinkEntries()) { + if (vle.getHelpId()==null) { + vle.setHelpId(format(id,vle.getId())); + } + } + for (VascEntryField vef:entry.getListOptions()) { + if (vef.getHelpId()==null) { + vef.setHelpId(format(id,vef.getId())); + } + } + for (VascAction action:entry.getGlobalActions()) { + if (action.getHelpId()==null) { + action.setHelpId(format(id,action.getId())); + } + } + for (VascAction action:entry.getExportActions()) { + if (action.getHelpId()==null) { + action.setHelpId(format(id,action.getId())); + } + } + for (VascAction action:entry.getRowActions()) { + if (action.getHelpId()==null) { + action.setHelpId(format(id,action.getId())); + } + } + for (VascAction action:entry.getColumnActions()) { + if (action.getHelpId()==null) { + action.setHelpId(format(id,action.getId())); + } + } + } + + private String format(String ... ids) { + StringBuilder idBuff = new StringBuilder(); + for (int i=0;i> data = null; + + public JRDynamicDataSourceVascEntry(VascEntry vascEntry) { + if (vascEntry==null) { + throw new NullPointerException("vascEntry can't be null."); + } + this.vascEntry = vascEntry; + total = vascEntry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); + + // hackje until calc index to page and row. + try { + data = new ArrayList>(1000); + int pages = (int)total/vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize(); + for (int page=0;page<=pages;page++) { + vascEntry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page); + vascEntry.getVascFrontendData().getVascFrontendActions().refreshData(); + for (Object o:vascEntry.getVascFrontendData().getVascEntryState().getEntryDataList()) { + List row = new ArrayList(30); + for (VascEntryField c:vascEntry.getVascEntryFields()) { + row.add(c.getVascEntryFieldValue().getDisplayValue(c, o)); + } + data.add(row); + } + } + } catch (VascException ve) { + throw new RuntimeException(ve); + } + } + + /** + * @see net.sf.jasperreports.engine.JRDataSource#getFieldValue(net.sf.jasperreports.engine.JRField) + */ + public Object getFieldValue(JRField jrField) throws JRException { + String fieldName = jrField.getName(); + if (fieldName.startsWith(PREFIX_COLUMN)) { + return data.get(index).get(Integer.parseInt(fieldName.substring(7))); + } + if (fieldName.startsWith(PREFIX_HEADER)) { + List fields = vascEntry.getVascEntryFields(); + VascEntryField field = fields.get(Integer.parseInt(fieldName.substring(7))); + return vascEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(field.getName()); + } + throw new JRException("Unknown column name : " + fieldName); + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#addDynamicColumnClassFields(net.sf.jasperreports.engine.design.JasperDesign) + */ + public void addDynamicColumnClassFields(JasperDesign jd) throws JRException { + JRDesignField field; + for (int i=0;i addDynamicELBean() { + Map result = new HashMap(10); + for (int i=0;i parameters = new HashMap(5); + parameters.put("title", entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getName())); + parameters.put("description", entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getListDescription())); + parameters.put("titleSubject", entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(entry.getId())); + + int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); + String bundle = entry.getVascFrontendData().getVascController().getVascEntryConfigController().getResourceBundle(); + JRDynamicDataSourceVascEntry dataSource = new JRDynamicDataSourceVascEntry(entry); + JR4ODesignManager jr4o = new JR4ODesignManager(dataSource,bundle,parameters); + try { + if (reportResource!=null) { + jr4o.parseResource(reportResource); + } else if (reportFile!=null) { + jr4o.parseFile(reportFile); + } else { + throw new NullPointerException("No report input data defined,reportResource and reportFile are null."); + } + jr4o.saveReportStream(reportName, reportType, out); + } catch (Exception e) { + throw new VascException(e); + } finally { + entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex); // restore page index + } + } + + /** + * @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType() + */ + public String getMineType() { + return "text/pdf"; + } + + /** + * @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType() + */ + public String getFileType() { + return EXPORT_TYPE; + } +} \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/XMLExportGlobalAction.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXml.java similarity index 67% rename from vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/XMLExportGlobalAction.java rename to vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXml.java index 97ee24a..5d2d8d5 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/XMLExportGlobalAction.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXml.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.impl.actions; +package net.forwardfire.vasc.impl.entry.export; import java.io.OutputStream; import java.io.PrintWriter; @@ -28,31 +28,31 @@ import java.io.PrintWriter; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; -import net.forwardfire.vasc.core.actions.AbstractVascAction; -import net.forwardfire.vasc.core.actions.GlobalVascAction; import net.forwardfire.vasc.core.entry.VascEntryExporter; - - /** + * VascEntryExporterXml writes entry data to xml format. * * @author Willem Cazander * @version 1.0 Mar 30, 2007 */ -public class XMLExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter { +public class VascEntryExporterXml implements VascEntryExporter { private static final long serialVersionUID = 3719424578585760828L; - static public final String ACTION_ID = "xmlExportAction"; + static public final String EXPORT_TYPE = "xml"; + private boolean xmlTree = false; - protected String getActionId() { - return ACTION_ID; + /** + * @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId() + */ + public String getId() { + return EXPORT_TYPE; } - - public void doGlobalAction(VascEntry entry) throws Exception { - entry.getVascFrontendData().getVascFrontend().renderExport(this); - } - - public void doExport(OutputStream out,VascEntry entry) throws VascException { + + /** + * @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry) + */ + public void doExport(OutputStream out, VascEntry entry) throws VascException { PrintWriter p = new PrintWriter(out); p.write("\n"); p.write("\n"); @@ -66,9 +66,15 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) { p.write("\t\n"); for (VascEntryField c:entry.getVascEntryFields()) { - p.write("\t\t\n"); + if (xmlTree) { + p.write("\t\t<"+c.getId()+">\n"); + } else { + p.write("\t\t\n"); + } } p.write("\t\n"); p.flush(); @@ -81,11 +87,31 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex); } + /** + * @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType() + */ public String getMineType() { return "text/xml"; } - public String getType() { - return "xml"; + /** + * @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType() + */ + public String getFileType() { + return EXPORT_TYPE; + } + + /** + * @return the xmlTree + */ + public boolean isXmlTree() { + return xmlTree; + } + + /** + * @param xmlTree the xmlTree to set + */ + public void setXmlTree(boolean xmlTree) { + this.xmlTree = xmlTree; } } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXmlTree.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXmlTree.java new file mode 100644 index 0000000..8a2cb95 --- /dev/null +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/export/VascEntryExporterXmlTree.java @@ -0,0 +1,50 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.impl.entry.export; + +/** + * VascEntryExporterXmlTree exports the data as xml tree. + * + * @author Willem Cazander + * @version 1.0 May 9, 2012 + */ +public class VascEntryExporterXmlTree extends VascEntryExporterXml { + + private static final long serialVersionUID = 179434457857022828L; + static public final String EXPORT_TYPE = "xmltree"; + + /** + * Creates an VascEntryExporterXmlTree + */ + public VascEntryExporterXmlTree() { + setXmlTree(true); + } + + /** + * @see net.forwardfire.vasc.impl.entry.export.VascEntryExporterXml#getId() + */ + @Override + public String getId() { + return EXPORT_TYPE; + } +} \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java index 1b1b1d6..443cfa7 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java @@ -36,17 +36,13 @@ import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.core.ui.VascSelectItem; import net.forwardfire.vasc.core.ui.VascSelectItemModel; import net.forwardfire.vasc.impl.DefaultVascBackendState; -import net.forwardfire.vasc.impl.DefaultVascFactory; - - - /** -* The DefaultVascSelectItemModel -* -* @author Willem Cazander -* @version 1.0 Oct 27, 2007 -*/ + * The DefaultVascSelectItemModel + * + * @author Willem Cazander + * @version 1.0 Oct 27, 2007 + */ public class VascSelectItemModelEntry implements VascSelectItemModel { private static final long serialVersionUID = 1L; @@ -84,7 +80,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel { // set frontend data for new clone, we need te get better lifecycle management for stats/entry/etc entry.setVascFrontendData(currentEntry.getVascFrontendData()); - VascBackend back = DefaultVascFactory.getProxyVascBackend(entry); + VascBackend back = currentEntry.getVascFrontendData().getVascController().getVascEntryConfigController().configVascBackendProxied(currentEntry.getVascFrontendData().getVascController(), entry); try { if (nullLabel!=null) { if (nullKeyValue==null) { @@ -97,6 +93,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel { // set def para VascBackendState state = new DefaultVascBackendState(); + for (String key2:entry.getEntryParameterKeys()) { Object value = entry.getEntryParameter(key2); //System.out.println("Copy paras name: "+key2+" value: "+value+" class: "+value.getClass().getName()); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/x4o/VascEntryElementConfigurator.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/x4o/VascEntryElementConfigurator.java index e136f2f..359bc60 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/x4o/VascEntryElementConfigurator.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/x4o/VascEntryElementConfigurator.java @@ -22,18 +22,15 @@ package net.forwardfire.vasc.impl.x4o; - import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryController; import net.forwardfire.vasc.core.VascEntryControllerLocal; -import net.forwardfire.vasc.core.VascException; import org.x4o.xml.element.AbstractElementConfigurator; import org.x4o.xml.element.Element; import org.x4o.xml.element.ElementConfiguratorException; - /** * Converts the type to the type object * @@ -46,18 +43,12 @@ public class VascEntryElementConfigurator extends AbstractElementConfigurator { * @see org.x4o.xml.element.AbstractElementConfigurator#doConfigEndTag(org.x4o.xml.element.Element) */ public void doConfigElement(Element element) throws ElementConfiguratorException { - VascEntry entry = (VascEntry)element.getElementObject(); - VascController vascController = VascParser.getVascController(element.getElementContext()); VascEntryController entryController = vascController.getVascEntryController(); if (entryController instanceof VascEntryControllerLocal) { - try { - ((VascEntryControllerLocal)entryController).addVascEntry(entry, vascController); - } catch (VascException e) { - throw new ElementConfiguratorException(this,"Couln't add entry: "+e.getMessage(),e); - } + ((VascEntryControllerLocal)entryController).addVascEntry(entry); } else { throw new ElementConfiguratorException(this,"Can not add entry '"+entry.getId()+"' to VascEntryController because we have no access to VascEntryControllerLocal interface."); } diff --git a/vasc-demo/vasc-demo-tech/pom.xml b/vasc-demo/vasc-demo-tech/pom.xml index 99213d3..41455c1 100644 --- a/vasc-demo/vasc-demo-tech/pom.xml +++ b/vasc-demo/vasc-demo-tech/pom.xml @@ -15,5 +15,6 @@ vasc-demo-tech-editor vasc-demo-tech-web vasc-demo-tech-ui + vasc-demo-tech-core \ No newline at end of file diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/.project b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/.project new file mode 100644 index 0000000..46bb916 --- /dev/null +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/.project @@ -0,0 +1,36 @@ + + + vasc-demo-tech-core + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + 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 + + diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/pom.xml b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/pom.xml new file mode 100644 index 0000000..61bfac8 --- /dev/null +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + + vasc-demo-tech + net.forwardfire.vasc.demo + 0.3.5-SNAPSHOT + .. + + vasc-demo-tech-core + vasc-demo-tech-core + vasc-demo-tech-core + + + net.forwardfire.vasc + vasc-core + ${project.version} + + + \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendEntryFinalizer.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascControllerProvider.java similarity index 73% rename from vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendEntryFinalizer.java rename to vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascControllerProvider.java index 0b968e0..2deb541 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFrontendEntryFinalizer.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascControllerProvider.java @@ -20,26 +20,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.impl; +package net.forwardfire.vasc.demo.tech.core; import net.forwardfire.vasc.core.VascController; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryFinalizer; -import net.forwardfire.vasc.core.VascException; - +import net.forwardfire.vasc.core.VascControllerProvider; /** + * DemoVascControllerProvider gets the static local jvm vasc controller for this tech demo. * * @author Willem Cazander - * @version 1.0 Sep 14, 2008 + * @version 1.0 May 12, 2012 */ -public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer { +public class DemoVascControllerProvider implements VascControllerProvider { /** - * @see net.forwardfire.vasc.core.VascEntryFinalizer#finalizeVascEntry(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.core.VascControllerProvider#getVascController() */ - public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException { - - return entry; + public VascController getVascController() { + return DemoVascManager.getVascControllerStatic(); } -} \ No newline at end of file +} diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascManager.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascManager.java new file mode 100644 index 0000000..a2ae5de --- /dev/null +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-core/src/main/java/net/forwardfire/vasc/demo/tech/core/DemoVascManager.java @@ -0,0 +1,128 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.demo.tech.core; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.logging.Logger; + +import net.forwardfire.vasc.core.VascController; +import net.forwardfire.vasc.core.VascEntryConfigController; +import net.forwardfire.vasc.core.VascEntryControllerLocal; +import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.impl.DefaultVascFactory; +import net.forwardfire.vasc.impl.entry.export.VascEntryExporterJR4O; +import net.forwardfire.vasc.impl.x4o.VascParser; +import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType; + +/** + * DemoVascManager manages the dynamic vasc controller for tech demo. + * + * @author Willem Cazander + * @version 1.0 May 12, 2012 + */ +public class DemoVascManager { + + private Logger logger = null; + static private VascController vascController = null; + + public DemoVascManager() { + logger = Logger.getLogger(DemoVascManager.class.getName()); + } + + public void start() { + logger.finer("Starting vascmanager"); + if (vascController!=null) { + throw new RuntimeException("VascManager is already started."); + } + try { + vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin"); + + VascEntryConfigController vecc = vascController.getVascEntryConfigController(); + + // Config all report export engines for demo. + vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfLandscape",JRExportType.PDF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml")); + vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfPortrait",JRExportType.PDF,"generic-portrait","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml")); + vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrRtf",JRExportType.RTF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml")); + vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXls",JRExportType.XLS,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml")); + vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXml",JRExportType.XML,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml")); + vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrCsv",JRExportType.CSV,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml")); + + // Config root bundle to load all resources. + vecc.setResourceBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle"); + + // Config some defaults + vecc.setDefaultPageSize(200); + vecc.setDefaultPageSizeMax(1500); + + initEditor(); + } catch (VascException e) { + throw new RuntimeException(e); + } + } + + public void stop() { + vascController = null; + logger.info("Stop manager, cleared all."); + } + + private void initEditor() { + try { + VascParser parser = new VascParser(vascController); + parser.addGlobalELBean("vascController", vascController); + parser.parseResource("net/forwardfire/vasc/editor/vasc-edit.xml"); + + DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + public void openFile(File file) { + logger.info("Vasc open file: "+file.getAbsoluteFile()); + try { + VascParser parser = new VascParser(vascController); + File f = File.createTempFile("test-vasc", ".xml"); + parser.setDebugOutputStream(new FileOutputStream(f)); + parser.parseFile(file); + + DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + public VascController getVascController() { + return vascController; + } + + /** + * Needed for the provider interface + * @return + */ + static protected VascController getVascControllerStatic() { + return vascController; + } +} diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/pom.xml b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/pom.xml index 304e768..a01901b 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/pom.xml +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/pom.xml @@ -21,6 +21,11 @@ + + net.forwardfire.vasc.demo + vasc-demo-tech-core + ${project.version} + net.forwardfire.vasc.demo vasc-demo-tech-editor @@ -30,7 +35,15 @@ net.forwardfire.vasc.demo vasc-demo-tech-web ${project.version} - + war + compile + + + net.forwardfire.vasc.demo + vasc-demo-tech-web + ${project.version} + jar + compile net.forwardfire.vasc @@ -47,6 +60,16 @@ vasc-frontend-web-jsf ${project.version} + + net.forwardfire.vasc + vasc-frontend-web-export + ${project.version} + + + net.forwardfire.vasc + vasc-frontend-cxf-server + ${project.version} + net.forwardfire.vasc vasc-backend-ldap diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/TechUI.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/TechUI.java index 7d039fb..7952588 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/TechUI.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/TechUI.java @@ -42,13 +42,14 @@ import org.jdesktop.application.FrameView; import org.jdesktop.application.SingleFrameApplication; import net.forwardfire.vasc.core.VascController; +import net.forwardfire.vasc.demo.tech.core.DemoVascManager; import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel; import net.forwardfire.vasc.demo.tech.ui.components.JMainPanelMenuBar; public class TechUI extends SingleFrameApplication { private Logger logger = null; - private VascManager vascManager = null; + private DemoVascManager vascManager = null; private TomcatManager tomcatManager = null; static public void main(String[] args) { @@ -129,7 +130,7 @@ public class TechUI extends SingleFrameApplication { long startTime = System.currentTimeMillis(); setupLogging(); logger.info("Starting Vasc-Demo-Tech-UI."); - vascManager = new VascManager(); + vascManager = new DemoVascManager(); vascManager.start(); autoLoadVasc(); @@ -180,7 +181,7 @@ public class TechUI extends SingleFrameApplication { return getInstance(TechUI.class); } - public VascManager getVascManager() { + public DemoVascManager getVascManager() { return vascManager; } diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/VascManager.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/VascAutoSchemaMetaModel.java similarity index 71% rename from vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/VascManager.java rename to vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/VascAutoSchemaMetaModel.java index 2608158..36898a9 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/VascManager.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/VascAutoSchemaMetaModel.java @@ -1,8 +1,5 @@ package net.forwardfire.vasc.demo.tech.ui; -import java.io.File; -import java.io.FileOutputStream; -import java.lang.reflect.Method; import java.util.logging.Logger; import org.eobjects.metamodel.DataContext; @@ -17,118 +14,28 @@ import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryControllerLocal; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.VascLinkEntry; import net.forwardfire.vasc.core.VascLinkEntryType; -import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel; + import net.forwardfire.vasc.impl.DefaultVascEntry; import net.forwardfire.vasc.impl.DefaultVascEntryField; import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.impl.DefaultVascLinkEntry; import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry; -import net.forwardfire.vasc.impl.x4o.VascParser; -public class VascManager { +public class VascAutoSchemaMetaModel { private Logger logger = null; private VascController vascController = null; - public VascManager() { - logger = Logger.getLogger(VascManager.class.getName()); + public VascAutoSchemaMetaModel(VascController vascController) { + logger = Logger.getLogger(VascAutoSchemaMetaModel.class.getName()); + this.vascController=vascController; } - public void start() { - logger.finer("Starting vascmanager"); - try { - vascController = DefaultVascFactory.getDefaultVascController(2288L,"forwardfire.net","user","admin"); - initEditor(); - } catch (VascException e) { - throw new RuntimeException(e); - } - } - - public void stop() { - vascController = null; - logger.info("Stop manager, cleared all."); - } - - private void initEditor() { - try { - VascParser parser = new VascParser(vascController); - parser.addGlobalELBean("vascController", vascController); - parser.parseResource("net/forwardfire/vasc/editor/vasc-edit.xml"); - - DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - public void openFile(File file) { - logger.info("Vasc open file: "+file.getAbsoluteFile()); - try { - VascParser parser = new VascParser(vascController); - File f = File.createTempFile("test-vasc", ".xml"); - parser.setDebugOutputStream(new FileOutputStream(f)); - parser.parseFile(file); - - DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - public VascController getVascController() { + private VascController getVascController() { return vascController; } - - public void printEntries() { - try { - for (String key:getVascController().getVascEntryController().getVascEntryIds()) { - VascEntry ve = getVascController().getVascEntryController().getVascEntryById(key); - printEntry(ve); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void printEntry(VascEntry e) throws Exception { - - System.out.println(""); - System.out.println("=== Printing entry ==="); - System.out.println(""); - - for (Method m:e.getClass().getMethods()) { - if (m.getName().startsWith("get")==false) { //a bit dirty - continue; - } - if (m.getParameterTypes().length>0) { - continue; - } - System.out.println("prop: "+m.getName()+" -> "+m.invoke(e)); - } - - System.out.println(""); - System.out.println("=== Fields ==="); - for (VascEntryField vef:e.getVascEntryFields()) { - - System.out.println("=== Field: "+vef.getId()); - - for (Method m:vef.getClass().getMethods()) { - if (m.getName().startsWith("get")==false) { //a bit dirty - continue; - } - if (m.getParameterTypes().length>0) { - continue; - } - System.out.println("prop: "+m.getName()+" -> "+m.invoke(vef)); - } - } - } - public void createMetaEntry(MetaModelDataContextProvider ds,String id,String tableName) { logger.info("Creating entry id: "+id+" of table: "+tableName); @@ -175,12 +82,10 @@ public class VascManager { try { ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend); - ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve, getVascController()); + ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve); // mm TODO rm this fill which adds the global actions ... and show updated tree in editor DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) getVascController().getVascEntryController(), getVascController()); - //rebuildTree(); - ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree(); } catch (Exception ee) { ee.printStackTrace(); } @@ -222,7 +127,7 @@ public class VascManager { try { ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink); - ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController()); + ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink); VascLinkEntry vle = new DefaultVascLinkEntry(); vle.setId(id+"Link"); @@ -272,7 +177,7 @@ public class VascManager { vef.getVascEntryFieldType().setDataObject(itemModel); ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink); - ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink, getVascController()); + ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink); } catch (Exception e) { e.printStackTrace(); } diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaCsv.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaCsv.java index 0fd304f..b8d042a 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaCsv.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaCsv.java @@ -18,6 +18,8 @@ import javax.swing.JPanel; import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv; import net.forwardfire.vasc.demo.tech.ui.TechUI; +import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel; +import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel; public class JDialogMetaCsv extends JDialog implements ActionListener { @@ -62,7 +64,9 @@ public class JDialogMetaCsv extends JDialog implements ActionListener { File file = fc.getSelectedFile(); MetaModelDataContextCsv ds = new MetaModelDataContextCsv(); ds.setFile(file.getAbsolutePath()); - TechUI.getInstance().getVascManager().createMetaEntry(ds,file.getName(),null); + VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController()); + schema.createMetaEntry(ds,file.getName(),null); + ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree(); } } }); diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaJdbc.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaJdbc.java index 55d43dd..fd8a58f 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaJdbc.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaJdbc.java @@ -19,6 +19,8 @@ import javax.swing.SpringLayout; import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc; import net.forwardfire.vasc.demo.tech.ui.TechUI; +import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel; +import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel; import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid; import org.eobjects.metamodel.DataContext; @@ -89,9 +91,11 @@ public class JDialogMetaJdbc extends JDialog implements ActionListener { ds.setPassword(passwordField.getText()); DataContext metaDs = ds.getDataContext(); String dbName = url.substring(url.lastIndexOf('/')+1,url.length()); + VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController()); for (String table:metaDs.getDefaultSchema().getTableNames()) { - TechUI.getInstance().getVascManager().createMetaEntry(ds,dbName+"_"+table,table); + schema.createMetaEntry(ds,dbName+"_"+table,table); } + ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree(); } }); result.add(fileButton); diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaMongodb.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaMongodb.java index a33fea0..1e46524 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaMongodb.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/actions/JDialogMetaMongodb.java @@ -18,6 +18,8 @@ import javax.swing.SpringLayout; import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb; import net.forwardfire.vasc.demo.tech.ui.TechUI; +import net.forwardfire.vasc.demo.tech.ui.VascAutoSchemaMetaModel; +import net.forwardfire.vasc.demo.tech.ui.components.JMainPanel; import net.forwardfire.vasc.demo.tech.ui.components.SpringLayoutGrid; import org.eobjects.metamodel.DataContext; @@ -78,9 +80,11 @@ public class JDialogMetaMongodb extends JDialog implements ActionListener { ds.setPort(new Integer(hostPortField.getText())); ds.setDatabase(databaseField.getText()); DataContext metaDs = ds.getDataContext(); + VascAutoSchemaMetaModel schema = new VascAutoSchemaMetaModel(TechUI.getInstance().getVascManager().getVascController()); for (String table:metaDs.getDefaultSchema().getTableNames()) { - TechUI.getInstance().getVascManager().createMetaEntry(ds,ds.getDatabase()+"_"+table,table); + schema.createMetaEntry(ds,ds.getDatabase()+"_"+table,table); } + ((JMainPanel)TechUI.getInstance().getMainView().getComponent()).rebuildTree(); } }); result.add(fileButton); diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/components/JMainPanel.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/components/JMainPanel.java index 3b88626..e2f7fc1 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/components/JMainPanel.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/java/net/forwardfire/vasc/demo/tech/ui/components/JMainPanel.java @@ -53,10 +53,10 @@ import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeNode; import net.forwardfire.vasc.core.VascEntry; +import net.forwardfire.vasc.demo.tech.core.DemoVascManager; import net.forwardfire.vasc.demo.tech.ui.TechUI; -import net.forwardfire.vasc.demo.tech.ui.VascManager; -import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration; -import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed; +import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration; +import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed; import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle_en; import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys; @@ -64,7 +64,7 @@ import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys; public class JMainPanel extends JPanel { private static final long serialVersionUID = 5834715323973411147L; - private VascManager vascManager = null; + private DemoVascManager vascManager = null; private SwingPanelIntegration spi = null; private JTabbedPane tabPane = null; private JTree vascTree = null; diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/resources/net/forwardfire/vasc/demo/tech/ui/resources/TechUI.properties b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/resources/net/forwardfire/vasc/demo/tech/ui/resources/TechUI.properties index 587508e..bedfa36 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/resources/net/forwardfire/vasc/demo/tech/ui/resources/TechUI.properties +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-ui/src/main/resources/net/forwardfire/vasc/demo/tech/ui/resources/TechUI.properties @@ -76,10 +76,6 @@ vasc.validator.VascStringZipCodeValidator=Value must be a valid post code. # Vasc actions labels vasc.action.addRowAction.description = add a new record vasc.action.addRowAction.name = Add -vasc.action.csvExportAction.description = CSV -vasc.action.csvExportAction.name = CSV -vasc.action.xmlExportAction.description = XML -vasc.action.xmlExportAction.name = XML vasc.action.deleteRowAction.description = delete vasc.action.deleteRowAction.name = delete vasc.action.downloadAction.description = Select this record. @@ -87,6 +83,26 @@ vasc.action.downloadAction.name = Select vasc.action.editRowAction.description = edit vasc.action.editRowAction.name = Edit +vasc.action.csvExportAction.description = CSV +vasc.action.csvExportAction.name = CSV +vasc.action.xmlExportAction.description = XML +vasc.action.xmlExportAction.name = XML +vasc.action.xmltreeExportAction.description = XMLTree +vasc.action.xmltreeExportAction.name = XMLTree +vasc.action.jrPdfLandscapeExportAction.description = jrPdfLandscape +vasc.action.jrPdfLandscapeExportAction.name = PDF-Landscape +vasc.action.jrPdfPortraitExportAction.description = jrPdfPortrait +vasc.action.jrPdfPortraitExportAction.name = PDF-Portrait +vasc.action.jrRtfExportAction.description = RTF +vasc.action.jrRtfExportAction.name = RTF +vasc.action.jrXlsExportAction.description = XLS +vasc.action.jrXlsExportAction.name = XLS +vasc.action.jrXmlExportAction.description = JR-XML +vasc.action.jrXmlExportAction.name = JR-XML +vasc.action.jrCsvExportAction.description = JR-CSV +vasc.action.jrCsvExportAction.name = JR-CSV + + # Temp jsf generic.vasc.jsf.listOption.header = Searchoptions generic.vasc.jsf.listOption.search = Searh\: @@ -116,3 +132,6 @@ generic.vasc.jsf.action.cancel = Cancel generic.vasc.jsf.action.back = Back generic.vasc.jsf.parentSelected = Selected: +vasc.dialog.edit.message = Edit +vasc.dialog.save.name = Save +vasc.dialog.cancel.name = Cancel \ No newline at end of file diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/pom.xml b/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/pom.xml index 3084111..5cfc35c 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/pom.xml +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/pom.xml @@ -18,6 +18,12 @@ ${project.version} provided + + net.forwardfire.vasc.demo + vasc-demo-tech-core + ${project.version} + provided + diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/java/net/forwardfire/vasc/demo/tech/web/beans/VascFacesController.java b/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/java/net/forwardfire/vasc/demo/tech/web/beans/VascFacesController.java index 7a6c83c..7219962 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/java/net/forwardfire/vasc/demo/tech/web/beans/VascFacesController.java +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/java/net/forwardfire/vasc/demo/tech/web/beans/VascFacesController.java @@ -31,12 +31,12 @@ import javax.faces.context.FacesContext; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; +import net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.frontends.web.jsf.AbstractJSFVascFacesControllerBase; +import net.forwardfire.vasc.frontend.web.jsf.AbstractJSFVascFacesControllerBase; import net.forwardfire.vasc.impl.DefaultVascFactory; - /** * * @author Willem Cazander @@ -77,20 +77,8 @@ public class VascFacesController extends AbstractJSFVascFacesControllerBase { @Override public VascController getVascController() { - - // TODO: rm this by making common tech vasc package ? - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) { - cl = this.getClass().getClassLoader(); // fallback - } - Class clazz = cl.loadClass("net.forwardfire.vasc.demo.tech.ui.TechUI"); - Object instance = clazz.getMethod("getInstance").invoke(null); - Object vasc = clazz.getMethod("getVascController").invoke(instance); - return (VascController)vasc; - } catch (Exception e) { - throw new RuntimeException(e); - } + DemoVascControllerProvider provider = new DemoVascControllerProvider(); + return provider.getVascController(); } } \ No newline at end of file diff --git a/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/webapp/WEB-INF/web.xml b/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/webapp/WEB-INF/web.xml index b914b7c..15e698a 100644 --- a/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/webapp/WEB-INF/web.xml +++ b/vasc-demo/vasc-demo-tech/vasc-demo-tech-web/src/main/webapp/WEB-INF/web.xml @@ -95,7 +95,7 @@ User Filter userFilter - net.forwardfire.logstats.web.filters.UserFilter + net.forwardfire.vasc.demo.tech.web.filters.UserFilter @@ -130,12 +130,7 @@ facelets.DEVELOPMENT true - + com.sun.faces.config.ConfigureListener @@ -184,7 +179,7 @@ VASC Filter vascFilter - net.forwardfire.vasc.frontends.web.jsf.VascRequestFacesFilter + net.forwardfire.vasc.frontend.web.jsf.VascRequestFacesFilter templateFile /jsp/includes/vasc-template.jsf @@ -201,4 +196,50 @@ REQUEST + + + vascExportServlet + net.forwardfire.vasc.frontend.web.export.VascExportServlet + + vascControllerProvider + net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider + + + + vascExportServlet + /export + + + + + vascExportServletTree + net.forwardfire.vasc.frontend.web.export.VascExportServlet + + vascControllerProvider + net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider + + + exportTree + true + + + + vascExportServletTree + /export-tree/* + + + + + vascCXFServlet + net.forwardfire.vasc.frontend.cxf.server.web.VascCXFServlet + + vascControllerProvider + net.forwardfire.vasc.demo.tech.core.DemoVascControllerProvider + + + + vascCXFServlet + /cxf/* + + diff --git a/vasc-frontend/pom.xml b/vasc-frontend/pom.xml index 21cba7a..ad911fd 100644 --- a/vasc-frontend/pom.xml +++ b/vasc-frontend/pom.xml @@ -14,5 +14,7 @@ vasc-frontend-swing vasc-frontend-swt vasc-frontend-web-jsf + vasc-frontend-web-export + vasc-frontend-cxf \ No newline at end of file diff --git a/vasc-frontend/vasc-frontend-cxf/.project b/vasc-frontend/vasc-frontend-cxf/.project new file mode 100644 index 0000000..cfdf2d3 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/.project @@ -0,0 +1,17 @@ + + + vasc-frontend-cxf + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-frontend/vasc-frontend-cxf/pom.xml b/vasc-frontend/vasc-frontend-cxf/pom.xml new file mode 100644 index 0000000..807b266 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/pom.xml @@ -0,0 +1,17 @@ + + 4.0.0 + + vasc-frontend + net.forwardfire.vasc + 0.3.5-SNAPSHOT + .. + + vasc-frontend-cxf + pom + vasc-frontend-cxf + vasc-frontend-cxf + + vasc-frontend-cxf-client + vasc-frontend-cxf-server + + \ No newline at end of file diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/.project b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/.project new file mode 100644 index 0000000..87db1ec --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/.project @@ -0,0 +1,23 @@ + + + vasc-frontend-cxf-client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/pom.xml b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/pom.xml new file mode 100644 index 0000000..421bea2 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + + vasc-frontend-cxf + net.forwardfire.vasc + 0.3.5-SNAPSHOT + .. + + vasc-frontend-cxf-client + vasc-frontend-cxf-client + vasc-frontend-cxf-client + + + javax.jws + jsr181-api + 1.0-MR1 + + + \ No newline at end of file diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/src/main/java/net/forwardfire/vasc/frontend/cxf/client/VascEntryService.java b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/src/main/java/net/forwardfire/vasc/frontend/cxf/client/VascEntryService.java new file mode 100644 index 0000000..804018f --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-client/src/main/java/net/forwardfire/vasc/frontend/cxf/client/VascEntryService.java @@ -0,0 +1,10 @@ +package net.forwardfire.vasc.frontend.cxf.client; + +import javax.jws.WebService; + + +@WebService +public interface VascEntryService { + + public String testHi(String response); +} diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/.project b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/.project new file mode 100644 index 0000000..ecbea21 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/.project @@ -0,0 +1,23 @@ + + + vasc-frontend-cxf-server + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/pom.xml b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/pom.xml new file mode 100644 index 0000000..51eaec9 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + + vasc-frontend-cxf + net.forwardfire.vasc + 0.3.5-SNAPSHOT + .. + + vasc-frontend-cxf-server + vasc-frontend-cxf-server + vasc-frontend-cxf-server + + + net.forwardfire.vasc + vasc-core + ${project.version} + + + net.forwardfire.vasc + vasc-frontend-cxf-client + ${project.version} + + + org.apache.cxf + cxf-rt-transports-http + 2.6.0 + + + org.apache.cxf + cxf-rt-databinding-jaxb + 2.6.0 + + + org.apache.cxf + cxf-rt-frontend-jaxws + 2.6.0 + + + org.apache.cxf + cxf-rt-frontend-jaxrs + 2.6.0 + + + javax.servlet + servlet-api + 2.5 + jar + provided + + + \ No newline at end of file diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/VascEntryServiceImpl.java b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/VascEntryServiceImpl.java new file mode 100644 index 0000000..912b936 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/VascEntryServiceImpl.java @@ -0,0 +1,10 @@ +package net.forwardfire.vasc.frontend.cxf.server; + +import net.forwardfire.vasc.frontend.cxf.client.VascEntryService; + +public class VascEntryServiceImpl implements VascEntryService { + + public String testHi(String response) { + return "HOHO: "+response+" HAAHA.."; + } +} diff --git a/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/web/VascCXFServlet.java b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/web/VascCXFServlet.java new file mode 100644 index 0000000..81d6a57 --- /dev/null +++ b/vasc-frontend/vasc-frontend-cxf/vasc-frontend-cxf-server/src/main/java/net/forwardfire/vasc/frontend/cxf/server/web/VascCXFServlet.java @@ -0,0 +1,89 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.frontend.cxf.server.web; + +import java.util.logging.Logger; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +import net.forwardfire.vasc.core.VascControllerProvider; +import net.forwardfire.vasc.frontend.cxf.server.VascEntryServiceImpl; + +import javax.xml.ws.Endpoint; + +import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; +import org.apache.cxf.transport.servlet.CXFNonSpringServlet; + +/** + * VascCXFServlet exports the entries via webservices + * + * @author Willem Cazander + * @version 1.0 May 12, 2012 + */ +public class VascCXFServlet extends CXFNonSpringServlet { + + private Logger logger = Logger.getLogger(VascCXFServlet.class.getName()); + private static final long serialVersionUID = 8125039180724973858L; + private VascControllerProvider vascControllerProvider = null; + private boolean exportTree = false; + + /** + * @see org.apache.cxf.transport.servlet.CXFNonSpringServlet#init(javax.servlet.ServletConfig) + */ + @Override + public void init(ServletConfig sc) throws ServletException { + + String className = getInitParameter("vascControllerProvider"); + if (className==null) { + throw new ServletException("Can't start with null vascControllerProvider init parameter."); + } + String exportTreeStr = getInitParameter("exportTree"); + if (exportTreeStr!=null && "true".equalsIgnoreCase(exportTreeStr)) { + exportTree = true; + } + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) { + cl = className.getClass().getClassLoader(); + } + Class clazz = cl.loadClass(className); + vascControllerProvider = (VascControllerProvider)clazz.newInstance(); + } catch (Exception e) { + throw new ServletException("Could not create VascControllerProvider: "+e.getMessage(),e); + } + super.init(sc); // runs loadBus + logger.info("CXF Servlet started. (exportTree: "+exportTree+")"); + } + + @Override + public void loadBus(ServletConfig servletConfig) { + super.loadBus(servletConfig); + Bus bus = getBus(); + BusFactory.setDefaultBus(bus); + + + Endpoint.publish("/foobar", new VascEntryServiceImpl()); + } +} diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingActionPanel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java similarity index 96% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingActionPanel.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java index 162e83a..2a6b248 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingActionPanel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import java.awt.Component; import java.awt.event.ActionEvent; @@ -263,15 +263,8 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi empty.setName("..."); gotoDownload.addItem(empty); - for (GlobalVascAction a:entry.getGlobalActions()) { - if (a.getId().contains("xport")) { - //s = new SelectItem(); - //s.setLabel(i18nMap.get(a.getName())); - //s.setDescription(i18nMap.get(a.getDescription())); - //s.setValue(a.getId()); - //result.add(s); - gotoDownload.addItem(a); - } + for (GlobalVascAction a:entry.getExportActions()) { + gotoDownload.addItem(a); } diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPagerPanel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java similarity index 99% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPagerPanel.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java index e70216e..29fbb86 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPagerPanel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import java.awt.Component; import java.awt.event.ActionEvent; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelFrame.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelFrame.java similarity index 99% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelFrame.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelFrame.java index eb7d826..94daf7d 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelFrame.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelFrame.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelIntegration.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelIntegration.java similarity index 91% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelIntegration.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelIntegration.java index 6826961..ac0dbbd 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelIntegration.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelIntegration.java @@ -1,4 +1,4 @@ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import javax.swing.JPanel; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelTabbed.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelTabbed.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelTabbed.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelTabbed.java index d055d9d..100e880 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingPanelTabbed.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPanelTabbed.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import javax.swing.JPanel; import javax.swing.JTabbedPane; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascEditDialog.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java similarity index 99% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascEditDialog.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java index d75e661..8bda714 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascEditDialog.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import java.awt.BorderLayout; import java.awt.FlowLayout; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascFrontend.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascFrontend.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java index 2edf646..a69bbc7 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascFrontend.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import java.awt.BorderLayout; import java.awt.Component; @@ -71,14 +71,14 @@ import net.forwardfire.vasc.core.ui.VascValueModel; import net.forwardfire.vasc.frontend.AbstractVascFrontend; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.frontends.swing.ui.SwingBoolean; -import net.forwardfire.vasc.frontends.swing.ui.SwingButton; -import net.forwardfire.vasc.frontends.swing.ui.SwingColorChooser; -import net.forwardfire.vasc.frontends.swing.ui.SwingDate; -import net.forwardfire.vasc.frontends.swing.ui.SwingLabel; -import net.forwardfire.vasc.frontends.swing.ui.SwingList; -import net.forwardfire.vasc.frontends.swing.ui.SwingText; -import net.forwardfire.vasc.frontends.swing.ui.SwingTextArea; +import net.forwardfire.vasc.frontend.swing.ui.SwingBoolean; +import net.forwardfire.vasc.frontend.swing.ui.SwingButton; +import net.forwardfire.vasc.frontend.swing.ui.SwingColorChooser; +import net.forwardfire.vasc.frontend.swing.ui.SwingDate; +import net.forwardfire.vasc.frontend.swing.ui.SwingLabel; +import net.forwardfire.vasc.frontend.swing.ui.SwingList; +import net.forwardfire.vasc.frontend.swing.ui.SwingText; +import net.forwardfire.vasc.frontend.swing.ui.SwingTextArea; /** * SwingVascFrontend renders vasc entries in a swing panel. diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascTableModel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascTableModel.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java index 39a0d08..8df677c 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/SwingVascTableModel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing; +package net.forwardfire.vasc.frontend.swing; import java.util.ArrayList; import java.util.List; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingBoolean.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingBoolean.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingBoolean.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingBoolean.java index 9d266ba..6f09cc0 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingBoolean.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingBoolean.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; import java.awt.event.ActionEvent; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingButton.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingButton.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingButton.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingButton.java index bd64081..e870d97 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingButton.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingButton.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingColorChooser.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingColorChooser.java similarity index 99% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingColorChooser.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingColorChooser.java index 2177180..1584327 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingColorChooser.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingColorChooser.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; import java.awt.event.ActionEvent; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingDate.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingDate.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingDate.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingDate.java index 600fc89..635870d 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingDate.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingDate.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; import java.awt.event.ActionEvent; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingLabel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingLabel.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingLabel.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingLabel.java index 4803b37..50164ec 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingLabel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingLabel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingList.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingList.java similarity index 99% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingList.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingList.java index a9c41b7..f153590 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingList.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingList.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; import java.awt.Component; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingText.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingText.java similarity index 98% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingText.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingText.java index 3688241..65697ae 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingText.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingText.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingTextArea.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingTextArea.java similarity index 99% rename from vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingTextArea.java rename to vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingTextArea.java index eafd34d..18051c5 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontends/swing/ui/SwingTextArea.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/ui/SwingTextArea.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swing.ui; +package net.forwardfire.vasc.frontend.swing.ui; import java.awt.Color; diff --git a/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTest.java b/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTest.java index e19d60b..ae1da53 100644 --- a/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTest.java +++ b/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTest.java @@ -25,8 +25,8 @@ package net.forwardfire.vasc; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryControllerLocal; -import net.forwardfire.vasc.frontends.swing.SwingPanelFrame; -import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration; +import net.forwardfire.vasc.frontend.swing.SwingPanelFrame; +import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration; import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.test.frontend.data.TestModelData; diff --git a/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTestTabbed.java b/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTestTabbed.java index 926b75a..c696e37 100644 --- a/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTestTabbed.java +++ b/vasc-frontend/vasc-frontend-swing/src/test/java/net/forwardfire/vasc/SwingTestTabbed.java @@ -35,8 +35,8 @@ import javax.swing.JTabbedPane; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryControllerLocal; -import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration; -import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed; +import net.forwardfire.vasc.frontend.swing.SwingPanelIntegration; +import net.forwardfire.vasc.frontend.swing.SwingPanelTabbed; import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.test.frontend.data.TestModelData; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtActionPanel.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java similarity index 97% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtActionPanel.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java index 88d6d3c..550c259 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtActionPanel.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt; +package net.forwardfire.vasc.frontend.swt; import java.util.List; @@ -102,10 +102,8 @@ public class SwtActionPanel implements VascEntryFrontendEventListener { l.setText("Download: "); downloadBox = new Combo(actionRow,SWT.SINGLE | SWT.BORDER); downloadBox.add("..."); - for (GlobalVascAction a:entry.getGlobalActions()) { - if (a.getId().contains("xport")) { - downloadBox.add(a.getName()); - } + for (GlobalVascAction a:entry.getExportActions()) { + downloadBox.add(a.getName()); } downloadBox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtPagerPanel.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java similarity index 98% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtPagerPanel.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java index 666f9d0..5640abf 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtPagerPanel.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt; +package net.forwardfire.vasc.frontend.swt; import java.util.List; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtVascEditDialog.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java similarity index 99% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtVascEditDialog.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java index 6973846..f4846d4 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtVascEditDialog.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt; +package net.forwardfire.vasc.frontend.swt; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtVascFrontend.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java similarity index 98% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtVascFrontend.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java index 44917c5..5fc5504 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/SwtVascFrontend.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt; +package net.forwardfire.vasc.frontend.swt; import java.io.FileOutputStream; import java.io.OutputStream; @@ -40,12 +40,12 @@ import net.forwardfire.vasc.core.ui.VascValueModel; import net.forwardfire.vasc.core.ui.VascValueModelListener; import net.forwardfire.vasc.frontend.AbstractVascFrontend; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.frontends.swt.ui.SwtBoolean; -import net.forwardfire.vasc.frontends.swt.ui.SwtButton; -import net.forwardfire.vasc.frontends.swt.ui.SwtLabel; -import net.forwardfire.vasc.frontends.swt.ui.SwtList; -import net.forwardfire.vasc.frontends.swt.ui.SwtText; -import net.forwardfire.vasc.frontends.swt.ui.SwtTextArea; +import net.forwardfire.vasc.frontend.swt.ui.SwtBoolean; +import net.forwardfire.vasc.frontend.swt.ui.SwtButton; +import net.forwardfire.vasc.frontend.swt.ui.SwtLabel; +import net.forwardfire.vasc.frontend.swt.ui.SwtList; +import net.forwardfire.vasc.frontend.swt.ui.SwtText; +import net.forwardfire.vasc.frontend.swt.ui.SwtTextArea; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.IStructuredContentProvider; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtBoolean.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtBoolean.java similarity index 98% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtBoolean.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtBoolean.java index 38f6276..c0270c6 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtBoolean.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtBoolean.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt.ui; +package net.forwardfire.vasc.frontend.swt.ui; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtButton.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtButton.java similarity index 98% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtButton.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtButton.java index cc80f59..70aaf6d 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtButton.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtButton.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt.ui; +package net.forwardfire.vasc.frontend.swt.ui; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtLabel.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtLabel.java similarity index 98% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtLabel.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtLabel.java index 0c18182..f2e28cf 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtLabel.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtLabel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt.ui; +package net.forwardfire.vasc.frontend.swt.ui; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtList.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtList.java similarity index 99% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtList.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtList.java index fb3db75..3ec8b47 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtList.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtList.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt.ui; +package net.forwardfire.vasc.frontend.swt.ui; import java.util.List; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtText.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtText.java similarity index 98% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtText.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtText.java index 3672e07..4d3185e 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtText.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtText.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt.ui; +package net.forwardfire.vasc.frontend.swt.ui; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtTextArea.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtTextArea.java similarity index 99% rename from vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtTextArea.java rename to vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtTextArea.java index a9ca1e8..8afbcc7 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontends/swt/ui/SwtTextArea.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/ui/SwtTextArea.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.swt.ui; +package net.forwardfire.vasc.frontend.swt.ui; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; diff --git a/vasc-frontend/vasc-frontend-swt/src/test/java/net/forwardfire/vasc/SWTTest.java b/vasc-frontend/vasc-frontend-swt/src/test/java/net/forwardfire/vasc/SWTTest.java index 3ecbb7b..5d5bf18 100644 --- a/vasc-frontend/vasc-frontend-swt/src/test/java/net/forwardfire/vasc/SWTTest.java +++ b/vasc-frontend/vasc-frontend-swt/src/test/java/net/forwardfire/vasc/SWTTest.java @@ -26,7 +26,7 @@ package net.forwardfire.vasc; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryControllerLocal; -import net.forwardfire.vasc.frontends.swt.SwtVascFrontend; +import net.forwardfire.vasc.frontend.swt.SwtVascFrontend; import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.test.frontend.data.TestModelData; diff --git a/vasc-frontend/vasc-frontend-web-export/.project b/vasc-frontend/vasc-frontend-web-export/.project new file mode 100644 index 0000000..be3ed8e --- /dev/null +++ b/vasc-frontend/vasc-frontend-web-export/.project @@ -0,0 +1,23 @@ + + + vasc-frontend-web-export + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-frontend/vasc-frontend-web-export/pom.xml b/vasc-frontend/vasc-frontend-web-export/pom.xml new file mode 100644 index 0000000..9acdc92 --- /dev/null +++ b/vasc-frontend/vasc-frontend-web-export/pom.xml @@ -0,0 +1,32 @@ + + 4.0.0 + + vasc-frontend + net.forwardfire.vasc + 0.3.5-SNAPSHOT + .. + + vasc-frontend-web-export + vasc-frontend-web-export + vasc-frontend-web-export + + + net.forwardfire.vasc + vasc-core + ${project.version} + + + net.forwardfire.vasc + vasc-ejb3 + ${project.version} + provided + + + javax.servlet + servlet-api + 2.5 + jar + provided + + + \ No newline at end of file diff --git a/vasc-frontend/vasc-frontend-web-export/src/main/java/net/forwardfire/vasc/frontend/web/export/VascExportServlet.java b/vasc-frontend/vasc-frontend-web-export/src/main/java/net/forwardfire/vasc/frontend/web/export/VascExportServlet.java new file mode 100644 index 0000000..4741a15 --- /dev/null +++ b/vasc-frontend/vasc-frontend-web-export/src/main/java/net/forwardfire/vasc/frontend/web/export/VascExportServlet.java @@ -0,0 +1,163 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.frontend.web.export; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Locale; +import java.util.logging.Logger; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import net.forwardfire.vasc.core.VascController; +import net.forwardfire.vasc.core.VascControllerProvider; +import net.forwardfire.vasc.core.VascEntry; +import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.core.entry.VascEntryExporter; + +/** + * VascExportServlet exports the data from the vasc exporters on fixed url. + * + * @author Willem Cazander + * @version 1.0 May 12, 2012 + */ +public class VascExportServlet extends HttpServlet { + + private Logger logger = Logger.getLogger(VascExportServlet.class.getName()); + private static final long serialVersionUID = 6165530418422144322L; + private VascControllerProvider vascControllerProvider = null; + private boolean exportTree = false; + + /** + * @see javax.servlet.GenericServlet#init() + */ + @Override + public void init() throws ServletException { + super.init(); + String className = getInitParameter("vascControllerProvider"); + if (className==null) { + throw new ServletException("Can't start with null vascControllerProvider init parameter."); + } + String exportTreeStr = getInitParameter("exportTree"); + if (exportTreeStr!=null && "true".equalsIgnoreCase(exportTreeStr)) { + exportTree = true; + } + try { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) { + cl = className.getClass().getClassLoader(); + } + Class clazz = cl.loadClass(className); + vascControllerProvider = (VascControllerProvider)clazz.newInstance(); + } catch (Exception e) { + throw new ServletException("Could not create VascControllerProvider: "+e.getMessage(),e); + } + logger.info("Export servlet started. (exportTree: "+exportTree+")"); + } + + /** + * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String method = request.getMethod(); + if (method.equals("GET")==false) { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Only GET allowed."); + return; + } + // Remove prefixes + String path = request.getRequestURI(); + String servlet = request.getServletPath(); + if (path.contains(servlet)) { + path = path.substring(path.indexOf(servlet)+servlet.length()); + } + if (path.startsWith("/")) { + path = path.substring(1); + } + + // stuff to fill + String entryId = null; + String exportId = null; + + if (exportTree) { + int index = path.indexOf("/"); + String actionString = null; + if (index>0) { + actionString = path.substring(index+1); + entryId = path.substring(0,index); + } else { + entryId = path; + } + + if (actionString!=null) { + index = actionString.indexOf("/"); + String recordString = null; + if (index>0) { + recordString = actionString.substring(index+1); + exportId = actionString.substring(0,index); + } else { + exportId = actionString; + } + if (recordString!=null) { + // actionRecordId = recordString; + } + } + } + + // tree overrules parameters. + if (entryId==null) { + entryId = request.getParameter("ve"); + } + if (exportId==null) { + exportId = request.getParameter("et"); + } + + //out = new PrintWriter(new OutputStreamWriter(response.getOutputStream(), response.getCharacterEncoding()), true); + OutputStream out = response.getOutputStream(); + try { + VascController vc = vascControllerProvider.getVascController(); + VascEntry ve = vc.getVascEntryConfigController().configVascEntry(vc, entryId); + vc.getVascEntryConfigController().configVascFrontendData(vc, ve, new Locale("en")); + + // Update total every time first + Long total = ve.getVascFrontendData().getVascEntryState().getVascBackend().fetchTotalExecuteSize(ve.getVascFrontendData().getVascEntryState().getVascBackendState()); + ve.getVascFrontendData().getVascEntryState().setTotalBackendRecords(total); + VascEntryExporter ex = vc.getVascEntryConfigController().getVascEntryExporterById(exportId); + + String filename = entryId+"-export."+ex.getFileType(); + response.setHeader("Content-disposition", "attachment; filename=" + filename); + String contentType = ex.getMineType(); + response.setContentType(contentType); + + ex.doExport(out, ve); + } catch (VascException e) { + response.setStatus(500); + response.setContentType("text/html"); + } + out.flush(); + out.close(); + } +} diff --git a/vasc-frontend/vasc-frontend-web-jsf/pom.xml b/vasc-frontend/vasc-frontend-web-jsf/pom.xml index 270d069..ec5121c 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/pom.xml +++ b/vasc-frontend/vasc-frontend-web-jsf/pom.xml @@ -5,9 +5,7 @@ net.forwardfire.vasc 0.3.5-SNAPSHOT - net.forwardfire.vasc vasc-frontend-web-jsf - 0.3.5-SNAPSHOT vasc-frontend-web-jsf vasc-frontend-web-jsf diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerBase.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java similarity index 98% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerBase.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java index 2358957..8759867 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerBase.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.util.List; import java.util.Map; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerEJB.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerEJB.java similarity index 95% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerEJB.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerEJB.java index 61638b4..f0c3fe0 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerEJB.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerEJB.java @@ -20,12 +20,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; -import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; @@ -47,13 +46,11 @@ import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryControllerLocal; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; -import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener; import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; import net.forwardfire.vasc.ejb3.VascServiceManager; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.impl.DefaultVascBackedEntryFinalizer; import net.forwardfire.vasc.impl.DefaultVascFactory; import net.forwardfire.vasc.impl.entry.DefaultVascEntryResourceResolver; import net.forwardfire.vasc.impl.entry.SetParameterBackendListener; @@ -386,18 +383,14 @@ abstract public class AbstractJSFVascFacesControllerEJB extends AbstractJSFVascF listener.setType(type); listener.setValue(paraTypeValue); - List listeners=new ArrayList(10); - listeners.add(listener); - vb = new VascBackendProxyEventExecutor(vb,ve,listeners); + VascBackendProxyEventExecutor localUserProxy = new VascBackendProxyEventExecutor(); + localUserProxy.addVascEntryBackendEventListener(listener); + vb = localUserProxy; } - - localBackendController.addVascBackend(vb); - - DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer(); - ve = f.finalizeVascEntry(ve,c); - - localEntryController.addVascEntry(ve, c); + localEntryController.addVascEntry(ve); + + c.getVascEntryConfigController().configVascEntry(c, ve); } vascController = c; return vascController; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerLocal.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerLocal.java similarity index 99% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerLocal.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerLocal.java index da0dfca..2a4b0fb 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/AbstractJSFVascFacesControllerLocal.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerLocal.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.util.Collections; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascEntryEventListener.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java similarity index 98% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascEntryEventListener.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java index f696aa3..0947db3 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascEntryEventListener.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.util.ArrayList; import java.util.List; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascEntrySupportBean.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java similarity index 98% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascEntrySupportBean.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java index 8ac541d..ff76ecd 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascEntrySupportBean.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.Serializable; @@ -214,14 +214,12 @@ public class JSFVascEntrySupportBean implements Serializable { s.setValue("null"); result.add(s); - for (GlobalVascAction a:entry.getGlobalActions()) { - if (a.getId().contains("xport")) { - s = new SelectItem(); - s.setLabel(i18nMap.get(a.getName())); - s.setDescription(i18nMap.get(a.getDescription())); - s.setValue(a.getId()); - result.add(s); - } + for (GlobalVascAction a:entry.getExportActions()) { + s = new SelectItem(); + s.setLabel(i18nMap.get(a.getName())); + s.setDescription(i18nMap.get(a.getDescription())); + s.setValue(a.getId()); + result.add(s); } return result; } @@ -744,7 +742,7 @@ public class JSFVascEntrySupportBean implements Serializable { logger.fine("exportDownloadAction id: "+id); - GlobalVascAction action = entry.getGlobalActionById(id); + GlobalVascAction action = entry.getExportActionById(id); try { action.doGlobalAction(entry); } catch (Exception e) { @@ -765,7 +763,7 @@ public class JSFVascEntrySupportBean implements Serializable { try { HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse(); - String filename = "export-list."+ex.getType(); + String filename = "export-list."+ex.getFileType(); response.setHeader("Content-disposition", "attachment; filename=" + filename); String contentType = ex.getMineType(); response.setContentType(contentType); diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascFrontendRenderer.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascFrontendRenderer.java similarity index 94% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascFrontendRenderer.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascFrontendRenderer.java index 67a8fb1..77bb88b 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascFrontendRenderer.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascFrontendRenderer.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.Serializable; import java.util.logging.Logger; @@ -31,11 +31,11 @@ import javax.faces.context.FacesContext; import net.forwardfire.vasc.core.entry.VascEntryExporter; import net.forwardfire.vasc.frontend.AbstractVascFrontend; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFBoolean; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFLabel; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFList; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFText; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFTextArea; +import net.forwardfire.vasc.frontend.web.jsf.ui.JSFBoolean; +import net.forwardfire.vasc.frontend.web.jsf.ui.JSFLabel; +import net.forwardfire.vasc.frontend.web.jsf.ui.JSFList; +import net.forwardfire.vasc.frontend.web.jsf.ui.JSFText; +import net.forwardfire.vasc.frontend.web.jsf.ui.JSFTextArea; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponent.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java similarity index 97% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponent.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java index 45878a0..e6845ca 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponent.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.IOException; import java.util.ArrayList; @@ -33,7 +33,6 @@ import javax.faces.component.UIComponent; import javax.faces.component.UIComponentBase; import javax.faces.context.FacesContext; -import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; @@ -43,11 +42,9 @@ import net.forwardfire.vasc.core.VascLinkEntry; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType; import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFListModel; +import net.forwardfire.vasc.frontend.web.jsf.ui.JSFListModel; import net.forwardfire.vasc.impl.DefaultVascFactory; - - /** * Renders an JSF vasc entry views. * @@ -340,17 +337,13 @@ public class JSFVascUIComponent extends UIComponentBase { throw new NullPointerException("Could not locate '"+entryName+"' from : "+vascController); } frontendData.setVascFrontend(null); // reset data obj. todo rm this. - DefaultVascFactory.fillVascEntryFrontend(entry, vascController, frontendData); try { + DefaultVascFactory.fillVascEntryFrontend(entry, vascController, frontendData); frontendData.initFrontendListeners(entry,"jsf"); - } catch (InstantiationException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + } catch (Exception e1) { + throw new RuntimeException(e1); + } if (state!=null) { // copy prevois parent diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponentRenderer.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponentRenderer.java similarity index 99% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponentRenderer.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponentRenderer.java index f26767a..1d2922b 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponentRenderer.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponentRenderer.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.IOException; import java.io.Serializable; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponentTag.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponentTag.java similarity index 99% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponentTag.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponentTag.java index da14d8a..483b156 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascUIComponentTag.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponentTag.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import javax.el.ValueExpression; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascValidatePhaseListener.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascValidatePhaseListener.java similarity index 96% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascValidatePhaseListener.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascValidatePhaseListener.java index 2dda986..09d139f 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/JSFVascValidatePhaseListener.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascValidatePhaseListener.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.util.Iterator; import java.util.Map; @@ -37,7 +37,7 @@ import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponentRenderer.VascJSFInputValidator2; +import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponentRenderer.VascJSFInputValidator2; /** diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascDataBackendBean.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java similarity index 99% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascDataBackendBean.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java index 2814ea8..5adb38c 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascDataBackendBean.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.Serializable; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascRequestFacesFilter.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascRequestFacesFilter.java similarity index 99% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascRequestFacesFilter.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascRequestFacesFilter.java index 5f1dd7b..4f13c43 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascRequestFacesFilter.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascRequestFacesFilter.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.IOException; import java.util.Locale; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascViewHandler.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascViewHandler.java similarity index 98% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascViewHandler.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascViewHandler.java index 22123bb..d461a88 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/VascViewHandler.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascViewHandler.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf; +package net.forwardfire.vasc.frontend.web.jsf; import java.io.IOException; import java.util.Locale; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/AbstractJSFBaseComponent.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/AbstractJSFBaseComponent.java similarity index 95% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/AbstractJSFBaseComponent.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/AbstractJSFBaseComponent.java index 5a02dd0..d6c7b97 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/AbstractJSFBaseComponent.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/AbstractJSFBaseComponent.java @@ -20,13 +20,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import net.forwardfire.vasc.core.ui.VascUIComponent; -import net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponent; +import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFBoolean.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFBoolean.java similarity index 96% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFBoolean.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFBoolean.java index 599eda0..a63aa2b 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFBoolean.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFBoolean.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import javax.faces.application.Application; import javax.faces.component.UIComponent; @@ -32,7 +32,7 @@ import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.ui.VascValueModel; -import net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponent; +import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFLabel.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFLabel.java similarity index 98% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFLabel.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFLabel.java index fab71b2..2a7ca8c 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFLabel.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFLabel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import javax.faces.application.Application; import javax.faces.component.UIComponent; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFList.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFList.java similarity index 98% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFList.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFList.java index add6ee8..a1f1e76 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFList.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFList.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import java.io.Serializable; import java.util.List; @@ -40,7 +40,7 @@ import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.ui.VascSelectItem; import net.forwardfire.vasc.core.ui.VascValueModel; -import net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponent; +import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFListModel.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFListModel.java similarity index 99% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFListModel.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFListModel.java index 3b605a5..dbaed57 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFListModel.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFListModel.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import java.io.Serializable; import java.util.ArrayList; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFText.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFText.java similarity index 97% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFText.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFText.java index d96dbed..d1423da 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFText.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFText.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import java.io.Serializable; @@ -36,7 +36,7 @@ import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.ui.VascValueModel; -import net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponent; +import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFTextArea.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFTextArea.java similarity index 96% rename from vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFTextArea.java rename to vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFTextArea.java index 222b8dc..2a4affa 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/ui/JSFTextArea.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/ui/JSFTextArea.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.frontends.web.jsf.ui; +package net.forwardfire.vasc.frontend.web.jsf.ui; import javax.faces.application.Application; import javax.faces.component.UIComponent; @@ -32,7 +32,7 @@ import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.ui.VascValueModel; -import net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponent; +import net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/OldVascUIComponent.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/OldVascUIComponent.java deleted file mode 100644 index 1d3da74..0000000 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontends/web/jsf/OldVascUIComponent.java +++ /dev/null @@ -1,1744 +0,0 @@ -/* - * Copyright 2007-2012 forwardfire.net All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of conditions and the - * following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and - * the following disclaimer in the documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package net.forwardfire.vasc.frontends.web.jsf; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.el.ValueExpression; -import javax.faces.application.Application; -import javax.faces.application.FacesMessage; -import javax.faces.component.UIColumn; -import javax.faces.component.UIComponent; -import javax.faces.component.UIComponentBase; -import javax.faces.component.UIInput; -import javax.faces.component.UIOutput; -import javax.faces.component.UIPanel; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlCommandButton; -import javax.faces.component.html.HtmlInputText; -import javax.faces.component.html.HtmlMessage; -import javax.faces.component.html.HtmlOutputText; -import javax.faces.component.html.HtmlDataTable; -import javax.faces.component.html.HtmlCommandLink; -import javax.faces.component.html.HtmlPanelGrid; -import javax.faces.component.html.HtmlPanelGroup; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; -import javax.faces.event.PhaseEvent; -import javax.faces.event.PhaseId; -import javax.faces.event.PhaseListener; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; - -import net.forwardfire.vasc.backend.VascBackend; -import net.forwardfire.vasc.backend.VascBackendFilter; -import net.forwardfire.vasc.backend.proxy.VascBackendProxyFilter; -import net.forwardfire.vasc.backend.proxy.VascBackendProxyPaged; -import net.forwardfire.vasc.backend.proxy.VascBackendProxySearch; -import net.forwardfire.vasc.backend.proxy.VascBackendProxySort; -import net.forwardfire.vasc.core.VascController; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; -import net.forwardfire.vasc.core.VascLinkEntry; -import net.forwardfire.vasc.core.actions.GlobalVascAction; -import net.forwardfire.vasc.core.actions.RowVascAction; -import net.forwardfire.vasc.core.entry.VascEntryExporter; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; -import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType; -import net.forwardfire.vasc.core.ui.VascOptionValueModelListener; -import net.forwardfire.vasc.core.ui.VascValueModel; -import net.forwardfire.vasc.frontend.AbstractVascFrontend; -import net.forwardfire.vasc.frontend.VascFrontendData; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFBoolean; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFLabel; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFList; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFText; -import net.forwardfire.vasc.frontends.web.jsf.ui.JSFTextArea; - - - -/** - * Only here for archive a bit, does not work anymore. - * - * Renders an JSF vasc entry views. - * - * This is a bit hacky because I'm not a JSF guro. - * - * @author Willem Cazander - * @version 1.0 Nov 16, 2008 - */ -public class OldVascUIComponent extends UIComponentBase { - - public static final String COMPONENT_TYPE = "net.forwardfire.vasc.frontends.web.jsf.VascUIComponent"; - private Object[] state = null; - private ValueExpression vascController = null; - private ValueExpression vascFrontendData = null; - private ValueExpression entryName = null; - private String viewId = null; - private String editId = null; - private String exportId = null; - private String deleteId = null; - private String entryNameRealId = null; - private boolean defaultRenderView = false; - private JSFFrontendRenderer renderer = null; - private DataModel tableDataModel = null; - private DataModel pagesDataModel = null; - private String selectedRecordName = "selectedRecord"; - public VascEntryExporter exporter = null; - public String entryNameOldId = null; - - public void resetViews() { - UIPanel panel = getPanel("viewId"); - panel.setRendered(false); - panel = getPanel("editId"); - panel.setRendered(false); - panel = getPanel("exportId"); - panel.setRendered(false); - panel = getPanel("deleteId"); - panel.setRendered(false); - } - - public UIPanel getPanel(String panel) { - if ("viewId".equals(panel)) { - return findUIPanel(viewId); - } - if ("editId".equals(panel)) { - return findUIPanel(editId); - } - if ("exportId".equals(panel)) { - return findUIPanel(exportId); - } - if ("deleteId".equals(panel)) { - return findUIPanel(deleteId); - } - throw new IllegalArgumentException("ID field unknow."); - } - - private UIPanel findUIPanel(String panelId) { - for (UIComponent c:this.getChildren()) { - if (panelId.equals(c.getId())) { - return (UIPanel)c; - } - } - return null; - } - - protected String i18n(String key,Object...params) { - VascEntry entry = getVascEntry(); - return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params); - } - - public VascEntry getVascEntry() { - return renderer.getVascEntry(); - } - - - public VascEntry createClonedVascEntry() { - if (vascController==null) { - throw new NullPointerException("vascController is not set."); - } - if (entryName==null) { - throw new NullPointerException("entryName is not set."); - } - String vascEntityName = null; - VascController vascControllerObj = null; - - if (vascController.isLiteralText()) { - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), vascController.getExpressionString(), VascController.class); - vascControllerObj = (VascController)ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - } else { - vascControllerObj = (VascController)vascController.getValue(FacesContext.getCurrentInstance().getELContext()); - } - - if (entryName.isLiteralText()) { - if (entryName.getExpressionString().startsWith("#") | entryName.getExpressionString().startsWith("$")) { - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), entryName.getExpressionString(), String.class); - String res = (String)ve3.getValue(FacesContext.getCurrentInstance().getELContext()); - vascEntityName = res; - } else { - vascEntityName = entryName.getExpressionString(); - } - } else { - vascEntityName = (String)entryName.getValue(FacesContext.getCurrentInstance().getELContext()); - } - - if (entryNameRealId!=null | "".equals(vascEntityName)) { - vascEntityName = entryNameRealId; - } - - VascEntry entry = vascControllerObj.getVascEntryController().getVascEntryById(vascEntityName); - if (entry==null) { - throw new NullPointerException("Could not locate '"+vascEntityName+"' from : "+vascControllerObj+" ("+entryName.getExpressionString()+")"); - } - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), vascFrontendData.getExpressionString(), VascFrontendData.class); - VascFrontendData frontendData = (VascFrontendData)ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - try { - frontendData.initFrontendListeners(entry,"jsf"); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - frontendData.setVascController(vascControllerObj); - entry.setVascFrontendData(frontendData); - - VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId()); - - for (VascBackendFilter filter:entry.getVascBackendFilters()) { - filter.initFilter(entry); - backend = new VascBackendProxyFilter(backend,entry,filter); - } - if (backend.isSearchable()==false) { - backend = new VascBackendProxySearch(backend,entry); - } - if (backend.isSortable()==false) { - backend = new VascBackendProxySort(backend,entry); - } - if (backend.isPageable()==false) { - backend = new VascBackendProxyPaged(backend,entry); - } - frontendData.getVascEntryState().setVascBackend(backend); - - entry.getVascFrontendData().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() { - private static final long serialVersionUID = 1L; - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ}; - return result; - } - public void vascEvent(VascEntry entry, Object dataNotUsed) { - List data = entry.getVascFrontendData().getVascEntryState().getEntryDataList(); - for (VascEntryField field:entry.getVascEntryFields()) { - if (field.getVascEntryFieldValue()==null) { - VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field); - field.setVascEntryFieldValue(v); - } - } - List result = new ArrayList(data.size()); - int index = 0; - for (Object o:data) { - VascDataBackendBean b = new VascDataBackendBean(entry,o,index); - result.add(b); - index++; - } - tableDataModel.setWrappedData(result); - pagesDataModel.setWrappedData(entry.getVascFrontendData().getVascFrontendPager().getTablePagesFromBackend()); - - // ui value - ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalPageResults']}", Integer.class); - ren3.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataList().size()); - ValueExpression ren4 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalResults']}", Integer.class); - ren4.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getVascEntryState().getTotalBackendRecords()); - } - }); - - return entry; - } - - static public OldVascUIComponent findVascParent(UIComponent comp) { - if (comp==null) { - return null; - } - if (comp instanceof OldVascUIComponent) { - return (OldVascUIComponent)comp; - } - return findVascParent(comp.getParent()); - } - - static public OldVascUIComponent findVascChild(UIComponent comp,String entryId) { - if (comp==null) { - return null; - } - //System.out.println("Checking object: "+comp); - if (comp instanceof OldVascUIComponent) { - OldVascUIComponent ui = (OldVascUIComponent)comp; - if (entryId.equals(ui.getVascEntry().getId())) { - return ui; - } - return null; // this is a other entry on this view - } - for (UIComponent c:comp.getChildren()) { - Object res = findVascChild(c,entryId); - if (res!=null) { - return (OldVascUIComponent)res; // found - } - } - return null; - } - - /** - * Finds component with the given id - */ - static public UIComponent findComponentById(UIComponent c, String id) { - if (id.equals(c.getId())) { - return c; - } - Iterator kids = c.getFacetsAndChildren(); - while (kids.hasNext()) { - UIComponent found = findComponentById(kids.next(), id); - if (found != null) { - return found; - } - } - return null; - } - - - @SuppressWarnings("unchecked") - public static void renderChildren2(FacesContext facesContext, UIComponent component) throws IOException { - if (component.getChildCount() <= 0) { - return; - } - for (Iterator it = component.getChildren().iterator(); it.hasNext(); ) { - UIComponent child = (UIComponent)it.next(); - renderChild2(facesContext, child); - } - } - public static void renderChild2(FacesContext facesContext, UIComponent child) throws IOException { - if (!child.isRendered()) { - return; - } - child.encodeBegin(facesContext); - if (child.getRendersChildren()) { - child.encodeChildren(facesContext); - } else { - renderChildren2(facesContext, child); - } - child.encodeEnd(facesContext); - } - - // ==== JSF Stuff - - public String getFamily () { - return COMPONENT_TYPE; - } - - public void restoreState(FacesContext context, Object stateObject) { - state = (Object[])stateObject; - vascController=(ValueExpression)state[0]; - entryName=(ValueExpression)state[1]; - viewId=(String)state[2]; - editId=(String)state[3]; - exportId=(String)state[4]; - deleteId=(String)state[5]; - entryNameRealId=(String)state[6]; - renderer=(JSFFrontendRenderer)state[7]; - tableDataModel=(DataModel)state[8]; - pagesDataModel=(DataModel)state[9]; - vascFrontendData=(ValueExpression)state[10]; - exporter=(VascEntryExporter)state[11]; - entryNameOldId=(String)state[12]; - } - - public Object saveState(FacesContext context) { - state = new Object[13]; - state[0]=vascController; - state[1]=entryName; - state[2]=viewId; - state[3]=editId; - state[4]=exportId; - state[5]=deleteId; - state[6]=entryNameRealId; - state[7]=renderer; - state[8]=tableDataModel; - state[9]=pagesDataModel; - state[10]=vascFrontendData; - state[11]=exporter; - state[12]=entryNameOldId; - return state; - } - - protected void init() { - if (renderer!=null) { - return; - } - VascEntry entry = createClonedVascEntry(); - try { - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['entryId']}", String.class); - ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getId()); - tableDataModel = new ListDataModel(); - pagesDataModel = new ListDataModel(); - - renderer = new JSFFrontendRenderer(); - renderer.initEntry(entry); - - viewId = createView(entry); - editId = createEdit(entry); - exportId = createExport(entry); - deleteId = createDelete(entry); - entryNameRealId = getVascEntry().getId(); - - resetViews(); - UIPanel panel = getPanel("viewId"); - panel.setRendered(true); - - defaultRenderView = true; - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - protected void initGoto(VascLinkEntry link) { - this.getChildren().clear(); - - if (link!=null) { - entryNameOldId = entryNameRealId; - entryNameRealId = link.getVascEntryId(); - } else { - // back to old id - entryNameRealId = entryNameOldId; - entryNameOldId = null; // removed back link. - } - - // reset some stuff - ValueExpression ve1 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']}", Boolean.class); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortField']}", String.class); - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.searchString}", String.class); - ve1.setValue(FacesContext.getCurrentInstance().getELContext(), null); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), null); - ve3.setValue(FacesContext.getCurrentInstance().getELContext(), null); - - try { - VascEntry entryOld = getVascEntry(); - VascEntry entry = createClonedVascEntry(); - - if (link!=null) { - Object selected = getSelectedTableObject(); - for (String parameterName:link.getEntryParameterFieldIdKeys()) { - String fieldId = link.getEntryParameterFieldId(parameterName); - VascEntryField v = entryOld.getVascEntryFieldById(fieldId); - Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected); - - // set data parameter on new vasc entry - entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue); - } - - for (String fieldId:link.getEntryCreateFieldValueKeys()) { - String selectedfieldId = link.getEntryParameterFieldId(fieldId); - Object selectedValue = selected; - if (selectedfieldId!=null) { - VascEntryField v = entryOld.getVascEntryFieldById(selectedfieldId); - selectedValue = v.getVascEntryFieldValue().getValue(v, selected); - } - - // create listener for new objects - entry.getVascFrontendData().addVascEntryFrontendEventListener(new CreateEntryFieldValuesListener(fieldId,selectedValue)); - } - } - - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['entryId']}", String.class); - ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getId()); - - renderer = new JSFFrontendRenderer(); - renderer.initEntry(entry); - - viewId = createView(entry); - editId = createEdit(entry); - exportId = createExport(entry); - deleteId = createDelete(entry); - entryNameRealId = getVascEntry().getId(); - - resetViews(); - UIPanel panel = getPanel("viewId"); - panel.setRendered(true); - - defaultRenderView = true; - } catch (Exception e) { - getVascEntry().getVascFrontendData().getVascFrontendHelper().handleException(getVascEntry(), e); - } - } - - class CreateEntryFieldValuesListener implements VascEntryFrontendEventListener { - private static final long serialVersionUID = 1L; - private String fieldId = null; - private Object value = null; - public CreateEntryFieldValuesListener(String fieldId,Object value) { - if (fieldId==null) { - throw new NullPointerException("fieldId may not be null"); - } - this.fieldId=fieldId; - this.value=value; - } - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE}; - return result; - } - public void vascEvent(VascEntry entry,Object data) { - VascEntryField field = entry.getVascEntryFieldById(fieldId); - try { - field.getVascEntryFieldValue().setValue(field, data, value); - } catch (VascException e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - public Object getSelectedTableObject() { - DataModel dm = tableDataModel; - Object selected = dm.getRowData(); - if (selected==null) { - return null; - } - VascDataBackendBean r = (VascDataBackendBean) selected; - return r.getRecord(); - } - - public VascDataBackendBean getSelectedTableBean() { - DataModel dm = tableDataModel; - Object selected = dm.getRowData(); - if (selected==null) { - return null; - } - VascDataBackendBean r = (VascDataBackendBean) selected; - return r; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @Override - public void encodeBegin(FacesContext context) throws IOException { - // all work done in encodeEnd() - } - - /** - * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext) - */ - @Override - public void encodeChildren(FacesContext arg0) throws IOException { - // all work done in encodeEnd() - } - - /** - * @see javax.faces.component.UIComponentBase#encodeEnd(javax.faces.context.FacesContext) - */ - @Override - public void encodeEnd(FacesContext context) throws IOException { - - //UIComponent deleteComponent = getFacet("deleteForm"); - //if (deleteComponent != null) { - // deleteComponent.encodeAll(context); - //} - - if (defaultRenderView) { - VascEntry entry = getVascEntry(); - JSFFrontendRenderer r = (JSFFrontendRenderer)entry.getVascFrontendData().getVascFrontend(); - if (r==null) { - return; - } - try { - r.renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - - context.getViewRoot().addPhaseListener(new VascValidatePhase()); - } - } - - class VascValidatePhase implements PhaseListener { - private static final long serialVersionUID = 1L; - public void afterPhase(PhaseEvent event) { - FacesContext context = event.getFacesContext(); - validateUIInput(context.getViewRoot(),context); - } - public void beforePhase(PhaseEvent event) { - } - public PhaseId getPhaseId() { - return PhaseId.PROCESS_VALIDATIONS; - } - private void validateUIInput(UIComponent component,FacesContext context) { - if (component instanceof UIInput) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(component); - if (comp==null) { - return; // non-vasc ui-input - } - VascEntry entry = comp.getVascEntry(); - if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) { - return; // we are not in edit mode. - } - UIInput in = (UIInput)component; - for (Validator v:in.getValidators()) { - if (v instanceof VascJSFInputValidator) { - VascJSFInputValidator validator = (VascJSFInputValidator)v; - try { - in.setValid(true); - //Object value = in.getValue(); - //System.out.println("Checking value: "+value); - validator.validatePhase(context, in, in.getValue()); - } catch (ValidatorException ve) { - //System.out.println("Error"); - in.setValid(false); - - // note: ve has the message already but this is the UIInput way - FacesMessage message; - String validatorMessageString = in.getValidatorMessage(); - if (null != validatorMessageString) { - message = new FacesMessage(FacesMessage.SEVERITY_ERROR,validatorMessageString,validatorMessageString); - message.setSeverity(FacesMessage.SEVERITY_ERROR); - } else { - message = ve.getFacesMessage(); - } - if (message != null) { - context.addMessage(in.getClientId(context), message); - } - } - } - } - } - for (UIComponent child:component.getChildren()) { - validateUIInput(child,context); - } - } - } - - - /** - * @return the vascController - */ - public ValueExpression getVascController() { - return vascController; - } - - /** - * @param vascController the vascController to set - */ - public void setVascController(ValueExpression vascController) { - this.vascController = vascController; - } - - /** - * @return the entryName - */ - public ValueExpression getEntryName() { - return entryName; - } - - /** - * @param entryName the entryName to set - */ - public void setEntryName(ValueExpression entryName) { - this.entryName = entryName; - } - - /** - * @return the vascFrontendData - */ - public ValueExpression getVascFrontendData() { - return vascFrontendData; - } - - /** - * @param vascFrontendData the vascFrontendData to set - */ - public void setVascFrontendData(ValueExpression vascFrontendData) { - this.vascFrontendData = vascFrontendData; - } - - /** - * @return the selectedRecordName - */ - public String getSelectedRecordName() { - return selectedRecordName; - } - - /** - * @param selectedRecordName the selectedRecordName to set - */ - public void setSelectedRecordName(String selectedRecordName) { - this.selectedRecordName = selectedRecordName; - } - - public String createDelete(VascEntry entry) throws Exception { - - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelDelete = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelDelete.setId(viewRoot.createUniqueId()); - - this.getFacetsAndChildren(); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelDelete.getChildren().add(title); - - //HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //br.setId(viewRoot.createUniqueId()); - //br.setValue("

"); - //br.setEscape(false); - //panelDelete.getChildren().add(br); - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getDeleteDescription())); - panelDelete.getChildren().add(header); - - HtmlOutputText br2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br2.setId(viewRoot.createUniqueId()); - br2.setValue("

"); - br2.setEscape(false); - panelDelete.getChildren().add(br2); - - HtmlOutputText text = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - text.setId(viewRoot.createUniqueId()); - panelDelete.getChildren().add(text); - int index = VascDataBackendBean.getIndexId(entry.getVascEntryFieldById(entry.getDisplayNameFieldId())); - ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected.field"+index+"}", Object.class); - text.setValueExpression("value", ve7); - - HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("
"); - br.setEscape(false); - panelDelete.getChildren().add(br); - - HtmlCommandButton save = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - save.setId(viewRoot.createUniqueId()); - save.addActionListener(new DeleteActionListener()); - save.setImmediate(true); - save.setValue("Delete"); - panelDelete.getChildren().add(save); - - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue(" "); - space.setEscape(false); - panelDelete.getChildren().add(space); - - HtmlCommandButton cancel = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - cancel.setId(viewRoot.createUniqueId()); - cancel.addActionListener(new BackActionListener()); - cancel.setImmediate(true); - cancel.setValue("Cancel"); - panelDelete.getChildren().add(cancel); - - this.getChildren().add(panelDelete); - return panelDelete.getId(); - } - - public String createEdit(VascEntry entry) throws Exception { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelEdit = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelEdit.setId(viewRoot.createUniqueId()); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelEdit.getChildren().add(title); - - //HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //br.setId(viewRoot.createUniqueId()); - //br.setValue("

"); - //br.setEscape(false); - //panelEdit.getChildren().add(br); - - /* - String displayFieldId = entry.getDisplayNameFieldId(); - VascEntryField dis = entry.getVascEntryFieldById(displayFieldId); - if (dis==null) { - throw new RuntimeException("Could not find: "+displayFieldId+" from: "+entry.getId()); - } - String name = null; - try { - Object bean = entry.getVascFrontendData().getEntryDataObject(); - name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean); - } catch (VascException e) { - throw new RuntimeException("Could not display value from "+entry.getId(),e); - }*/ - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setEscape(false); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getEditDescription())); - panelEdit.getChildren().add(header); - - HtmlOutputText br2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br2.setId(viewRoot.createUniqueId()); - br2.setValue("

"); - br2.setEscape(false); - panelEdit.getChildren().add(br2); - - HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - grid.setId(viewRoot.createUniqueId()); - grid.setColumns(3); - grid.setStyleClass("form"); - //grid.setHeaderClass("style_tableHeader1"); - //grid.setColumnClasses("style_tableDarkGray_dub, style_tableLightGray_dub, style_tableLightGray_dub"); - panelEdit.getChildren().add(grid); - - HtmlOutputText gridHeaderText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - gridHeaderText.setId(viewRoot.createUniqueId()); - gridHeaderText.setValue("Edit"); - //grid.getFacets().put("header", gridHeaderText); - - int column = 0; - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) { - continue; - } - - for (int i=0;i"); - br.setEscape(false); - panelEdit.getChildren().add(br); - - HtmlCommandButton save = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - save.setId(viewRoot.createUniqueId()); - save.addActionListener(new SaveActionListener()); - save.setValue("Save"); - panelEdit.getChildren().add(save); - - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue(" "); - space.setEscape(false); - panelEdit.getChildren().add(space); - - HtmlCommandButton cancel = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - cancel.setId(viewRoot.createUniqueId()); - cancel.addActionListener(new BackActionListener()); - cancel.setValue("Cancel"); - cancel.setImmediate(true); - panelEdit.getChildren().add(cancel); - - this.getChildren().add(panelEdit); - return panelEdit.getId(); - } - class VascJSFInputValidator implements Validator,Serializable { - private static final long serialVersionUID = -5715250529474737642L; - String fieldId = null; - public VascJSFInputValidator(String fieldId) { - this.fieldId=fieldId; - } - public void validate(FacesContext context, UIComponent component,Object object) throws ValidatorException { - // always oke, we are runned by phase listener - } - public void validatePhase(FacesContext context, UIComponent component,Object object) throws ValidatorException { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(component); - VascEntry entry = comp.getVascEntry(); - VascEntryField field = entry.getVascEntryFieldById(fieldId); - - // note we have to set the value to the vasc backend before we can run validation - int index = VascDataBackendBean.getIndexId(field); - ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected.field"+index+"}", Object.class); - ve7.setValue(FacesContext.getCurrentInstance().getELContext(), object); - - List errors = entry.getVascFrontendData().getVascFrontendHelper().validateObjectField(field); - //System.out.println("Validate: "+component+" errors: "+errors.size()+" value: "+object); - if (errors.isEmpty()) { - return; // no errors - } - - StringBuffer buf = new StringBuffer(200); - for (String err:errors) { - buf.append(err); - buf.append('\n'); - } - FacesMessage message = new FacesMessage(buf.toString()); - message.setSeverity(FacesMessage.SEVERITY_ERROR); - throw new ValidatorException(message); - } - } - - public String createExport(VascEntry entry) throws Exception { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelExport = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelExport.setId(viewRoot.createUniqueId()); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelExport.getChildren().add(title); - - HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("

"); - br.setEscape(false); - panelExport.getChildren().add(br); - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setEscape(false); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getListDescription())); - panelExport.getChildren().add(header); - - HtmlOutputText br2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br2.setId(viewRoot.createUniqueId()); - br2.setValue("

"); - br2.setEscape(false); - panelExport.getChildren().add(br2); - - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new BackActionListener()); - - - HtmlCommandLink linkExport = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkExport.setId(viewRoot.createUniqueId()); - linkExport.addActionListener(new ExportActionListener()); - linkExport.setValue("Download"); - linkExport.setImmediate(true); - panelExport.getChildren().add(linkExport); - - br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("

"); - br.setEscape(false); - panelExport.getChildren().add(br); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue("Back"); - - link.getChildren().add(out); - panelExport.getChildren().add(link); - - - - this.getChildren().add(panelExport); - return panelExport.getId(); - } - - @SuppressWarnings("serial") - class ExportActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - try { - VascEntryExporter ex = comp.exporter; - if (ex==null) { - // todo: should not happen ? - FacesContext fc = FacesContext.getCurrentInstance(); - fc.responseComplete(); - return; - } - - - FacesContext fc = FacesContext.getCurrentInstance(); - HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse(); - String filename = "export-list."+ex.getType(); - response.setHeader("Content-disposition", "attachment; filename=" + filename); - String contentType = ex.getMineType(); - response.setContentType(contentType); - ServletOutputStream out = response.getOutputStream(); - - - ex.doExport(out, entry); - out.close(); - - fc.responseComplete(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - - @SuppressWarnings("serial") - class BackActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class); - VascDataBackendBean editObject = (VascDataBackendBean) ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - if (editObject!=null) { - editObject.setRealValue(false); - } - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - @SuppressWarnings("serial") - class DeleteActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascFrontendActions().deleteObject(); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class SaveActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class); - VascDataBackendBean editObject = (VascDataBackendBean) ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(editObject.getRecord()); - - entry.getVascFrontendData().getVascFrontendActions().mergeObject(); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class PageLinkActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - Integer pageIndex = (Integer)((HtmlCommandLink)event.getComponent()).getValue(); - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - entry.getVascFrontendData().getVascFrontendActions().pageAction(pageIndex); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class SortActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - String fieldIdString = ((HtmlCommandLink)event.getComponent()).getType(); - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - VascEntryField field = entry.getVascEntryFieldById(fieldIdString); - - entry.getVascFrontendData().getVascFrontendActions().sortAction(field); - - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']}", Boolean.class); - ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortField']}", String.class); - ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending()); - ren3.setValue(FacesContext.getCurrentInstance().getELContext(), field.getId()); - - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class SearchActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.searchString}", String.class); - String ss = (String)ve3.getValue(FacesContext.getCurrentInstance().getELContext()); - - entry.getVascFrontendData().getVascFrontendActions().searchAction(ss); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class MoveActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - String to = (String)((HtmlCommandLink)event.getComponent()).getType(); - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - Object selected = comp.getSelectedTableObject(); - if ("up".equals(to)) { - entry.getVascFrontendData().getVascFrontendActions().moveUpAction(selected); - } - if ("down".equals(to)) { - entry.getVascFrontendData().getVascFrontendActions().moveDownAction(selected); - } - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - public String createView(VascEntry entry) throws Exception { - - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelView = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelView.setId(viewRoot.createUniqueId()); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelView.getChildren().add(title); - - //HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //br.setId(viewRoot.createUniqueId()); - //br.setValue("

"); - //br.setEscape(false); - //panelView.getChildren().add(br); - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setEscape(false); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getListDescription())); - panelView.getChildren().add(header); - - HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("

"); - br.setEscape(false); - panelView.getChildren().add(br); - - HtmlOutputText tabHeader = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - tabHeader.setId(viewRoot.createUniqueId()); - tabHeader.setValue(""); - tabHeader.setEscape(false); - panelView.getChildren().add(tabHeader); - - HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - grid.setId(viewRoot.createUniqueId()); - grid.setColumns(1); - grid.setStyleClass("form"); - grid.setWidth("100%"); - panelView.getChildren().add(grid); - - HtmlPanelGroup options = (HtmlPanelGroup)application.createComponent(HtmlPanelGroup.COMPONENT_TYPE); - options.setId(viewRoot.createUniqueId()); - grid.getChildren().add(options); - - //HtmlPanelGroup gridOption = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - //gridOption.setId(viewRoot.createUniqueId()); - //gridOption.setColumns(1); - //gridOption.setColumnClasses("style_tableDarkGray_dub"); - //options.getChildren().add(gridOption); - - for (VascEntryField option:entry.getListOptions()) { - for (int i=0;i"); - br.setEscape(false); - panelView.getChildren().add(br); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascLinkBackActionListener()); - link.setValue("Back"); - - panelView.getChildren().add(link); - } - - HtmlPanelGrid gridHeader = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - gridHeader.setId(viewRoot.createUniqueId()); - gridHeader.setColumns(3); - gridHeader.setColumnClasses(" , , style_tableHeader1"); - gridHeader.setWidth("90%"); - panelView.getChildren().add(gridHeader); - - HtmlPanelGroup gotoGroup = (HtmlPanelGroup)application.createComponent(HtmlPanelGroup.COMPONENT_TYPE); - gotoGroup.setId(viewRoot.createUniqueId()); - gridHeader.getChildren().add(gotoGroup); - - VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend(); - // create pageing - if (backend.isPageable()) { - - HtmlOutputText gotoText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - gotoText.setId(viewRoot.createUniqueId()); - gotoText.setValue("Ga naar pagina: "); - gotoGroup.getChildren().add(gotoText); - - /* - HtmlDataList table = (HtmlDataList)application.createComponent(HtmlDataList.COMPONENT_TYPE); - table.setVar("vascPage"); - table.setId(viewRoot.createUniqueId()); - table.setValue(pagesDataModel); - table.setLayout("simple"); - gotoGroup.getChildren().add(table); - */ - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.pageNumber}", Integer.class); - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new PageLinkActionListener()); - link.setValueExpression("value", ve2); - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.selected?'style_header1':''}", String.class); - link.setValueExpression("styleClass", ren2); - - //HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //out.setId(viewRoot.createUniqueId()); - //out.setValueExpression("value", ve2); - //ValueExpression ren = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.notSelected}", Boolean.class); - //out.setValueExpression("rendered", ren); - - //HtmlOutputText out2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //out2.setId(viewRoot.createUniqueId()); - //out2.setStyleClass("style_header1"); - //out2.setValueExpression("value", ve2); - //ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.selected}", Boolean.class); - //out2.setValueExpression("rendered", ren2); - - //link.getChildren().add(out); - //link.getChildren().add(out2); - // table.getChildren().add(link); - /* - HtmlOutputText space2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space2.setId(viewRoot.createUniqueId()); - space2.setValue(" "); - space2.setEscape(false); - table.getChildren().add(space2); - */ - } - - HtmlOutputText space2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space2.setId(viewRoot.createUniqueId()); - space2.setValue(" "); - space2.setEscape(false); - gridHeader.getChildren().add(space2); - - HtmlPanelGroup actionGroup = (HtmlPanelGroup)application.createComponent(HtmlPanelGroup.COMPONENT_TYPE); - actionGroup.setId(viewRoot.createUniqueId()); - gridHeader.getChildren().add(actionGroup); - - for (GlobalVascAction action:entry.getGlobalActions()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderGlobalVascAction(action)==false) { - continue; - } - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(action.getId()); - link.addActionListener(new VascGlobalActionListener(action.getId())); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(action.getName())); - - link.getChildren().add(out); - actionGroup.getChildren().add(link); - - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue(" "); - space.setEscape(false); - actionGroup.getChildren().add(space); - } - - // keep add button seperate - for (RowVascAction action:entry.getRowActions()) { - if ("addRowAction".equals(action.getId())==false) { - continue; - } - if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) { - continue; - } - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue("     "); - space.setEscape(false); - actionGroup.getChildren().add(space); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascRowActionListener(action.getId())); - link.setImmediate(true); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(action.getName())); - - link.getChildren().add(out); - actionGroup.getChildren().add(link); - } - - HtmlDataTable table = (HtmlDataTable)application.createComponent(HtmlDataTable.COMPONENT_TYPE); - table.setVar("vascRecord"); - table.setId(viewRoot.createUniqueId()); - //table.setWidth("90%"); - table.setStyleClass("utr"); - table.setRowClasses("row, row2"); - //table.setHeaderClass("style_tableHeader1"); - table.setValue(tableDataModel); - panelView.getChildren().add(table); - - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) { - continue; - } - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(c.getId()); - link.addActionListener(new SortActionListener()); - - HtmlOutputText out2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out2.setId(viewRoot.createUniqueId()); - out2.setEscape(false); - out2.setValue(i18n(c.getName())+" "); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("↑"); // ↑ - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']==true and vascActionBean.values['sortField']=='"+c.getId()+"'}", Boolean.class); - orderUp.setValueExpression("rendered", ren2); - - HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderDown.setId(viewRoot.createUniqueId()); - orderDown.setEscape(false); - orderDown.setValue("↓"); // ↓ - ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']==false and vascActionBean.values['sortField']=='"+c.getId()+"'}", Boolean.class); - orderDown.setValueExpression("rendered", ren3); - - link.getChildren().add(out2); - link.getChildren().add(orderUp); - link.getChildren().add(orderDown); - col.setHeader(link); - - //getFacet("listColumnHeader").getChildren(); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - int index = VascDataBackendBean.getIndexId(c); - ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{vascRecord.field"+index+"}",Object.class); - out.setValueExpression("value", ve1); - - col.getChildren().add(out); - table.getChildren().add(col); - } - - if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) { - UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colUp.setId(viewRoot.createUniqueId()); - - HtmlCommandLink linkUp = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkUp.setId(viewRoot.createUniqueId()); - linkUp.setType("up"); - linkUp.addActionListener(new MoveActionListener()); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("↑ up"); // ↑ - - linkUp.getChildren().add(orderUp); - colUp.getChildren().add(linkUp); - table.getChildren().add(colUp); - - HtmlCommandLink linkDown = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkDown.setId(viewRoot.createUniqueId()); - linkDown.setType("down"); - linkDown.addActionListener(new MoveActionListener()); - - UIColumn colDown = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colDown.setId(viewRoot.createUniqueId()); - HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderDown.setId(viewRoot.createUniqueId()); - orderDown.setEscape(false); - orderDown.setValue("↓ down"); // ↓ - - linkDown.getChildren().add(orderDown); - colDown.getChildren().add(linkDown); - table.getChildren().add(colDown); - } - - for (VascLinkEntry vascLink:entry.getVascLinkEntries()) { - - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); - colHeader.setId(viewRoot.createUniqueId()); - colHeader.setValue("link"); - col.setHeader(colHeader); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascLinkActionListener(vascLink.getId())); - - // rm this , bacause of unneeded copy, should add name to link - VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(vascLink.getVascEntryId()); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(ve.getName())); - - link.getChildren().add(out); - col.getChildren().add(link); - - table.getChildren().add(col); - } - - for (RowVascAction action:entry.getRowActions()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) { - continue; - } - if ("addRowAction".equals(action.getId())) { - continue; - } - - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); - colHeader.setId(viewRoot.createUniqueId()); - colHeader.setValue(i18n(action.getName())); - col.setHeader(colHeader); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascRowActionListener(action.getId())); - link.setImmediate(true); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(action.getName())); - - link.getChildren().add(out); - col.getChildren().add(link); - - table.getChildren().add(col); - } - HtmlPanelGrid gridFooter = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - gridFooter.setId(viewRoot.createUniqueId()); - gridFooter.setColumns(1); - - /* - HtmlOutputText pageText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - pageText.setId(viewRoot.createUniqueId()); - pageText.setValue("Pagina: "); - gridFooter.getChildren().add(pageText); - */ - - panelView.getChildren().add(gridFooter); - - this.getChildren().add(panelView); - return panelView.getId(); - } -} - -class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * @see net.forwardfire.vasc.frontend.VascFrontend#getFrontendType() - */ - public String getFrontendType() { - return "jsf"; - } - - // Frontend Stuff - - protected void addUiComponents() { - VascFrontendData vfd = getVascEntry().getVascFrontendData(); - - // required UI components - vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_LABEL,JSFLabel.class.getName()); - vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_TEXT, JSFText.class.getName()); - vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_LIST, JSFList.class.getName()); - //vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_BUTTON, JSFButton.class.getName()); - - // optional UI components - vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_BOOLEAN , JSFBoolean.class.getName()); - //vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_DATE , JSFDate.class.getName()); - vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_TEXTAREA , JSFTextArea.class.getName()); - //vfd.putVascUIComponent(net.forwardfire.vasc.core.ui.VascUIComponent.VASC_COLOR , JSFColorChooser.class.getName()); - - } - - /** - * @see net.forwardfire.vasc.frontend.VascFrontend#renderDelete(java.lang.Object) - */ - public void renderDelete() throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("deleteId"); - panel.setRendered(true); - } - - /** - * @see net.forwardfire.vasc.frontend.VascFrontend#renderEdit(java.lang.Object) - */ - public void renderEdit() throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("editId"); - panel.setRendered(true); - - entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry); - - VascDataBackendBean selBean = null; - if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) { - int index = entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()+1; - selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getVascEntryState().getEntryDataObject(),index); - } else { - selBean = comp.getSelectedTableBean(); - } - selBean.setRealValue(true); - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), selBean); - - } - - /** - * @see net.forwardfire.vasc.frontend.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter) - */ - public void renderExport(VascEntryExporter exporter) throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("exportId"); - panel.setRendered(true); - - comp.exporter=exporter; - } - - /** - * @see net.forwardfire.vasc.frontend.VascFrontend#renderView() - */ - public void renderView() throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("viewId"); - panel.setRendered(true); - } -} - -@SuppressWarnings("serial") -class VascGlobalActionListener implements ActionListener,Serializable { - private String actionId = null; - public VascGlobalActionListener(String actionId) { - this.actionId=actionId; - } - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - GlobalVascAction action = entry.getGlobalActionById(actionId); - try { - action.doGlobalAction(entry); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - -} -@SuppressWarnings("serial") -class VascRowActionListener implements ActionListener,Serializable { - private String actionId = null; - public VascRowActionListener(String actionId) { - this.actionId=actionId; - } - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - RowVascAction action = entry.getRowActionById(actionId); - Object selected = null; - if (actionId.contains("add")==false) { - selected = comp.getSelectedTableObject(); - } - try { - action.doRowAction(entry, selected); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } -} -@SuppressWarnings("serial") -class VascLinkActionListener implements ActionListener,Serializable { - private String linkId = null; - public VascLinkActionListener(String linkId) { - this.linkId=linkId; - } - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - VascLinkEntry l = entry.getVascLinkEntryById(linkId); - comp.initGoto(l); - } -} -@SuppressWarnings("serial") -class VascLinkBackActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - comp.initGoto(null); - } -} \ No newline at end of file diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/faces-config.xml b/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/faces-config.xml index 05f4119..65bc9cf 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/faces-config.xml +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/faces-config.xml @@ -6,7 +6,7 @@ Vasc JSF Component vasc.jsf.component - net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponent + net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponent vasc.jsf.component.renderer @@ -16,13 +16,13 @@ vasc.jsf.component.family vasc.jsf.component.renderer - net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponentRenderer + net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponentRenderer - net.forwardfire.vasc.frontends.web.jsf.VascViewHandler + net.forwardfire.vasc.frontend.web.jsf.VascViewHandler diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/vasc.tld b/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/vasc.tld index e7a459f..d4613d2 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/vasc.tld +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/resources/META-INF/vasc.tld @@ -9,7 +9,7 @@ Renders the vasc entry JSF Frontend Renderer vascEntry - net.forwardfire.vasc.frontends.web.jsf.JSFVascUIComponentTag + net.forwardfire.vasc.frontend.web.jsf.JSFVascUIComponentTag JSP id diff --git a/vasc-lib/pom.xml b/vasc-lib/pom.xml index aa06537..812742c 100644 --- a/vasc-lib/pom.xml +++ b/vasc-lib/pom.xml @@ -13,5 +13,6 @@ vasc-lib vasc-lib-i18n + vasc-lib-jr4o \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/.project b/vasc-lib/vasc-lib-jr4o/.project new file mode 100644 index 0000000..27d2183 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/.project @@ -0,0 +1,23 @@ + + + vasc-lib-jr4o + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-lib/vasc-lib-jr4o/pom.xml b/vasc-lib/vasc-lib-jr4o/pom.xml new file mode 100644 index 0000000..5c678ef --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/pom.xml @@ -0,0 +1,24 @@ + + 4.0.0 + + vasc-lib + net.forwardfire.vasc.lib + 0.3.5-SNAPSHOT + .. + + vasc-lib-jr4o + vasc-lib-jr4o + vasc-lib-jr4o + + + org.x4o + x4o-core + ${x4o-core.version} + + + net.sf.jasperreports + jasperreports + 4.5.1 + + + \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4ODesignManager.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4ODesignManager.java new file mode 100644 index 0000000..aef722b --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4ODesignManager.java @@ -0,0 +1,202 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; +import org.xml.sax.SAXException; + +import net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRExporter; +import net.sf.jasperreports.engine.JRExporterParameter; +import net.sf.jasperreports.engine.JasperCompileManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.JasperReport; +import net.sf.jasperreports.engine.design.JRDesignParameter; +import net.sf.jasperreports.engine.design.JasperDesign; +import net.sf.jasperreports.engine.export.JRCsvExporter; +import net.sf.jasperreports.engine.export.JRPdfExporter; +import net.sf.jasperreports.engine.export.JRRtfExporter; +import net.sf.jasperreports.engine.export.JRXlsExporter; +import net.sf.jasperreports.engine.export.JRXmlExporter; + +/** + * JRDesignManager can work with multiple designs for one JRDynamicDataSource. + * + * @author Willem Cazander + * @version 1.0 May 10, 2012 + */ +public class JR4ODesignManager { + + private String resourceBundle = null; + private Map parameters = null; + private JRDynamicDataSource dataSource = null; + private Map reportDesigns = null; + //private Map cachedReports = null; + //private boolean cacheReports = true; + + public JR4ODesignManager(JRDynamicDataSource dataSource,String resourceBundle) { + this(dataSource,resourceBundle,new HashMap(1)); + } + + public JR4ODesignManager(JRDynamicDataSource dataSource,String resourceBundle,Map parameters) { + if (dataSource==null) { + throw new NullPointerException("Can't create dynamic reports with null dynamic datasource."); + } + if (parameters==null) { + throw new NullPointerException("Can't create dynamic reports with null parameters map."); + } + if (resourceBundle==null) { + throw new NullPointerException("Can't create dynamic reports with null resourceBundle."); + } + this.dataSource = dataSource; + this.parameters = parameters; + this.resourceBundle = resourceBundle; + reportDesigns = new HashMap(20); + } + + + public JasperDesign getJasperDesignByName(String designName) { + if (designName==null) { + throw new NullPointerException("Can't search for report with null name."); + } + return reportDesigns.get(designName); + } + + public void addJasperDesign(JasperDesign design) { + if (design==null) { + throw new NullPointerException("Can add null design."); + } + reportDesigns.put(design.getName(), design); + } + + private JR4OParser createParser() { + JR4OParser parser = new JR4OParser(dataSource,resourceBundle); + Map elBeans = dataSource.addDynamicELBean(); + for (String key:elBeans.keySet()) { + Object value = elBeans.get(key); + parser.addGlobalELBean(key, value); + } + return parser; + } + + public void parseFile(File file) throws FileNotFoundException, SecurityException, NullPointerException, ParserConfigurationException, SAXException, IOException { + if (file==null) { + throw new NullPointerException("Can't parse null file."); + } + JR4OParser parser = createParser(); + parser.parseFile(file); + for (JasperDesign design:parser.getJasperDesigns()) { + addJasperDesign(design); + } + } + + public void parseResource(String resourceName) throws FileNotFoundException, SecurityException, NullPointerException, ParserConfigurationException, SAXException, IOException { + if (resourceName==null) { + throw new NullPointerException("Can't parse null resouce."); + } + JR4OParser parser = createParser(); + parser.parseResource(resourceName); + for (JasperDesign design:parser.getJasperDesigns()) { + addJasperDesign(design); + } + } + + public JasperReport compileReport(String designName) throws JRException { + JasperDesign design = getJasperDesignByName(designName); + if (design==null) { + throw new NullPointerException("Could not find design with name: "+designName); + } + return compileReport(design); + } + + public JasperReport compileReport(JasperDesign design) throws JRException { + if (design==null) { + throw new NullPointerException("Can't compile with null design."); + } + for (String key:parameters.keySet()) { + Object value = parameters.get(key); + JRDesignParameter par = new JRDesignParameter(); + par.setName(key); + par.setValueClass(value.getClass()); + design.addParameter(par); + } + dataSource.addDynamicColumnClassFields(design); + return JasperCompileManager.compileReport(design); + } + + public JasperPrint printReport(JasperReport report) throws JRException { + return JasperFillManager.fillReport(report, parameters, dataSource); + } + + private void saveReport(JasperPrint reportPrint,JRExportType type,boolean isFile,Object out) throws JRException { + JRExporter exporter = null; + switch (type) { + default: + case PDF: exporter = new JRPdfExporter(); break; + case RTF: exporter = new JRRtfExporter(); break; + case CSV: exporter = new JRCsvExporter(); break; + case XLS: exporter = new JRXlsExporter(); break; + case XML: exporter = new JRXmlExporter(); break; + } + if (isFile) { + exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,out); + } else { + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,out); + } + exporter.setParameter(JRExporterParameter.JASPER_PRINT,reportPrint); + exporter.exportReport(); + } + + public void saveReportStream(JasperPrint reportPrint,JRExportType type,OutputStream out) throws JRException { + saveReport(reportPrint,type,false,out); + } + + public void saveReportFile(JasperPrint reportPrint,JRExportType type,String fileName) throws JRException { + saveReport(reportPrint,type,true,fileName); + } + + public void saveReportStream(String name,JRExportType type,OutputStream out) throws JRException { + saveReportStream(printReport(compileReport(name)),type,out); + } + + public void saveReportFile(String name,JRExportType type,String file) throws JRException { + saveReportFile(printReport(compileReport(name)),type,file); + } + + public enum JRExportType { + PDF, + RTF, + CSV, + XLS, + XML; + } +} diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4OParser.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4OParser.java new file mode 100644 index 0000000..a09156c --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/JR4OParser.java @@ -0,0 +1,105 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o; + +import java.util.ArrayList; +import java.util.List; + +import javax.el.ValueExpression; + +import net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource; +import net.sf.jasperreports.engine.design.JasperDesign; + +import org.x4o.xml.core.X4OParser; +import org.x4o.xml.element.ElementContext; +import org.x4o.xml.element.ElementException; + +/** + * JR4OParser parses xml layer for JasperReports + * + * jr4o is currently not the nicest x4o language because it is ported from old version. + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class JR4OParser extends X4OParser { + + /** The jr40 language name */ + static public final String LANGUAGE = "jr4o"; + static public final String EL_DATASOURCE_NAME = "dynamicDataSource"; + static public final String EL_DESIGN_LIST_NAME = "dynamicDesignList"; + private List dynamicDesignList = null; + private String resourceBundle = null; + + /** + * creates an JR4OParser + */ + public JR4OParser(JRDynamicDataSource dataSource,String resourceBundle) { + super(LANGUAGE); + this.resourceBundle = resourceBundle; + dynamicDesignList = new ArrayList(10); + addGlobalELBean(EL_DATASOURCE_NAME, dataSource); + addGlobalELBean(EL_DESIGN_LIST_NAME, dynamicDesignList); + } + + /** + * @return The list of JasperDesigns after parsing. + */ + public List getJasperDesigns() { + for (JasperDesign d:dynamicDesignList) { + if (d.getResourceBundle()==null) { + d.setResourceBundle(resourceBundle); + } + } + return dynamicDesignList; + } + + /** + * Returns the JRDynamicDataSource for the JRDynamic*Element classes. + * @param context The ElementContext to get the datasource from. + * @return The JRDynamicDataSource of this parser instance. + */ + static public JRDynamicDataSource getELDataSource(ElementContext context) throws ElementException { + ValueExpression ee = context.getExpressionFactory().createValueExpression(context.getELContext(),"${"+EL_DATASOURCE_NAME+"}",JRDynamicDataSource.class); + JRDynamicDataSource dataSource = (JRDynamicDataSource)ee.getValue(context.getELContext()); + if (dataSource==null) { + throw new ElementException("Could not find dataSouce in context as: "+EL_DATASOURCE_NAME); + } + return dataSource; + } + + /** + * Returns the List of designs for adding the design. + * @param context The ElementContext to get the list from. + * @return The list of designs. + */ + @SuppressWarnings("unchecked") + static public List getELDesignList(ElementContext context) throws ElementException { + ValueExpression ee = context.getExpressionFactory().createValueExpression(context.getELContext(),"${"+EL_DESIGN_LIST_NAME+"}",List.class); + List designList = (List)ee.getValue(context.getELContext()); + if (designList==null) { + throw new ElementException("Could not find designList in context as: "+EL_DESIGN_LIST_NAME); + } + return designList; + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/AbstractJRDynamicDataSource.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/AbstractJRDynamicDataSource.java new file mode 100644 index 0000000..03f6c2d --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/AbstractJRDynamicDataSource.java @@ -0,0 +1,69 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.data; + +import net.sf.jasperreports.engine.type.HorizontalAlignEnum; + +/** + * AbstractJRDynamicDataSource returns some default values of interface. + * + * @author Willem Cazander + * @version 1.0 May 10, 2012 + */ +public abstract class AbstractJRDynamicDataSource implements JRDynamicDataSource { + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnY(int) + */ + public int getDynamicColumnY(int col) { + return 5; + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnHeight(int) + */ + public int getDynamicColumnHeight(int col) { + return 15; + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnHorizontalAlignment(int) + */ + public HorizontalAlignEnum getDynamicColumnHorizontalAlignment(int col) { + return HorizontalAlignEnum.LEFT; + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#isDynamicColumnStretchWithOverflow(int) + */ + public boolean isDynamicColumnStretchWithOverflow(int col) { + return true; + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#isDynamicColumnBlankWhenNull(int) + */ + public boolean isDynamicColumnBlankWhenNull(int col) { + return true; + } +} diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSource.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSource.java new file mode 100644 index 0000000..62b90cf --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSource.java @@ -0,0 +1,53 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.data; + +import java.util.Map; + +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRRewindableDataSource; +import net.sf.jasperreports.engine.design.JasperDesign; +import net.sf.jasperreports.engine.type.HorizontalAlignEnum; + +/** + * AbstractJRDynamicDataSource returns some default values of interface. + * + * @author Willem Cazander + * @version 1.0 May 10, 2012 + */ +public interface JRDynamicDataSource extends JRRewindableDataSource { + + public void addDynamicColumnClassFields(JasperDesign jd) throws JRException; + public Map addDynamicELBean(); + + public int getDynamicColumnCount(); + public int getDynamicColumnX(int col); + public int getDynamicColumnY(int col); + public int getDynamicColumnWidth(int col); + public int getDynamicColumnHeight(int col); + + public HorizontalAlignEnum getDynamicColumnHorizontalAlignment(int col); + public boolean isDynamicColumnStretchWithOverflow(int col); + public boolean isDynamicColumnBlankWhenNull(int col); + +} diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSourceTableModel.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSourceTableModel.java new file mode 100644 index 0000000..d31349e --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/data/JRDynamicDataSourceTableModel.java @@ -0,0 +1,148 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.data; + +import java.util.HashMap; +import java.util.Map; + +import javax.swing.table.TableModel; + +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRField; +import net.sf.jasperreports.engine.design.JRDesignField; +import net.sf.jasperreports.engine.design.JasperDesign; + +/** + * JRDynamicDataSourceTableModel is the dynamic datasource which supportes dynamic columns in Jasper reports. + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class JRDynamicDataSourceTableModel extends AbstractJRDynamicDataSource { + + + private TableModel tableModel = null; + private int index = -1; + private int[] columnWidths = null; + private static final String PREFIX_COLUMN = "COLUMN_"; + private static final String PREFIX_HEADER = "HEADER_"; + private static final String INFIX_CLASS = "CLASS_"; + + public JRDynamicDataSourceTableModel(TableModel tableModel,int[] columnWidths) { + if (tableModel==null) { + throw new NullPointerException("TableModel can't be null."); + } + this.tableModel = tableModel; + this.columnWidths = columnWidths; + } + + /** + * @see net.sf.jasperreports.engine.JRDataSource#getFieldValue(net.sf.jasperreports.engine.JRField) + */ + public Object getFieldValue(JRField jrField) throws JRException { + String fieldName = jrField.getName(); + if (fieldName.startsWith(PREFIX_COLUMN)) { + return tableModel.getValueAt(index, Integer.parseInt(fieldName.substring(7))); + } + if (fieldName.startsWith(PREFIX_HEADER)) { + return tableModel.getColumnName(Integer.parseInt(fieldName.substring(7))); + } + throw new JRException("Unknown column name : " + fieldName); + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#addDynamicColumnClassFields(net.sf.jasperreports.engine.design.JasperDesign) + */ + public void addDynamicColumnClassFields(JasperDesign jd) throws JRException { + JRDesignField field; + for (int i=0;i addDynamicELBean() { + Map result = new HashMap(10); + for (int i=0;i columnWidths.length) { + break; + } + result += columnWidths[i]; + } + return result; + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnWidth(int) + */ + public int getDynamicColumnWidth(int col) { + if (col > columnWidths.length) { + return 50; + } + return columnWidths[col]; + } + + /** + * @see net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource#getDynamicColumnCount() + */ + public int getDynamicColumnCount() { + return tableModel.getColumnCount(); + } + + /** + * @see net.sf.jasperreports.engine.JRDataSource#next() + */ + public boolean next() throws JRException { + index++; + return (index < tableModel.getRowCount()); + } + + /** + * @see net.sf.jasperreports.engine.JRRewindableDataSource#moveFirst() + */ + public void moveFirst() throws JRException { + index = -1; + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ColorConverter.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ColorConverter.java new file mode 100644 index 0000000..ef656bd --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ColorConverter.java @@ -0,0 +1,64 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import java.awt.Color; +import java.util.Locale; + +import org.x4o.xml.conv.AbstractStringObjectConverter; +import org.x4o.xml.conv.ObjectConverter; +import org.x4o.xml.conv.ObjectConverterException; + +/** + * ColorConverter + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class ColorConverter extends AbstractStringObjectConverter { + + private static final long serialVersionUID = 7618333644044204827L; + + public Class getObjectClassTo() { + return Color.class; + } + + public Object convertStringTo(String str, Locale locale) throws ObjectConverterException { + try { + return Color.decode(str); + } catch (Exception e) { + throw new ObjectConverterException(this,e.getMessage(),e); + } + } + + public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException { + return ""+((Color)obj).getRGB(); + } + + @Override + public ObjectConverter clone() throws CloneNotSupportedException { + ColorConverter result = new ColorConverter(); + result.converters=cloneConverters(); + return result; + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ImageElement.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ImageElement.java new file mode 100644 index 0000000..c4a9104 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ImageElement.java @@ -0,0 +1,57 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElement; +import org.x4o.xml.element.Element; +import org.x4o.xml.element.ElementException; + +import net.sf.jasperreports.engine.JRDefaultStyleProvider; +import net.sf.jasperreports.engine.design.JRDesignImage; + +/** + * + * + * @author Willem Cazander + * @version 1.0 Oct 5, 2007 + */ +public class ImageElement extends AbstractElement { + + @Override + public void doElementStart() throws ElementException { + JRDefaultStyleProvider style = findStyleFiller(); + JRDesignImage image = new JRDesignImage(style); + setElementObject(image); + } + + private JRDefaultStyleProvider findStyleFiller() { + Element element = getParent(); + while (element!=null) { + if (element.getElementObject() instanceof JRDefaultStyleProvider) { + return (JRDefaultStyleProvider)element.getElementObject(); + } + element=element.getParent(); + } + return null; + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementBindingHandler.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementBindingHandler.java new file mode 100644 index 0000000..7fac526 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementBindingHandler.java @@ -0,0 +1,70 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElementBindingHandler; +import org.x4o.xml.element.Element; +import org.x4o.xml.element.ElementBindingHandlerException; + +import net.sf.jasperreports.engine.JRElementGroup; +import net.sf.jasperreports.engine.JRGroup; +import net.sf.jasperreports.engine.JRStyle; +import net.sf.jasperreports.engine.design.JRDesignElement; + +/** + * JR4OElementBindingHandler + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class JR4OElementBindingHandler extends AbstractElementBindingHandler { + + public boolean canBind(Element element) { + Object parent = element.getParent().getElementObject(); + Object child = element.getElementObject(); + boolean p = false; + boolean c = false; + if (parent instanceof JRDesignElement) { p=true; } + if (child instanceof JRElementGroup) { c=true; } + if (child instanceof JRGroup) { c=true; } + if (child instanceof JRStyle) { c=true; } + if (p&c) { return true; } else { return false; } + } + + public void doBind(Element element) throws ElementBindingHandlerException { + Object parent = element.getParent().getElementObject(); + Object child = element.getElementObject(); + + if (parent instanceof JRDesignElement) { + if (child instanceof JRElementGroup) { + ((JRDesignElement)parent).setElementGroup((JRElementGroup)child); + } + if (child instanceof JRGroup) { + ((JRDesignElement)parent).setPrintWhenGroupChanges((JRGroup)child); + } + if (child instanceof JRStyle) { + ((JRDesignElement)parent).setStyle((JRStyle)child); + } + return; + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementGroupBindingHandler.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementGroupBindingHandler.java new file mode 100644 index 0000000..4414c49 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OElementGroupBindingHandler.java @@ -0,0 +1,66 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElementBindingHandler; +import org.x4o.xml.element.Element; +import org.x4o.xml.element.ElementBindingHandlerException; + +import net.sf.jasperreports.engine.design.JRDesignElement; +import net.sf.jasperreports.engine.design.JRDesignElementGroup; + +/** + * JR4OElementGroupBindingHandler + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class JR4OElementGroupBindingHandler extends AbstractElementBindingHandler { + + public boolean canBind(Element element) { + Object parent = element.getParent().getElementObject(); + Object child = element.getElementObject(); + boolean p = false; + boolean c = false; + if (parent instanceof JRDesignElementGroup) { p=true; } + if (child instanceof JRDesignElement) { c=true; } + if (child instanceof JRDesignElementGroup) { c=true; } + + if (p&c) { return true; } else { return false; } + } + + + public void doBind(Element element) throws ElementBindingHandlerException { + Object parent = element.getParent().getElementObject(); + Object child = element.getElementObject(); + if (parent instanceof JRDesignElementGroup) { + if (child instanceof JRDesignElementGroup) { + ((JRDesignElementGroup)parent).addElementGroup((JRDesignElementGroup)child); + } + if (child instanceof JRDesignElement) { + ((JRDesignElementGroup)parent).addElement((JRDesignElement)child); + } + return; + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OJasperDesignBindingHandler.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OJasperDesignBindingHandler.java new file mode 100644 index 0000000..ea86423 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JR4OJasperDesignBindingHandler.java @@ -0,0 +1,74 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElementBindingHandler; +import org.x4o.xml.element.Element; +import org.x4o.xml.element.ElementBindingHandlerException; + +import net.sf.jasperreports.engine.JRField; +import net.sf.jasperreports.engine.JRParameter; +import net.sf.jasperreports.engine.JRStyle; +import net.sf.jasperreports.engine.design.JasperDesign; + +/** + * JR4OJasperDesignBindingHandler + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class JR4OJasperDesignBindingHandler extends AbstractElementBindingHandler { + + + public boolean canBind(Element element) { + Object parent = element.getParent().getElementObject(); + Object child = element.getElementObject(); + boolean p = false; + boolean c = false; + if (parent instanceof JasperDesign) { p=true; } + if (child instanceof JRField) { c=true; } + if (child instanceof JRParameter) { c=true; } + if (child instanceof JRStyle) { c=true; } + if (p&c) { return true; } else { return false; } + } + + public void doBind(Element element) throws ElementBindingHandlerException { + Object parent = element.getParent().getElementObject(); + Object child = element.getElementObject(); + if (parent instanceof JasperDesign) { + try { + if (child instanceof JRField) { + ((JasperDesign)parent).addField((JRField)child); + } + if (child instanceof JRParameter) { + ((JasperDesign)parent).addParameter((JRParameter)child); + } + if (child instanceof JRStyle) { + ((JasperDesign)parent).addStyle((JRStyle)child); + } + } catch (Exception e) { + throw new ElementBindingHandlerException(e.getMessage(),e); + } + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRDynamicCardsElement.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRDynamicCardsElement.java new file mode 100644 index 0000000..76ef89e --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/JRDynamicCardsElement.java @@ -0,0 +1,133 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import javax.el.ValueExpression; + +import org.x4o.xml.element.AbstractElement; +import org.x4o.xml.element.ElementException; + +import net.forwardfire.vasc.lib.jr4o.JR4OParser; +import net.forwardfire.vasc.lib.jr4o.data.JRDynamicDataSource; +import net.sf.jasperreports.engine.JRStyle; +import net.sf.jasperreports.engine.design.JRDesignElementGroup; +import net.sf.jasperreports.engine.design.JRDesignExpression; +import net.sf.jasperreports.engine.design.JRDesignTextField; +import net.sf.jasperreports.engine.type.ModeEnum; + +/** + * DynaCardsElement + * + * @author Willem Cazander + * @version 1.0 Oct 4, 2007 + */ +public class JRDynamicCardsElement extends AbstractElement { + + /** + * @see org.x4o.xml.element.AbstractElement#doElementStart() + */ + @Override + public void doElementStart() throws ElementException { + JRDynamicDataSource dataSource = JR4OParser.getELDataSource(getElementContext()); + + ValueExpression ee = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${Arial_Bold}",JRStyle.class); + JRStyle style = (JRStyle)ee.getValue(getElementContext().getELContext()); + if (style==null) { + throw new ElementException("Could not get the font."); + } + style.setBlankWhenNull(true); + style.setMode(ModeEnum.OPAQUE); + // //DEBUG STYLE + //style.setForecolor(Color.BLACK); + //style.setBackcolor(Color.BLUE); + + Object parent = getParent().getElementObject(); + if (parent instanceof JRDesignElementGroup == false) { + throw new ElementException("parent is not an JRDesignElementGroup."); + } + JRDesignElementGroup group = (JRDesignElementGroup)parent; + + + int offsetInitial = 95; + int defaultHeight = 12; + int max = dataSource.getDynamicColumnCount(); + + for (int i=0;i designs = JR4OParser.getELDesignList(getElementContext()); + designs.add(design); + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyImageExpressionElement.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyImageExpressionElement.java new file mode 100644 index 0000000..dc1740e --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyImageExpressionElement.java @@ -0,0 +1,65 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElement; +import org.x4o.xml.element.ElementException; + +import net.sf.jasperreports.engine.JRExpression; +import net.sf.jasperreports.engine.design.JRDesignExpression; +import net.sf.jasperreports.engine.design.JRDesignImage; + +/** + * ValueBodyImageExpressionElement + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class ValueBodyImageExpressionElement extends AbstractElement { + + private StringBuffer body = new StringBuffer(); + + + @Override + public void doCharacters(String text) throws ElementException { + body.append(text); + } + + + @Override + public void doElementEnd() throws ElementException { + if ((getElementObject() instanceof JRDesignExpression)==false) { + throw new ElementException("elementObject is not JRDesignExpression object"); + } + String expression = body.toString().trim(); + if (expression.length()>0) { + // only set then has size, can be added with text attribute in xml + ((JRDesignExpression)getElementObject()).setText(body.toString()); + } + if (getParent().getElementObject() instanceof JRDesignImage) { + if (getElementObject() instanceof JRExpression) { + ((JRDesignImage)getParent().getElementObject()).setExpression((JRExpression)getElementObject()); + } + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyPrintExpressionElement.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyPrintExpressionElement.java new file mode 100644 index 0000000..3882ce4 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyPrintExpressionElement.java @@ -0,0 +1,59 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElement; +import org.x4o.xml.element.ElementException; + +import net.sf.jasperreports.engine.JRExpression; +import net.sf.jasperreports.engine.design.JRDesignElement; +import net.sf.jasperreports.engine.design.JRDesignExpression; + +/** + * ValueBodyPrintExpressionElement + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class ValueBodyPrintExpressionElement extends AbstractElement { + + private StringBuffer body = new StringBuffer(); + + @Override + public void doCharacters(String text) throws ElementException { + body.append(text); + } + + @Override + public void doElementEnd() throws ElementException { + if ((getElementObject() instanceof JRDesignExpression)==false) { + throw new ElementException("elementObject is not JRDesignExpression object"); + } + ((JRDesignExpression)getElementObject()).setText(body.toString()); + if (getParent().getElementObject() instanceof JRDesignElement) { + if (getElementObject() instanceof JRExpression) { + ((JRDesignElement)getParent().getElementObject()).setPrintWhenExpression((JRExpression)getElementObject()); + } + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextElement.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextElement.java new file mode 100644 index 0000000..6057808 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextElement.java @@ -0,0 +1,52 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElement; +import org.x4o.xml.element.ElementException; + +import net.sf.jasperreports.engine.design.JRDesignStaticText; + + +/** + * + * + * @author Willem Cazander + * @version 1.0 Sep 3, 2007 + */ +public class ValueBodyTextElement extends AbstractElement { + + private StringBuffer body = new StringBuffer(); + + @Override + public void doCharacters(String text) throws ElementException { + body.append(text); + } + + @Override + public void doElementEnd() throws ElementException { + if (getParent().getElementObject() instanceof JRDesignStaticText) { + ((JRDesignStaticText)getParent().getElementObject()).setText(body.toString()); + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextExpressionElement.java b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextExpressionElement.java new file mode 100644 index 0000000..0ad6fc5 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/java/net/forwardfire/vasc/lib/jr4o/x4o/ValueBodyTextExpressionElement.java @@ -0,0 +1,59 @@ +/* + * Copyright 2007-2012 forwardfire.net All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.forwardfire.vasc.lib.jr4o.x4o; + +import org.x4o.xml.element.AbstractElement; +import org.x4o.xml.element.ElementException; + +import net.sf.jasperreports.engine.JRExpression; +import net.sf.jasperreports.engine.design.JRDesignExpression; +import net.sf.jasperreports.engine.design.JRDesignTextField; + +/** + * ValueBodyTextExpressionElement + * + * @author Willem Cazander + * @version 1.0 Aug 31, 2007 + */ +public class ValueBodyTextExpressionElement extends AbstractElement { + + private StringBuffer body = new StringBuffer(); + + @Override + public void doCharacters(String text) throws ElementException { + body.append(text); + } + + @Override + public void doElementEnd() throws ElementException { + if ((getElementObject() instanceof JRDesignExpression)==false) { + throw new ElementException("elementObject is not JRDesignExpression object"); + } + ((JRDesignExpression)getElementObject()).setText(body.toString()); + if (getParent().getElementObject() instanceof JRDesignTextField) { + if (getElementObject() instanceof JRExpression) { + ((JRDesignTextField)getParent().getElementObject()).setExpression((JRExpression)getElementObject()); + } + } + } +} \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-lang.eld b/vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-lang.eld new file mode 100644 index 0000000..eeddff3 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-lang.eld @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-namespaces.xml b/vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-namespaces.xml new file mode 100644 index 0000000..85067f8 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/resources/META-INF/jr4o/jr4o-namespaces.xml @@ -0,0 +1,7 @@ + + + + JR4O namespaces + jr4o-lang.eld + + diff --git a/vasc-lib/vasc-lib-jr4o/src/main/resources/net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml b/vasc-lib/vasc-lib-jr4o/src/main/resources/net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml new file mode 100644 index 0000000..18b25e2 --- /dev/null +++ b/vasc-lib/vasc-lib-jr4o/src/main/resources/net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml @@ -0,0 +1,100 @@ + + + + +