Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Mollik2017-08-28 15:35:30 +0000
committerRalf Mollik2017-08-28 15:35:30 +0000
commitce2b93e3c43a7afb824b0df0a498ef777f1e0d36 (patch)
tree644561a453b73fd0acf0471a7ee99025d0a790f9
downloadorg.eclipse.osbp.runtime.web-ce2b93e3c43a7afb824b0df0a498ef777f1e0d36.tar.gz
org.eclipse.osbp.runtime.web-ce2b93e3c43a7afb824b0df0a498ef777f1e0d36.tar.xz
org.eclipse.osbp.runtime.web-ce2b93e3c43a7afb824b0df0a498ef777f1e0d36.zip
parallel ip - initial checkin
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
-rw-r--r--.osbp.releng.root0
-rw-r--r--.project22
-rw-r--r--LICENSE.txt161
-rw-r--r--README.md4
-rw-r--r--about.html28
-rw-r--r--eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch20
-rw-r--r--eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch20
-rw-r--r--eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch21
-rw-r--r--eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch20
-rw-r--r--jenkins.build.config.xml23
-rw-r--r--notice.html107
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/.project51
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF14
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/build.properties11
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.atmosphere.fragment/src/NO-SOURCE0
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/.project51
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF17
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextFactory.xml9
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistry.xml9
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistryHelper.xml5
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/build.properties5
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.common.tests/src/org/eclipse/osbp/runtime/web/common/tests/Activator.java58
-rw-r--r--org.eclipse.osbp.runtime.web.common/.project56
-rw-r--r--org.eclipse.osbp.runtime.web.common/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.osbp.runtime.web.common/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.common/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.common/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.common/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.common/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.common/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/ContextAccess.java43
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IConstants.java29
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContext.java90
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContextRegistry.java50
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractUserInfo.java30
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContext.java193
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContextRegistry.java128
-rw-r--r--org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/preferences/UserScope.java119
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.project56
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF33
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/build.properties10
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/pom.xml448
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/setup/user-target.target70
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java146
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java28
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java33
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java32
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java85
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java76
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java95
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java33
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java141
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java143
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java114
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java117
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java149
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java224
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java110
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java149
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java114
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java167
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java100
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java112
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java128
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java114
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.project56
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF34
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/pom.xml23
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/setup/user-target.target70
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java146
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java28
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java36
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java32
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java89
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java76
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java95
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java37
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java146
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java148
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java119
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java122
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java154
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java229
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java115
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java154
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java119
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java172
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java105
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java117
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java138
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java119
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.project61
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF46
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/build.properties9
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.ecore13
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.genmodel18
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.properties4
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.xml17
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/pom.xml128
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/Activator.java68
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ModelUtilTests.java311
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfBar.java98
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfFoo.java65
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelFactory.java62
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelPackage.java285
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfBarImpl.java270
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfFooImpl.java175
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelFactoryImpl.java120
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelPackageImpl.java249
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelAdapterFactory.java152
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelSwitch.java150
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/AbstractBean.java95
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Bar.java168
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/BarHashById.java168
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Foo.java218
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/ValueBean.java131
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BindingManagerTests.java99
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BrowserPresentationTests.java424
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BundleHelper.java77
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ButtonPresentationTests.java415
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CheckBoxPresentationTests.java477
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ComboBoxPresentationTests.java1373
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CssLayoutPresentationTests.java583
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DateTimePresentationTests.java529
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DecimalFieldPresentationTests.java1330
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java150
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultViewContext.java20
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/FormLayoutPresentationTests.java583
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/HorizontalLayoutPresentationTests.java584
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/I18nServiceForTests.java70
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/LabelPresentationTests.java414
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ListPresentationTests.java1745
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/NumericFieldPresentationTests.java780
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/OptionsGroupPresentationTests.java1757
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ProgressBarPresentationTests.java487
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/SliderPresentationTests.java478
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TabSheetPresentationTests.java25
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TablePresentationTests.java1965
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextAreaPresentationTests.java468
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextFieldPresentationTests.java831
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TreePresentationTests.java1762
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/VerticallLayoutPresentationTests.java583
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project61
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF59
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml8
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/build.properties11
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/i18n/translations.properties17
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/Activator.java50
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IBindingManager.java81
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IConstants.java83
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/VaadinRenderer.java74
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractEmbeddedWidgetPresenter.java32
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java371
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java371
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabPresenter.java310
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabSheetPresenter.java50
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java1571
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/AbsoluteLayoutPresentation.java421
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java461
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BooleanSearchFieldPresentation.java324
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BrowserPresentation.java368
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java272
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CheckBoxPresentation.java318
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java464
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CssLayoutPresentation.java476
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java598
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java472
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DialogPresentation.java444
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java477
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java501
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java504
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FormLayoutPresentation.java452
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/GridLayoutPresentation.java969
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java615
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java270
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/LabelPresentation.java254
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ListPresentation.java499
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/MasterDetailPresentation.java503
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java449
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericSearchFieldPresentation.java334
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/OptionsGroupPresentation.java500
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PanelPresentation.java297
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java341
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java163
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ProgressBarPresentation.java318
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SearchPanelPresentation.java346
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SliderPresentation.java391
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SplitPanelPresentation.java299
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java529
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabPresentation.java218
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabSheetPresentation.java338
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java982
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java328
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java330
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextSearchFieldPresentation.java329
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TreePresentation.java364
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ValidatorAdapter.java123
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/VerticalLayoutPresentation.java643
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java798
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManager.java206
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java68
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumConverter.java69
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java47
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java66
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumSetConverter.java90
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java45
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetMouseClickService.java94
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java308
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/validator/ExternalStatusAwareValidator.java127
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project61
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF41
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml11
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy.xml8
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy.xml8
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/build.properties8
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/pom.xml27
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/IECViewUIRenderService.java93
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILDtoRenderStrategy.java41
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILEntityRenderStrategy.java41
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/AbstractRenderer.java231
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.xtend282
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/DtoModelRenderer.java415
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/ECViewUIRenderService.java204
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityModelRenderer.java436
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.xtend317
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LDtoRenderStrategy.java48
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LEntityRenderStrategy.java59
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/OperationExtensions.java294
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/TypeHelper.java145
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/XtextModule.java83
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java378
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java26
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java20
-rw-r--r--org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java850
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.project34
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.properties169
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml38
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/pom.xml77
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/main/javadoc/README.txt1
-rw-r--r--org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/overview.html10
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/.project29
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/build.properties2
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/feature.properties170
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/feature.xml42
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.testbase/pom.xml60
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.project34
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.properties169
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml43
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/pom.xml73
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/main/javadoc/README.txt1
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/overview.html10
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/.project34
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.properties169
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml46
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/pom.xml74
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/src/main/javadoc/README.txt1
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.common/src/overview.html10
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/.project34
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.properties169
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml51
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/pom.xml74
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/src/main/javadoc/README.txt1
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.components/src/overview.html10
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.project34
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.properties169
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml38
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/pom.xml74
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/main/javadoc/README.txt1
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/overview.html10
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.project34
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/epl-v10.html259
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.properties169
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml37
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/license.html164
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/pom.xml74
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/main/javadoc/README.txt1
-rw-r--r--org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/overview.html10
-rw-r--r--org.eclipse.osbp.runtime.web.target/.project17
-rw-r--r--org.eclipse.osbp.runtime.web.target/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target66
-rw-r--r--org.eclipse.osbp.runtime.web.target/pom.xml23
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/.project33
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF37
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.properties5
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/build.properties3
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/Activator.java174
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/ResourceProvider.java76
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseUI.java98
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseVaadinServlet.java23
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/ITestPart.java34
-rw-r--r--org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/Testable.java32
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/.project51
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/OSGI-INF/contextRegistryHelper.xml5
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/build.properties5
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common.tests/src/org/eclipse/osbp/runtime/web/vaadin/common/tests/Activator.java58
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/.project61
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF41
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/build.properties8
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/pom.xml58
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/Constants.java36
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/converter/StringToFormattedNumberConverter.java100
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java1015
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java901
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItem.java311
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java287
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java172
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactory.java35
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactoryDelegate.java36
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IClearable.java23
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/ILazyRefreshFilterable.java26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/INestedPropertyAble.java39
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java175
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java34
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java114
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/CollectionUtil.java42
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/Filters.java342
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java71
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/IResourceProvider.java30
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/impl/ThemeResourceProvider.java31
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java121
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToVaadinFilterConverter.java121
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend106
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/sharedState/SharedStateUtil.java53
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutHandler.java152
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutManager.java140
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/validator/BeanValidationValidator.java33
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java171
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/.project61
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/build.properties10
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml190
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml222
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldClientRpc.java10
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldConnector.java170
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityField.java218
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityLink.java126
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityTextField.java432
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityField.java123
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityFieldServerRpc.java9
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/shared/EntityFieldState.java36
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/LazyLoadingComboBox.java971
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetset.gwt.xml10
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetsetUI.java40
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/client/LazyLoadingComboBoxConnector.java339
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/public/runtimeweb-components/styles.css0
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/.project61
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF51
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml8
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/build.properties11
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/i18n/i18n.properties29
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/pom.xml158
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldClientRpc.java10
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldConnector.java170
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityField.java218
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityLink.java126
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityTextField.java432
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/runtimeweb-components/styles.css0
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityField.java123
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityFieldServerRpc.java9
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/shared/EntityFieldState.java36
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/container/DatasourceServiceFactoryDelegate.java62
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/DecimalConverter.java255
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/NumberConverter.java174
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/StringToNumberConverter.java58
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractDialog.java385
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractInputDialog.java69
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractMessageDialog.java77
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java81
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java83
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java83
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java58
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/OptionsDialog.java24
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java412
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanSearchServiceFactory.java60
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/DecimalField.java229
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/NumericField.java209
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/TextField.java42
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/BooleanSearchField.java120
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/EntityTextSearchField.java179
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/ISearchField.java57
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/NumericSearchField.java343
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/SearchField.java64
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/TextSearchField.java137
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/BooleanFilterProperty.java200
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/FilterProperty.java144
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/IFilterProperty.java43
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/NumericFilterProperty.java202
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/TextFilterProperty.java125
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/EmptyStringValidator.java48
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/NumberBoundsValidator.java208
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.project56
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF20
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/pom.xml576
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTest.java64
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTests.java66
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java149
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTest.java103
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTests.java103
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTest.java50
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTests.java52
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTest.java68
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTests.java69
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTest.java62
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTests.java64
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTest.java80
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTests.java82
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTest.java135
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTests.java137
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/.project56
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF54
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/build.properties6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/pom.xml25
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/IVaadinObservable.java24
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinObservables.java2605
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinProperties.java389
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ButtonClickProperty.java56
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGradientColorProperty.java43
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGridColorProperty.java41
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerHistoryColorProperty.java42
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerSelectColorProperty.java41
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentDescriptionProperty.java49
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentFocusedProperty.java45
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListener.java149
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListenerUtil.java78
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SimpleAccessorProperty.java115
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableHeightProperty.java47
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableWidthProperty.java47
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionProperty.java54
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionUnitProperty.java41
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionProperty.java54
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionUnitProperty.java42
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionProperty.java51
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionUnitProperty.java41
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/TabSheetSelectedTabProperty.java44
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/container/IEnhancedFilterableContainer.java42
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ButtonClickListener.java92
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetChangeListener.java91
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java94
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionSetProperty.java75
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionValueProperty.java66
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetChangeListener.java53
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoChangeListener.java57
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoValueProperty.java72
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetValueProperty.java53
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListChangeListener.java89
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListProperty.java68
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetChangeListener.java87
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetProperty.java58
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyChangeListener.java50
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyProperty.java47
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueChangeListener.java50
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java63
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierSetDiffChangeListener.java68
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierValueChangeListener.java70
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SingleSelectionProperty.java54
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerContainerDatasourceProperty.java48
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerItemDatasourceProperty.java46
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerPropertyDatasourceProperty.java47
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinListProperty.java120
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinSetProperty.java119
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinValueProperty.java209
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinListProperty.java34
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinSetProperty.java35
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinValueProperty.java66
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/PropertyInfo.java78
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/Util.java66
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinListPropertyDecorator.java98
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinSetPropertyDecorator.java97
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinValuePropertyDecorator.java126
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableList.java30
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableSet.java30
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableValue.java29
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SetToListAdapter.java132
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableList.java761
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableValue.java71
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableListDecorator.java56
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableSetDecorator.java56
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableValueDecorator.java55
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.filter.jpa/pom.xml84
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.project50
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF35
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/component.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_NoProviderFactory.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory_ProviderFactory.xml7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/build.properties7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/pom.xml23
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/Activator.java159
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/BundleHelper.java77
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/VaadinRequestTests.java529
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_NoProviderFactory.java25
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_WithProviderFactory.java57
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/.project55
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF36
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.properties5
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.xml23
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/applicationFactory.xml9
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/consolecommands.xml8
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/build.properties7
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/pom.xml24
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/Activator.java155
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/CustomOSGiUiProvider.java28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IOSGiUiProviderFactory.java35
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IVaadinApplication.java108
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/OSGiUI.java105
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinConstants.java96
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinStatusCodes.java76
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/OSGiServletService.java93
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/ServletContextListenerServletAdaptor.java60
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/VaadinOSGiServlet.java93
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/WebResourcesHttpContext.java156
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/AppException.java32
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/ConsoleCommands.java400
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/OSGiUIProvider.java83
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java1029
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/.project56
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/LICENSE.txt161
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/about.html28
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/about.ini17
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/about.mappings6
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/about.properties26
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/build.properties8
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/pom-compileWidgetset.xml202
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/pom.xml203
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidget.gwt.xml21
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidgetUI.java40
-rw-r--r--org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/public/lunifera-components/styles.css177
-rw-r--r--pom.xml155
-rw-r--r--setup/target-luna.target57
634 files changed, 94618 insertions, 0 deletions
diff --git a/.osbp.releng.root b/.osbp.releng.root
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.osbp.releng.root
diff --git a/.project b/.project
new file mode 100644
index 0000000..ced1067
--- /dev/null
+++ b/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>osbp-runtime-web</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..692c4de
--- /dev/null
+++ b/README.md
@@ -0,0 +1,4 @@
+lunifera-web
+============
+
+Bundles for runtime web. \ No newline at end of file
diff --git a/about.html b/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch
new file mode 100644
index 0000000..1dabfc2
--- /dev/null
+++ b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy Temp.launch
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="clean verify -Dlunifera.build.uses.local.composite.p2 -Dlunifera.build.uses.remote.composite.p2 -Dlunifera.deploy.to.local.composit"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
+<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/>
+</launchConfiguration>
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch
new file mode 100644
index 0000000..bf264fb
--- /dev/null
+++ b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build and Deploy.launch
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="clean verify -Dlunifera.deploy.to.local.composite.p2"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
+<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/>
+</launchConfiguration>
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch
new file mode 100644
index 0000000..cfc8a21
--- /dev/null
+++ b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build skiping tests.launch
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="clean verify -fn"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
+<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/>
+</launchConfiguration>
diff --git a/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch
new file mode 100644
index 0000000..bf264fb
--- /dev/null
+++ b/eclipse-launchers/lunifera-runtime-web - P2 Kepler - Build.launch
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="clean verify -Dlunifera.deploy.to.local.composite.p2"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value="lunifera.build.p2"/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
+<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=256m"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.eclipse.osbp.runtime.web}"/>
+</launchConfiguration>
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
new file mode 100644
index 0000000..02ff6a1
--- /dev/null
+++ b/jenkins.build.config.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2016 - Loetz GmbH&Co.KG -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+<!--# Module specific parameters for the Jenkins Job -->
+<!--#======================================================================= -->
+
+<jenkins>
+
+ <!-- DO NOT EDIT BELOW THIS LINE -->
+ <jenkins.build.dependencies>
+ <jenkins.build.dependency>org.eclipse.osbp.dsl</jenkins.build.dependency>
+ <jenkins.build.dependency>org.eclipse.osbp.ecview.core</jenkins.build.dependency>
+ <jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency>
+ </jenkins.build.dependencies>
+</jenkins>
diff --git a/notice.html b/notice.html
new file mode 100644
index 0000000..c3d34c3
--- /dev/null
+++ b/notice.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 9, 2014</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/.project b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.project
new file mode 100644
index 0000000..495303a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/.project
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.atmosphere.fragment</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/LICENSE.txt b/org.eclipse.osbp.runtime.web.atmosphere.fragment/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ea7f799
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.atmosphere.fragment
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.atmosphere.fragment
+Bundle-Version: 0.9.0.qualifier
+Bundle-Vendor: Eclipse OSBP
+Fragment-Host: com.vaadin.external.atmosphere.runtime;bundle-version="2.2.7.vaadin1"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.annotation;version="2.6.0",
+ javax.servlet.descriptor;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ javax.servlet.resources;version="2.6.0"
+Require-Bundle: org.eclipse.jetty.websocket;bundle-version="8.1.16"
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.html b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.ini b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.mappings b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.properties b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.properties
new file mode 100644
index 0000000..471d894
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.atmosphere.fragment
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/build.properties b/org.eclipse.osbp.runtime.web.atmosphere.fragment/build.properties
new file mode 100644
index 0000000..0e91489
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/build.properties
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ pom.xml,\
+ build.properties,\
+ .classpath,\
+ .project,\
+ .settings/,\
+ LICENSE.txt
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/pom.xml b/org.eclipse.osbp.runtime.web.atmosphere.fragment/pom.xml
new file mode 100644
index 0000000..79932fc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.atmosphere.fragment</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.atmosphere.fragment/src/NO-SOURCE b/org.eclipse.osbp.runtime.web.atmosphere.fragment/src/NO-SOURCE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.atmosphere.fragment/src/NO-SOURCE
diff --git a/org.eclipse.osbp.runtime.web.common.tests/.project b/org.eclipse.osbp.runtime.web.common.tests/.project
new file mode 100644
index 0000000..f4d71a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/.project
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.common.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.common.tests/LICENSE.txt b/org.eclipse.osbp.runtime.web.common.tests/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..83b5abd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.common.tests
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.common.tests
+Bundle-Version: 0.9.0.qualifier
+Require-Bundle: org.eclipse.osbp.runtime.web.common;bundle-version="[0.9.0,0.10.0)",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.equinox.preferences;bundle-version="3.5.0",
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse OSBP
+Service-Component: OSGI-INF/*.xml
+Import-Package: org.eclipse.osgi.service.datalocation;version="1.3.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.component;version="1.2.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.osbp.runtime.web.common.tests.Activator
diff --git a/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextFactory.xml b/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextFactory.xml
new file mode 100644
index 0000000..57d5378
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextFactory.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" factory="org.eclipse.osbp.runtime.web.common.contextfactory/test" immediate="false" name="org.eclipse.osbp.runtime.web.common.tests.contextfactory">
+ <implementation class="org.eclipse.osbp.runtime.web.common.tests.context.TestWebContext"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.common.IWebContext"/>
+ </service>
+ <reference bind="setPreferencesService" cardinality="0..1" interface="org.osgi.service.prefs.PreferencesService" name="preferencesService" policy="dynamic" unbind="unsetPreferencesService"/>
+</scr:component>
+ \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistry.xml b/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistry.xml
new file mode 100644
index 0000000..8a707d9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistry.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.runtime.web.common.tests.contextregistry">
+ <implementation class="org.eclipse.osbp.runtime.web.common.tests.context.TestWebContextRegistry"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.common.IWebContextRegistry"/>
+ </service>
+ <reference bind="setFactory" cardinality="0..1" interface="org.osgi.service.component.ComponentFactory" name="contextFactory" policy="dynamic" target="(component.factory=org.eclipse.osbp.runtime.web.common.contextfactory/test)" unbind="unsetFactory"/>
+ <property name="osbp.web.common.context.uikit" type="String" value="test"/>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistryHelper.xml b/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistryHelper.xml
new file mode 100644
index 0000000..9255ebe
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/OSGI-INF/contextRegistryHelper.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.common.tests.contextregistryhelper">
+ <implementation class="org.eclipse.osbp.runtime.web.common.tests.context.ContextRegistryHelper"/>
+ <reference bind="setRegistry" cardinality="1..1" interface="org.eclipse.osbp.runtime.web.common.IWebContextRegistry" name="webContextRegistry" policy="static" target="(osbp.web.common.context.uikit=test)" unbind="unsetRegistry"/>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.common.tests/build.properties b/org.eclipse.osbp.runtime.web.common.tests/build.properties
new file mode 100644
index 0000000..255b1af
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/build.properties
@@ -0,0 +1,5 @@
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
+source.. = src/
diff --git a/org.eclipse.osbp.runtime.web.common.tests/pom.xml b/org.eclipse.osbp.runtime.web.common.tests/pom.xml
new file mode 100644
index 0000000..3d06db2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.common.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.common.tests/src/org/eclipse/osbp/runtime/web/common/tests/Activator.java b/org.eclipse.osbp.runtime.web.common.tests/src/org/eclipse/osbp/runtime/web/common/tests/Activator.java
new file mode 100644
index 0000000..05200d0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common.tests/src/org/eclipse/osbp/runtime/web/common/tests/Activator.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.common.tests;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ public static BundleContext context;
+
+ // private static boolean locationRegistered;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ }
+
+ /**
+ * Registers the user area default location as an OSGi service.
+ *
+ * @throws IOException
+ * @throws MalformedURLException
+ */
+ public static void registerUserLocation() throws IOException,
+ MalformedURLException {
+ // if (locationRegistered) {
+ // return;
+ // }
+ // BasicLocation location = new BasicLocation("", null, false, null);
+ // location.set(new File(System.getProperty("user.home"),
+ // "osbp_test")
+ // .toURL(), false);
+ // Hashtable<String, Object> properties = new Hashtable<String,
+ // Object>();
+ // properties.put("type", "osgi.user.area");
+ // context.registerService(Location.class, location, properties);
+ // locationRegistered = true;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.common/.project b/org.eclipse.osbp.runtime.web.common/.project
new file mode 100644
index 0000000..200c586
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/.project
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.common/LICENSE.txt b/org.eclipse.osbp.runtime.web.common/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6263d80
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.common
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.common
+Bundle-Version: 0.9.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse OSBP
+Import-Package: org.osgi.service.component;version="1.2.0",
+ org.osgi.service.prefs;version="1.1.1"
+Export-Package: org.eclipse.osbp.runtime.web.common;
+ uses:="org.eclipse.osbp.runtime.common.user,
+ org.eclipse.osbp.runtime.common.dispose";version="0.9.0",
+ org.eclipse.osbp.runtime.web.common.context;
+ uses:="org.eclipse.osbp.runtime.common.user,
+ org.osgi.service.prefs,
+ org.eclipse.osbp.runtime.common.dispose,
+ org.osgi.service.component,
+ org.eclipse.osbp.runtime.web.common";version="0.9.0",
+ org.eclipse.osbp.runtime.web.common.context.preferences;x-internal:=true;version="0.9.0"
+Require-Bundle: org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)"
diff --git a/org.eclipse.osbp.runtime.web.common/about.html b/org.eclipse.osbp.runtime.web.common/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.common/about.ini b/org.eclipse.osbp.runtime.web.common/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.common/about.mappings b/org.eclipse.osbp.runtime.web.common/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.common/about.properties b/org.eclipse.osbp.runtime.web.common/about.properties
new file mode 100644
index 0000000..fbde109
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.common
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.common/build.properties b/org.eclipse.osbp.runtime.web.common/build.properties
new file mode 100644
index 0000000..edc7aca
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/build.properties
@@ -0,0 +1,6 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ LICENSE.txt
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.common/pom.xml b/org.eclipse.osbp.runtime.web.common/pom.xml
new file mode 100644
index 0000000..7b96121
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.common</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/ContextAccess.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/ContextAccess.java
new file mode 100644
index 0000000..c966204
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/ContextAccess.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.common;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An accessor class that returns objects that are registered with the current
+ * thread.
+ */
+public class ContextAccess {
+
+ /** The Constant webContext. */
+ private static final ThreadLocal<IWebContext> webContext = new ThreadLocal<IWebContext>();
+
+ /**
+ * Returns the context that was registered with the current thread. If no
+ * context was registered then <code>null</code> will be returned.
+ *
+ * @return the context
+ */
+ public static IWebContext getContext() {
+ return webContext.get();
+ }
+
+ /**
+ * Registers the given web context with the current thread.
+ *
+ * @param session
+ * the new context
+ */
+ public static void setContext(IWebContext session) {
+ webContext.set(session);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IConstants.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IConstants.java
new file mode 100644
index 0000000..fd7155b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IConstants.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.common;
+
+public interface IConstants {
+
+ /**
+ * OSGi property used to define unique id of web context.
+ */
+ public static final String OSGI_PROPERTY__WEB_CONTEXT__ID = "osbp.web.common.context.id";
+
+ /**
+ * OSGi property to define user id of web context.
+ */
+ public static final String OSGI_PROPERTY__WEB_CONTEXT__USER = "osbp.web.common.context.user";
+
+ /**
+ * OSGi property to define the vendor of the ui kit.
+ */
+ public static final String OSGI_PROPERTY__WEB_CONTEXT__VENDOR = "osbp.web.common.context.vendor";
+}
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContext.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContext.java
new file mode 100644
index 0000000..d81a2cc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContext.java
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.common;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.common.dispose.IDisposable;
+import org.eclipse.osbp.runtime.common.user.IUserInfo;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A web context is an object that offers access to features that are related
+ * with a browser tab. One http sessoin may have many web contexts. The web
+ * context is attached to the current thread as far as a request is processed by
+ * the http servlet. For concurrent threads no web context is attached to them.
+ * So concurrent threads have to query the web context and use the sync-methods
+ * to run a runnable in a web context.
+ * <p>
+ * To dispose a web context call {@link #dispose()}.
+ */
+public interface IWebContext extends IDisposable {
+
+ /**
+ * Returns the unique id of the web context.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Returns the i18n service configured with the settings of that context.
+ * For instance the locale of the context will be used to return the proper
+ * i18n service.
+ *
+ */
+ // TODO: check the definition and the description - this returns nothing
+ void getI18nService();
+
+ /**
+ * Returns the locale of that context.
+ *
+ * @return the locale
+ */
+ Locale getLocale();
+
+ /**
+ * Returns the user info this context is assigned to. Never
+ * <code>null</code>.
+ *
+ * @return the user info
+ */
+ IUserInfo getUserInfo();
+
+ /**
+ * Returns the value for the given property or <code>null</code> if the
+ * value is not available.
+ *
+ * @param property
+ * the property
+ * @return the property
+ */
+ Object getProperty(String property);
+
+ /**
+ * Executes the given runnable in the context of that web context. Therefore
+ * it will sync with the web environment before executing the runnable.
+ *
+ * @param runnable
+ * the runnable
+ */
+ public void syncExec(Runnable runnable);
+
+ /**
+ * Executes the given runnable in the context of that web context in an
+ * async mode. Therefore it will sync with the web environment before
+ * executing the runnable.
+ *
+ * @param runnable
+ * the runnable
+ */
+ public void asyncExec(Runnable runnable);
+}
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContextRegistry.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContextRegistry.java
new file mode 100644
index 0000000..9d1a740
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/IWebContextRegistry.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.common;
+
+import java.util.Map;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A registry for web contexts. Web contexts are created by that service. And it
+ * also observes the lifecycle of them.
+ */
+public interface IWebContextRegistry {
+
+ /**
+ * Returns the count of the contained contexts.
+ *
+ * @return the int
+ */
+ int size();
+
+ /**
+ * Creates a webcontext for the given user.
+ *
+ * @param user
+ * The user id.
+ * @param properties
+ * Will be passed to the context. Should only contain primitive
+ * types, their wrappers and java types.
+ * @return the i web context
+ */
+ IWebContext createContext(String user, Map<String, Object> properties);
+
+ /**
+ * Returns the webcontext for the given id or <code>null</code> if no
+ * context is available.
+ *
+ * @param id
+ * the id
+ * @return the context
+ */
+ IWebContext getContext(String id);
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractUserInfo.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractUserInfo.java
new file mode 100644
index 0000000..928b835
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractUserInfo.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.common.context;
+
+import org.eclipse.osbp.runtime.common.user.IUserInfo;
+
+
+public abstract class AbstractUserInfo implements IUserInfo {
+
+ private final String userId;
+
+ AbstractUserInfo(String userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public String getId() {
+ return userId;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContext.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContext.java
new file mode 100644
index 0000000..b47384d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContext.java
@@ -0,0 +1,193 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.common.context;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.user.IUserInfo;
+import org.eclipse.osbp.runtime.web.common.IConstants;
+import org.eclipse.osbp.runtime.web.common.IWebContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.ComponentInstance;
+import org.osgi.service.prefs.Preferences;
+import org.osgi.service.prefs.PreferencesService;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AbstractWebContext.
+ */
+public abstract class AbstractWebContext extends AbstractDisposable implements
+ IWebContext {
+
+ /** The user info. */
+ private IUserInfo userInfo = null;
+
+ /** The id. */
+ private String id;
+
+ /** The preferences service. */
+ private PreferencesService preferencesService;
+
+ /** The properties. */
+ // private Location userLocation;
+ private Map<String, Object> properties;
+
+ /** The instance. */
+ private ComponentInstance instance;
+
+ /**
+ * Called by OSGi-DS.
+ */
+ public AbstractWebContext() {
+
+ }
+
+ /**
+ * Activate.
+ *
+ * @param context
+ * the context
+ * @param properties
+ * the properties
+ */
+ protected void activate(ComponentContext context,
+ Map<String, Object> properties) {
+ this.properties = properties;
+ this.instance = context.getComponentInstance();
+
+ id = (String) properties.get(IConstants.OSGI_PROPERTY__WEB_CONTEXT__ID);
+ // prepare the user info
+ userInfo = new AbstractUserInfo(
+ (String) properties
+ .get(IConstants.OSGI_PROPERTY__WEB_CONTEXT__USER)) {
+ @Override
+ public Preferences getPreferences(String qualifier) {
+ if (preferencesService == null || getId() == null) {
+ return null;
+ }
+ return preferencesService.getUserPreferences(getId());
+ }
+
+ // @Override
+ // public String getLocation() {
+ // return System.getProperty("user.home") + "/" + getId();
+ // }
+ };
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContext#getId()
+ */
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContext#getUserInfo()
+ */
+ @Override
+ public IUserInfo getUserInfo() {
+ return userInfo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContext#getI18nService()
+ */
+ @Override
+ public void getI18nService() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContext#getLocale()
+ */
+ @Override
+ public Locale getLocale() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.common.dispose.AbstractDisposable#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ userInfo = null;
+
+ if (instance != null) {
+ instance.dispose();
+ }
+ }
+
+ /**
+ * Called by OSGi-DS.
+ */
+ protected void deactivate() {
+ instance = null;
+ if (canDispose()) {
+ // should not happen for normal. But if the context was deactivated
+ // by ComponentInstance.dispose() we ensure that WebContext.dispose
+ // is called too.
+ dispose();
+ }
+ }
+
+ /**
+ * Called by OSGi-DS.
+ *
+ * @param service
+ * the new preferences service
+ */
+ protected void setPreferencesService(PreferencesService service) {
+ this.preferencesService = service;
+ }
+
+ /**
+ * Called by OSGi-DS.
+ *
+ * @param service
+ * the service
+ */
+ protected void unsetPreferencesService(PreferencesService service) {
+ this.preferencesService = null;
+ }
+
+ // /**
+ // * Called by OSGi-DS
+ // *
+ // * @param service
+ // */
+ // public void setUserLocation(Location userLocation) {
+ // this.userLocation = userLocation;
+ // }
+ //
+ // /**
+ // * Called by OSGi-DS
+ // *
+ // * @param service
+ // */
+ // public void unsetUserLocation(Location userLocation) {
+ // this.userLocation = null;
+ // }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContext#getProperty(java.lang.String)
+ */
+ @Override
+ public Object getProperty(String property) {
+ return properties.get(property);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContextRegistry.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContextRegistry.java
new file mode 100644
index 0000000..2fd4356
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/AbstractWebContextRegistry.java
@@ -0,0 +1,128 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.common.context;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.osbp.runtime.common.dispose.IDisposable;
+import org.eclipse.osbp.runtime.web.common.IWebContext;
+import org.eclipse.osbp.runtime.web.common.IWebContextRegistry;
+import org.osgi.service.component.ComponentFactory;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AbstractWebContextRegistry.
+ */
+public abstract class AbstractWebContextRegistry implements
+ IDisposable.Listener, IWebContextRegistry {
+
+ /** The factory. */
+ private ComponentFactory factory;
+
+ /** The contexts. */
+ private Map<String, IWebContext> contexts = Collections
+ .synchronizedMap(new HashMap<String, IWebContext>());
+
+ /**
+ * Called by OSGi-DS. Sets the component factory that is used to create
+ * instances of web context.
+ *
+ * @param factory
+ * the new factory
+ */
+ protected void setFactory(ComponentFactory factory) {
+ this.factory = factory;
+ }
+
+ /**
+ * Called by OSGi-DS. Unsets the component factory that is used to create
+ * instances of web context.
+ *
+ * @param factory
+ * the factory
+ */
+ protected void unsetFactory(ComponentFactory factory) {
+ this.factory = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContextRegistry#size()
+ */
+ @Override
+ public int size() {
+ return contexts.size();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContextRegistry#getContext(java.lang.String)
+ */
+ @Override
+ public IWebContext getContext(String id) {
+ return (IWebContext) (contexts.containsKey(id) ? contexts.get(id)
+ : null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.common.IWebContextRegistry#createContext(java.lang.String, java.util.Map)
+ */
+ @Override
+ public IWebContext createContext(String user, Map<String, Object> properties) {
+ IWebContext context = doCreateContext(factory, user, properties);
+ contexts.put(context.getId(), context);
+ return context;
+ }
+
+ /**
+ * Delegates the creation of the context to the subclass.
+ *
+ * @param factory
+ * the factory
+ * @param user
+ * the user
+ * @param properties
+ * the properties
+ * @return the i web context
+ */
+ protected abstract IWebContext doCreateContext(ComponentFactory factory,
+ String user, Map<String, Object> properties);
+
+ /**
+ * Notifies that a web context was disposed.
+ *
+ * @param notifier
+ * the notifier
+ */
+ @Override
+ public void notifyDisposed(IDisposable notifier) {
+
+ // remove this as a dispose listener
+ //
+ notifier.removeDisposeListener(this);
+
+ // look for the context
+ //
+ String disposedId = null;
+ synchronized (contexts) {
+ for (Map.Entry<String, IWebContext> entry : contexts.entrySet()) {
+ if (notifier == entry.getValue()) {
+ disposedId = entry.getKey();
+ break;
+ }
+ }
+
+ if (disposedId != null) {
+ contexts.remove(disposedId);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/preferences/UserScope.java b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/preferences/UserScope.java
new file mode 100644
index 0000000..5b16b11
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.common/src/org/eclipse/osbp/runtime/web/common/context/preferences/UserScope.java
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.common.context.preferences;
+
+import org.eclipse.osbp.runtime.common.user.IUserInfo;
+
+
+/**
+ * Object representing the project scope in the Eclipse preferences hierarchy.
+ * Can be used as a context for searching for preference values (in the
+ * <code>org.eclipse.core.runtime.IPreferencesService</code> APIs) or for
+ * determining the correct preference node to set values in the store.
+ * <p>
+ * User preferences are stored on a per user basis in the user's content area as
+ * specified by <code>IUserInfo</code>.
+ *
+ * <p>
+ * The path for preferences defined in the user scope hierarchy is as follows:
+ * <code>/user/&lt;username&gt;/&lt;qualifier&gt;</code>
+ *
+ * <p>
+ * This class is not intended to be subclassed. This class may be instantiated.
+ *
+ *
+ * @see IUserInfo
+ */
+public final class UserScope {
+
+ // implements IScopeContext {
+
+ // /**
+ // * String constant (value of <code>"user"</code>) used for the scope name
+ // * for this preference scope.
+ // */
+ // public static final String SCOPE = "user"; //$NON-NLS-1$
+ //
+ // private final IPreferencesService preferencesService;
+ // private final String datalocation;
+ // private final String userId;
+ //
+ // /**
+ // * Create and return a new user scope for the given user info. The given
+ // * context must not be <code>null</code>.
+ // *
+ // * @param preferencesService
+ // * @param datalocation
+ // * the datalocation
+ // * @param userId
+ // * the userId
+ // * @exception IllegalArgumentException
+ // * if the the information is <code>null</code>
+ // */
+ // public UserScope(IPreferencesService preferencesService,
+ // String datalocation, String userId) {
+ // super();
+ // if (preferencesService == null || datalocation == null
+ // || datalocation.equals("") || userId == null)
+ // throw new IllegalArgumentException();
+ // this.preferencesService = preferencesService;
+ // this.datalocation = datalocation;
+ // this.userId = userId;
+ // }
+ //
+ // public IEclipsePreferences getNode(String qualifier) {
+ // if (qualifier == null)
+ // throw new IllegalArgumentException();
+ // return (IEclipsePreferences) preferencesService.getRootNode()
+ // .node(SCOPE).node(userId).node(qualifier);
+ // }
+ //
+ // public IPath getLocation() {
+ // return new Path(datalocation).append(".settings");
+ // }
+ //
+ // public String getName() {
+ // return SCOPE;
+ // }
+ //
+ // @Override
+ // public int hashCode() {
+ // final int prime = 31;
+ // int result = 1;
+ // result = prime * result
+ // + ((datalocation == null) ? 0 : datalocation.hashCode());
+ // result = prime * result + ((userId == null) ? 0 : userId.hashCode());
+ // return result;
+ // }
+ //
+ // @Override
+ // public boolean equals(Object obj) {
+ // if (this == obj)
+ // return true;
+ // if (obj == null)
+ // return false;
+ // if (getClass() != obj.getClass())
+ // return false;
+ // UserScope other = (UserScope) obj;
+ // if (datalocation == null) {
+ // if (other.datalocation != null)
+ // return false;
+ // } else if (!datalocation.equals(other.datalocation))
+ // return false;
+ // if (userId == null) {
+ // if (other.userId != null)
+ // return false;
+ // } else if (!userId.equals(other.userId))
+ // return false;
+ // return true;
+ // }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.project b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.project
new file mode 100644
index 0000000..979019c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/.project
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/LICENSE.txt b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..af5bf74
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,33 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests
+Bundle-Version: 0.9.0.qualifier
+Bundle-ClassPath: .
+Require-Bundle: com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.emf.databinding;bundle-version="1.3.0",
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.beans;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.extension.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.ui.presentation.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)",
+ org.jsoup;bundle-version="1.7.2"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Vendor: Eclipse OSBP
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.cm;version="1.4.0",
+ org.osgi.service.component;version="1.2.0",
+ org.osgi.service.http;version="1.2.1",
+ org.slf4j;version="1.6.1"
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/build.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/build.properties
new file mode 100644
index 0000000..4465407
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/build.properties
@@ -0,0 +1,10 @@
+#
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/pom.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/pom.xml
new file mode 100644
index 0000000..4498fb7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/pom.xml
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany). -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Florian Pirchner - initial API and implementation -->
+<!--#======================================================================= -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*IT.class</include>
+ </includes>
+ <failIfNoTests>false</failIfNoTests>
+ <showEclipseLog>true</showEclipseLog>
+ <argLine>-Dorg.osgi.service.http.port=8080</argLine>
+
+ <bundleStartLevel>
+ <!-- WS -->
+ <bundle>
+ <id>org.eclipse.equinox.http.jetty</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.http.servlet</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>ch.qos.logback.classic</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>ch.qos.logback.core</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>ch.qos.logback.slf4j</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.google.guava</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.google.gwt.thirdparty.guava</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.google.gwt.thirdparty.streamhtmlparser</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.ibm.icu</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.vaadin.client</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.vaadin.server</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.vaadin.shared</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.annotation</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.inject</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.persistence</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.servlet</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.transaction</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.validation</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.xml</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.batik.css</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.batik.util</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.batik.util.gui</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.collections</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.lang</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.logging</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.xerces</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.xml.resolver</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.xml.serializer</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.compare.core</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.commands</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.contenttype</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding.beans</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding.observable</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding.property</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.expressions</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.filesystem.java7</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.filesystem</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.jobs</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.resources</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.runtime.compatibility.registry</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.runtime</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.variables</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.databinding</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore.change</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore.edit</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore.xmi</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.edit</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.app</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.bidi</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.common</id>
+ <level>2</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.coordinator</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.ds</id>
+ <level>1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.preferences</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.region</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.registry</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.security</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.transforms.hook</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.util</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.weaving.hook</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.compatibility.state</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.services</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.util</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi</id>
+ <level>-1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.xsd</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.hamcrest.core</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.json</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.jsoup</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.junit</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.slf4j.api</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.css.sac</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.dom.events</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.dom.smil</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.dom.svg</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.flute</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>osgi.enterprise</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>slf4j.api</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ </bundleStartLevel>
+
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/setup/user-target.target b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/setup/user-target.target
new file mode 100644
index 0000000..099457c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/setup/user-target.target
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target includeMode="feature" name="user-target" sequenceNumber="59">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.jdt.feature.group" version="3.9.2.v20140221-1700"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.equinox.sdk.feature.group" version="3.9.0.v20140221-1852"/>
+<unit id="org.eclipse.platform.sdk" version="4.3.2.M20140221-1700"/>
+<unit id="org.eclipse.emf.sdk.feature.group" version="2.9.2.v20140203-1126"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.commons.math" version="2.1.0.v201105210652"/>
+<unit id="org.apache.commons.lang" version="2.6.0.v201205030909"/>
+<unit id="org.apache.commons.collections" version="3.2.0.v201005080500"/>
+<unit id="org.apache.commons.beanutils" version="1.8.0.v201205091237"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.junit.source" version="4.10.0.v4_10_0_v20120426-0900"/>
+<unit id="org.junit" version="4.10.0.v4_10_0_v20120426-0900"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.persistence.sdk.feature.group" version="2.5.1.v20130913-5eaeb06"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.source.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.source.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.source.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.source.feature.group" version="0.0.1.201406122143"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.httpcomponents.httpclient" version="4.1.2.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpclient.source" version="4.1.2.v201203221030"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.feature.group" version="0.0.1.201406122002"/>
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.source.feature.group" version="0.0.1.201406122002"/>
+<repository location="http://lun.lunifera.org/downloads/p2/ecview/nightly/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.httpcomponents.httpcore.source" version="4.1.4.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpcore" version="4.1.4.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpcore.nio" version="4.1.0.v201101201700"/>
+<unit id="org.apache.httpcomponents.httpcore.nio.source" version="4.1.0.v201101201700"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location path="${project_loc}/setup/lib" type="Directory"/>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.assert-utilities.feature.group" version="1.2.2"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.source.feature.group" version="0.0.1.201405120903"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.feature.group" version="0.0.1.201405120903"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.vaadin.feature.group" version="7.1.9"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java
new file mode 100644
index 0000000..3a709c2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import javax.servlet.ServletException;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+public class Activator implements BundleActivator,
+ServiceTrackerCustomizer<HttpService, HttpService>, BundleListener {
+
+ private static BundleContext context;
+ private static Activator plugin;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ private ServiceTracker<HttpService, HttpService> tracker;
+
+ // used to register servlets
+ private HttpService httpService;
+ private ResourceProvider resourceProvider;
+
+ /**
+ * @return the plugin
+ */
+ public static Activator getPlugin() {
+ return plugin;
+ }
+
+ //
+ // Helper methods to get an instance of the http service
+ //
+ @Override
+ public HttpService addingService(ServiceReference<HttpService> reference) {
+ httpService = context.getService(reference);
+
+ try {
+ // register the servlet at the http service
+ httpService.registerServlet("/", new ECViewTestsServlet(), null,
+ resourceProvider);
+ } catch (ServletException e) {
+ e.printStackTrace();
+ } catch (NamespaceException e) {
+ e.printStackTrace();
+ }
+
+ return httpService;
+ }
+
+ @Override
+ public void removedService(ServiceReference<HttpService> reference,
+ HttpService service) {
+ // unregister the servlet from the http service
+ httpService.unregister("/");
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<HttpService> reference,
+ HttpService service) {
+
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ Activator.plugin = this;
+
+ resourceProvider = new ResourceProvider();
+
+ handleStartedBundles(context);
+
+ // register this instance as a bundle listener to an reference to all
+ // vaadin bundles. Used to find the static resources.
+ bundleContext.addBundleListener(this);
+
+ // Start a HttpService-Tracker to get an instance of HttpService
+ tracker = new ServiceTracker<>(bundleContext, HttpService.class, this);
+ tracker.open();
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // close the HttpService-tracker
+ tracker.close();
+ tracker = null;
+
+
+ resourceProvider = null;
+
+ bundleContext.removeBundleListener(this);
+
+ Activator.context = null;
+ Activator.plugin = null;
+ }
+
+ /**
+ * Tries to find proper started bundles and adds them to resource provider.
+ * Since bundle changed listener will not find them.
+ *
+ * @param context
+ */
+ protected void handleStartedBundles(BundleContext context) {
+ for (Bundle bundle : context.getBundles()) {
+ String name = bundle.getSymbolicName();
+ if (bundle.getState() == Bundle.ACTIVE
+ && (name.startsWith("com.vaadin") || name
+ .equals("org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui"))) {
+ resourceProvider.add(bundle);
+ }
+ }
+ }
+
+ @Override
+ public void bundleChanged(BundleEvent event) {
+ // tracks the starting and stopping of vaadin bundles. If a bundle is a
+ // vaadin bundle it will be added to the resource provider for lookups.
+ String name = event.getBundle().getSymbolicName();
+ if (name.startsWith("com.vaadin")
+ || name.equals("org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui")) {
+ if (event.getType() == BundleEvent.STARTED) {
+ resourceProvider.add(event.getBundle());
+ } else if (event.getType() == BundleEvent.STOPPED) {
+ resourceProvider.remove(event.getBundle());
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java
new file mode 100644
index 0000000..ae16763
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+public class DummyApplication implements IApplication {
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ return null;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java
new file mode 100644
index 0000000..9fd4cf4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
+
+/**
+ * An implementation of VaadinServlet that uses SimpleUI as its base UI.
+ */
+@SuppressWarnings("serial")
+@VaadinServletConfiguration(ui = ECViewTestsUI.class, productionMode = false)
+public class ECViewTestsServlet extends VaadinServlet {
+
+ @Override
+ protected VaadinServletService createServletService(
+ DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+ return new ECViewTestsServletService(this, deploymentConfiguration);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java
new file mode 100644
index 0000000..9f45cc1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
+
+@SuppressWarnings("serial")
+public class ECViewTestsServletService extends VaadinServletService {
+
+ public ECViewTestsServletService(VaadinServlet servlet,
+ DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+ super(servlet, deploymentConfiguration);
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return getClass().getClassLoader();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java
new file mode 100644
index 0000000..fd06653
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.Page;
+import com.vaadin.server.Page.UriFragmentChangedEvent;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+@SuppressWarnings("serial")
+@Theme(Reindeer.THEME_NAME)
+public class ECViewTestsUI extends UI {
+
+ private static final String SAMPLE_PACKAGE = "org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples";
+ private VerticalLayout layout;
+
+ @Override
+ protected void init(VaadinRequest request) {
+ layout = new VerticalLayout();
+ layout.setSizeFull();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ setContent(layout);
+
+ layout.addComponent(new Label("Insert URL fragment to open testclass"));
+
+ getPage().addUriFragmentChangedListener(
+ new Page.UriFragmentChangedListener() {
+ @Override
+ public void uriFragmentChanged(final UriFragmentChangedEvent event) {
+ getUI().accessSynchronously(new Runnable() {
+ @Override
+ public void run() {
+ VaadinObservables.getRealm(getUI());
+ String fragment = event.getUriFragment();
+ handleFragment(SAMPLE_PACKAGE + "." + fragment);
+ }
+ });
+ }
+ });
+ }
+
+ protected void handleFragment(String className) {
+ try {
+ Class<?> clazz = Activator.getContext().getBundle()
+ .loadClass(className);
+ if (Component.class.isAssignableFrom(clazz)) {
+ layout.removeAllComponents();
+
+ Component component = (Component) clazz.newInstance();
+ component.setSizeFull();
+ layout.addComponent(component);
+ } else {
+ handleError(className);
+ }
+ } catch (ClassNotFoundException e) {
+ handleError(className);
+ } catch (InstantiationException e) {
+ handleError(className);
+ } catch (IllegalAccessException e) {
+ handleError(className);
+ }
+ }
+
+ private void handleError(String clazzname) {
+ layout.removeAllComponents();
+ layout.addComponent(new Label(clazzname
+ + " is not a valid test sample!"));
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java
new file mode 100644
index 0000000..9dd2748
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java
@@ -0,0 +1,76 @@
+ /**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
+/**
+ * Resource provider is responsible to look for resources requested by the
+ * HttpService. Therefore it uses the classpath of registered bundles.
+ */
+public class ResourceProvider implements HttpContext {
+
+ private List<Bundle> resources = new ArrayList<Bundle>();
+
+ @Override
+ public URL getResource(String uri) {
+ URL resource = null;
+ // iterate over the vaadin bundles and try to find the requested
+ // resource
+ for (Bundle bundle : resources) {
+ resource = bundle.getResource(uri);
+ if (resource != null) {
+ break;
+ }
+ }
+ return resource;
+ }
+
+ /**
+ * Adds a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void add(Bundle bundle) {
+ if(!resources.contains(bundle)){
+ resources.add(bundle);
+ }
+ }
+
+ /**
+ * Removes a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void remove(Bundle bundle) {
+ resources.remove(bundle);
+ }
+
+ @Override
+ public String getMimeType(String arg0) {
+ return null;
+ }
+
+ @Override
+ public boolean handleSecurity(HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+ return true;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java
new file mode 100644
index 0000000..ec4e364
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * Default implementation of value bean. Offerns {@link PropertyChangeSupport}.
+ */
+public class AbstractBean {
+ private final PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
+ public AbstractBean() {
+ }
+
+ /**
+ * Adds the given property change listener to the change support.
+ *
+ * @param listener
+ * Listener to be added
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Adds the given property change listener to the change support.
+ *
+ * @param property
+ * Name of the property
+ * @param listener
+ * Listener to be added
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(String property,
+ PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(property, listener);
+ }
+
+ /**
+ * Removes the given property change listener from the change support.
+ *
+ * @param listener
+ * Listener to be removed
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes the given property change listener from the change support.
+ *
+ * @param property
+ * Name of the property
+ * @param listener
+ * Listener to be removed
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(String property,
+ PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(property, listener);
+ }
+
+ /**
+ * Fires the property changed event.
+ *
+ * @param property
+ * Name of the property
+ * @param oldValue
+ * The old value
+ * @param newValue
+ * The new value
+ * @see java.beans.PropertyChangeSupport#firePropertyChange(String, Object,
+ * Object)
+ */
+ protected void firePropertyChanged(String property, Object oldValue,
+ Object newValue) {
+ changeSupport.firePropertyChange(property, oldValue, newValue);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java
new file mode 100644
index 0000000..f554b58
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+
+public class CheckBoxSample extends CustomComponent {
+
+ private CssLayout layout;
+
+ public CheckBoxSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+ CheckBox checkbox = new CheckBox();
+ layout.addComponent(checkbox);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java
new file mode 100644
index 0000000..6ba3607
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java
@@ -0,0 +1,141 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class DatetimeFieldSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public DatetimeFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YDateTime yText2_1 = factory.createDateTime();
+ yText2_1.setLabel("date");
+ row2.addElement(yText2_1);
+ YDateTimeDatatype yDt2_2 = createDateTimeDatatype();
+ yDt2_2.setFormat(YDateTimeFormat.DATE);
+ yText2_1.setDatatype(yDt2_2);
+
+ YDateTime yText2_2 = factory.createDateTime();
+ yText2_2.setLabel("time");
+ row2.addElement(yText2_2);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yText2_2.setDatatype(yDt2_1);
+
+ YDateTime yText2_3 = factory.createDateTime();
+ yText2_3.setLabel("datetime");
+ row2.addElement(yText2_3);
+ YDateTimeDatatype yDt2_3 = createDateTimeDatatype();
+ yDt2_3.setFormat(YDateTimeFormat.DATE_TIME);
+ yText2_3.setDatatype(yDt2_3);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("switchLocale");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ Locale locale = context.getLocale();
+ if (locale == Locale.GERMANY) {
+ context.setLocale(Locale.US);
+ } else {
+ context.setLocale(Locale.GERMANY);
+ }
+ }
+ });
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YDateTime yText1_1 = factory.createDateTime();
+ yText1_1.setLabel("Field1");
+ YDateTime yText1_2 = factory.createDateTime();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java
new file mode 100644
index 0000000..8cf5dba
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java
@@ -0,0 +1,143 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class DecimalFieldSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public DecimalFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YDecimalField yText2_1 = factory.createDecimalField();
+ yText2_1.setLabel("grouping false");
+ row2.addElement(yText2_1);
+ YDecimalDatatype yDt2_2 = factory.createDecimalDatatype();
+ yDt2_2.setGrouping(false);
+ yText2_1.setDatatype(yDt2_2);
+
+ YDecimalField yText2_2 = factory.createDecimalField();
+ yText2_2.setLabel("grouping true");
+ row2.addElement(yText2_2);
+ YDecimalDatatype yDt2_1 = factory.createDecimalDatatype();
+ yDt2_1.setGrouping(true);
+ yText2_2.setDatatype(yDt2_1);
+
+ YDecimalField yText2_3 = factory.createDecimalField();
+ yText2_3.setLabel("mark negative");
+ row2.addElement(yText2_3);
+ YDecimalDatatype yDt2_3 = factory.createDecimalDatatype();
+ yDt2_3.setMarkNegative(true);
+ yText2_3.setDatatype(yDt2_3);
+
+ YDecimalField yText2_4 = factory.createDecimalField();
+ yText2_4.setLabel("digits6");
+ row2.addElement(yText2_4);
+ YDecimalDatatype yDt2_4 = factory.createDecimalDatatype();
+ yDt2_4.setMarkNegative(true);
+ yDt2_4.setPrecision(6);
+ yText2_4.setDatatype(yDt2_4);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("switchLocale");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ Locale locale = context.getLocale();
+ if (locale == Locale.GERMANY) {
+ context.setLocale(Locale.US);
+ } else {
+ context.setLocale(Locale.GERMANY);
+ }
+ }
+ });
+
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YDecimalField yText1_1 = factory.createDecimalField();
+ yText1_1.setLabel("Field1");
+ YDecimalField yText1_2 = factory.createDecimalField();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java
new file mode 100644
index 0000000..6d19b0b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class EnabledSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public EnabledSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ final YTextField yText = factory.createTextField();
+ yText.setLabel("text");
+ yText.setValue("Huhu");
+ row2.addElement(yText);
+
+ final YDateTime yDate = factory.createDateTime();
+ yDate.setLabel("time");
+ yDate.setValue(new Date());
+ row2.addElement(yDate);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yDate.setDatatype(yDt2_1);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("enable");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ yText.setEnabled(!yText.isEnabled());
+ yDate.setEnabled(!yDate.isEnabled());
+ }
+ });
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java
new file mode 100644
index 0000000..91d117f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class ExecutableSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ private YTextField yText;
+
+ public ExecutableSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ yText = factory.createTextField();
+ yText.setLabel("ExecType");
+ row1.addElement(yText);
+
+ YButton ySyncRunner = factory.createButton();
+ ySyncRunner.setLabel("exec");
+ row1.addElement(ySyncRunner);
+ ySyncRunner.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ context.exec(new Runnable() {
+ @Override
+ public void run() {
+ yText.setValue("exec");
+ }
+ });
+ }
+ });
+
+ YButton yAsyncRunner = factory.createButton();
+ yAsyncRunner.setLabel("asyncexec");
+ row1.addElement(yAsyncRunner);
+ yAsyncRunner.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ context.execAsync(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(2500);
+ } catch (InterruptedException e) {
+ }
+ yText.setValue("asyncexec");
+ }
+ });
+ }
+ });
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java
new file mode 100644
index 0000000..6912e3f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YList;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class ListSelectSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public ListSelectSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ // public void row2() {
+ // // test row 2
+ // YHorizontalLayout row2 = factory.createHorizontalLayout();
+ // yLayout.addElement(row2);
+ //
+ // YList yList2_1 = factory.createList();
+ // yList2_1.setLabel("minLength 3");
+ // row2.addElement(yList2_1);
+ //
+ // YList yList2_2 = factory.createList();
+ // yList2_2.setLabel("maxLength 10:");
+ // row2.addElement(yList2_2);
+ //
+ // YList yList2_3 = factory.createList();
+ // yList2_3.setLabel("regexp: \\d+");
+ // row2.addElement(yList2_3);
+ // }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("SingleSelection");
+ row1.addElement(label);
+ YList yList1_1 = factory.createList();
+ yList1_1.setId("Field1");
+ yList1_1.setLabel("Field1");
+ yList1_1.setType(String.class);
+ YList yList1_2 = factory.createList();
+ yList1_2.setId("Field2");
+ yList1_2.setLabel("Field2");
+ yList1_2.setType(String.class);
+ row1.addElement(yList1_1);
+ row1.addElement(yList1_2);
+
+ yList1_2.getCollection().add("Sabrina");
+ yList1_2.getCollection().add("Klemens");
+ yList1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yList1_1.createCollectionEndpoint(),
+ yList1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yList1_1.createSelectionEndpoint(),
+ yList1_2.createSelectionEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("Multi Selection");
+ row1.addElement(label);
+ YList yList1_1 = factory.createList();
+ yList1_1.setId("Field3");
+ yList1_1.setLabel("Field3");
+ yList1_1.setType(String.class);
+ yList1_1.setSelectionType(YSelectionType.MULTI);
+ YList yList1_2 = factory.createList();
+ yList1_2.setId("Field4");
+ yList1_2.setLabel("Field4");
+ yList1_2.setType(String.class);
+ yList1_2.setSelectionType(YSelectionType.MULTI);
+ row1.addElement(yList1_1);
+ row1.addElement(yList1_2);
+
+ yList1_2.getCollection().add("Sabrina");
+ yList1_2.getCollection().add("Klemens");
+ yList1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yList1_1.createCollectionEndpoint(),
+ yList1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yList1_1.createMultiSelectionEndpoint(),
+ yList1_2.createMultiSelectionEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java
new file mode 100644
index 0000000..b4b86ce
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java
@@ -0,0 +1,224 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.BindingFactory;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YEnumListBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class MasterDetailSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public MasterDetailSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ YVerticalLayout row1 = factory.createVerticalLayout();
+ yLayout.addElement(row1);
+
+ YTable yTable1_1 = factory.createTable();
+ yTable1_1.setLabel("Master");
+ yTable1_1.setType(Person.class);
+ row1.addElement(yTable1_1);
+
+ yTable1_1.getCollection().add(
+ new Person("Sabrina", 21, "1220", "Am Nordseeteich", false,
+ Gender.FEMALE));
+ yTable1_1.getCollection().add(
+ new Person("Klemens", 36, "1220", "Irgendwo hinterm Ort", true,
+ Gender.MALE));
+ yTable1_1.getCollection().add(
+ new Person("Flo", 35, "2301", "Hinterm Mond", false,
+ Gender.MALE));
+
+ YGridLayout yGrid = factory.createGridLayout();
+ yLayout.addElement(yGrid);
+
+ YTextField name = factory.createTextField();
+ name.setLabel("Name");
+ yGrid.addElement(name);
+
+ YNumericField age = factory.createNumericField();
+ age.setLabel("Age");
+ yGrid.addElement(age);
+
+ YTextField postalcode = factory.createTextField();
+ postalcode.setLabel("Postalcode");
+ yGrid.addElement(postalcode);
+
+ YTextField street = factory.createTextField();
+ street.setLabel("Street");
+ yGrid.addElement(street);
+
+ YCheckBox hasChild = factory.createCheckBox();
+ hasChild.setLabel("Has child");
+ yGrid.addElement(hasChild);
+
+ YComboBox gender = factory.createComboBox();
+ gender.setLabel("Gender");
+ gender.setType(Gender.class);
+ yGrid.addElement(gender);
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+
+ yBindingSet.addBinding(name.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "name"));
+ yBindingSet.addBinding(age.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "age"));
+ yBindingSet.addBinding(postalcode.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "postalcode"));
+ yBindingSet.addBinding(street.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "street"));
+ yBindingSet.addBinding(hasChild.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "hasChild"));
+ yBindingSet.addBinding(gender.createSelectionEndpoint(),
+ selectionEndpoint(yTable1_1, "gender"));
+ YEnumListBindingEndpoint enumBinding = BindingFactory.eINSTANCE
+ .createYEnumListBindingEndpoint();
+ enumBinding.setEnum(Gender.class);
+ yBindingSet.addBinding(gender.createCollectionEndpoint(), enumBinding);
+ }
+
+ protected YDetailValueBindingEndpoint selectionEndpoint(YTable yTable1_1,
+ String path) {
+ YEmbeddableSelectionEndpoint result = yTable1_1
+ .createSelectionEndpoint();
+ YDetailValueBindingEndpoint detailBinding = BindingFactory.eINSTANCE
+ .createYDetailValueBindingEndpoint();
+ detailBinding.setMasterObservable(result);
+ detailBinding.setPropertyPath(path);
+ detailBinding.setType(Person.class);
+
+ return detailBinding;
+ }
+
+ public static class Person extends AbstractBean {
+
+ private String name;
+ private int age;
+ private String postalcode;
+ private String street;
+ private boolean hasChild;
+ private Gender gender;
+
+ public Person(String name, int age, String postalcode, String street,
+ boolean hasChild, Gender gender) {
+ super();
+ this.name = name;
+ this.age = age;
+ this.postalcode = postalcode;
+ this.street = street;
+ this.hasChild = hasChild;
+ this.gender = gender;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ firePropertyChanged("name", this.name, this.name = name);
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ firePropertyChanged("age", this.age, this.age = age);
+ }
+
+ public String getPostalcode() {
+ return postalcode;
+ }
+
+ public void setPostalcode(String postalcode) {
+ firePropertyChanged("postalcode", this.postalcode,
+ this.postalcode = postalcode);
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ firePropertyChanged("street", this.street, this.street = street);
+ }
+
+ public boolean isHasChild() {
+ return hasChild;
+ }
+
+ public void setHasChild(boolean hasChild) {
+ firePropertyChanged("hasChild", this.hasChild,
+ this.hasChild = hasChild);
+ }
+
+ public Gender getGender() {
+ return gender;
+ }
+
+ public void setGender(Gender gender) {
+ firePropertyChanged("gender", this.gender, this.gender = gender);
+ }
+ }
+
+ public static enum Gender {
+ MALE, FEMALE
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java
new file mode 100644
index 0000000..3a57b77
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java
@@ -0,0 +1,110 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YNumericDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class NumericFieldSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public NumericFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YNumericField yText2_1 = factory.createNumericField();
+ yText2_1.setLabel("grouping false");
+ row2.addElement(yText2_1);
+ YNumericDatatype yDt2_2 = factory.createNumericDatatype();
+ yDt2_2.setGrouping(false);
+ yText2_1.setDatatype(yDt2_2);
+
+ YNumericField yText2_2 = factory.createNumericField();
+ yText2_2.setLabel("grouping true");
+ row2.addElement(yText2_2);
+ YNumericDatatype yDt2_1 = factory.createNumericDatatype();
+ yDt2_1.setGrouping(true);
+ yText2_2.setDatatype(yDt2_1);
+
+ YNumericField yText2_3 = factory.createNumericField();
+ yText2_3.setLabel("mark negative");
+ row2.addElement(yText2_3);
+ YNumericDatatype yDt2_3 = factory.createNumericDatatype();
+ yDt2_3.setMarkNegative(true);
+ yText2_3.setDatatype(yDt2_3);
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YNumericField yText1_1 = factory.createNumericField();
+ yText1_1.setLabel("Field1");
+ YNumericField yText1_2 = factory.createNumericField();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java
new file mode 100644
index 0000000..ac981dd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class OptionsGroupSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public OptionsGroupSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ // public void row2() {
+ // // test row 2
+ // YHorizontalLayout row2 = factory.createHorizontalLayout();
+ // yLayout.addElement(row2);
+ //
+ // YOptionsGroup yOptionsGroup2_1 = factory.createOptionsGroup();
+ // yOptionsGroup2_1.setLabel("minLength 3");
+ // row2.addElement(yOptionsGroup2_1);
+ //
+ // YOptionsGroup yOptionsGroup2_2 = factory.createOptionsGroup();
+ // yOptionsGroup2_2.setLabel("maxLength 10:");
+ // row2.addElement(yOptionsGroup2_2);
+ //
+ // YOptionsGroup yOptionsGroup2_3 = factory.createOptionsGroup();
+ // yOptionsGroup2_3.setLabel("regexp: \\d+");
+ // row2.addElement(yOptionsGroup2_3);
+ // }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("SingleSelection");
+ row1.addElement(label);
+ YOptionsGroup yOptionsGroup1_1 = factory.createOptionsGroup();
+ yOptionsGroup1_1.setId("Field1");
+ yOptionsGroup1_1.setLabel("Field1");
+ yOptionsGroup1_1.setType(String.class);
+ YOptionsGroup yOptionsGroup1_2 = factory.createOptionsGroup();
+ yOptionsGroup1_2.setId("Field2");
+ yOptionsGroup1_2.setLabel("Field2");
+ yOptionsGroup1_2.setType(String.class);
+ row1.addElement(yOptionsGroup1_1);
+ row1.addElement(yOptionsGroup1_2);
+
+ yOptionsGroup1_2.getCollection().add("Sabrina");
+ yOptionsGroup1_2.getCollection().add("Klemens");
+ yOptionsGroup1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yOptionsGroup1_1.createCollectionEndpoint(),
+ yOptionsGroup1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yOptionsGroup1_1.createSelectionEndpoint(),
+ yOptionsGroup1_2.createSelectionEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("Multi Selection");
+ row1.addElement(label);
+ YOptionsGroup yOptionsGroup1_1 = factory.createOptionsGroup();
+ yOptionsGroup1_1.setId("Field3");
+ yOptionsGroup1_1.setLabel("Field3");
+ yOptionsGroup1_1.setType(String.class);
+ yOptionsGroup1_1.setSelectionType(YSelectionType.MULTI);
+ YOptionsGroup yOptionsGroup1_2 = factory.createOptionsGroup();
+ yOptionsGroup1_2.setId("Field4");
+ yOptionsGroup1_2.setLabel("Field4");
+ yOptionsGroup1_2.setType(String.class);
+ yOptionsGroup1_2.setSelectionType(YSelectionType.MULTI);
+ row1.addElement(yOptionsGroup1_1);
+ row1.addElement(yOptionsGroup1_2);
+
+ yOptionsGroup1_2.getCollection().add("Sabrina");
+ yOptionsGroup1_2.getCollection().add("Klemens");
+ yOptionsGroup1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yOptionsGroup1_1.createCollectionEndpoint(),
+ yOptionsGroup1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yOptionsGroup1_1.createMultiSelectionEndpoint(),
+ yOptionsGroup1_2.createMultiSelectionEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java
new file mode 100644
index 0000000..2d3ec9b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class ReadonlySample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public ReadonlySample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ final YTextField yText = factory.createTextField();
+ yText.setLabel("text");
+ yText.setValue("Huhu");
+ row2.addElement(yText);
+
+ final YDateTime yDate = factory.createDateTime();
+ yDate.setLabel("time");
+ yDate.setValue(new Date());
+ row2.addElement(yDate);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yDate.setDatatype(yDt2_1);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("readonly");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ yText.setEditable(!yText.isEditable());
+ yDate.setEditable(!yDate.isEditable());
+ }
+ });
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java
new file mode 100644
index 0000000..a291250
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java
@@ -0,0 +1,167 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TableSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TableSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ // public void row2() {
+ // // test row 2
+ // YHorizontalLayout row2 = factory.createHorizontalLayout();
+ // yLayout.addElement(row2);
+ //
+ // YTable yTable2_1 = factory.createTable();
+ // yTable2_1.setLabel("minLength 3");
+ // row2.addElement(yTable2_1);
+ //
+ // YTable yTable2_2 = factory.createTable();
+ // yTable2_2.setLabel("maxLength 10:");
+ // row2.addElement(yTable2_2);
+ //
+ // YTable yTable2_3 = factory.createTable();
+ // yTable2_3.setLabel("regexp: \\d+");
+ // row2.addElement(yTable2_3);
+ // }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("SingleSelection");
+ row1.addElement(label);
+ YTable yTable1_1 = factory.createTable();
+ yTable1_1.setId("Field1");
+ yTable1_1.setLabel("Field1");
+ yTable1_1.setType(Bean.class);
+ YTable yTable1_2 = factory.createTable();
+ yTable1_2.setId("Field2");
+ yTable1_2.setLabel("Field2");
+ yTable1_2.setType(Bean.class);
+ row1.addElement(yTable1_1);
+ row1.addElement(yTable1_2);
+
+ yTable1_2.getCollection().add(new Bean("Sabrina"));
+ yTable1_2.getCollection().add(new Bean("Klemens"));
+ yTable1_2.getCollection().add(new Bean("Flo"));
+
+ yBindingSet.addBinding(yTable1_1.createCollectionEndpoint(),
+ yTable1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yTable1_1.createSelectionEndpoint(),
+ yTable1_2.createSelectionEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("Multi Selection");
+ row1.addElement(label);
+ YTable yTable1_1 = factory.createTable();
+ yTable1_1.setId("Field3");
+ yTable1_1.setLabel("Field3");
+ yTable1_1.setType(Bean.class);
+ yTable1_1.setSelectionType(YSelectionType.MULTI);
+ YTable yTable1_2 = factory.createTable();
+ yTable1_2.setId("Field4");
+ yTable1_2.setLabel("Field4");
+ yTable1_2.setType(Bean.class);
+ yTable1_2.setSelectionType(YSelectionType.MULTI);
+ row1.addElement(yTable1_1);
+ row1.addElement(yTable1_2);
+
+ yTable1_2.getCollection().add(new Bean("Sabrina"));
+ yTable1_2.getCollection().add(new Bean("Klemens"));
+ yTable1_2.getCollection().add(new Bean("Flo"));
+
+ yBindingSet.addBinding(yTable1_1.createCollectionEndpoint(),
+ yTable1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yTable1_1.createMultiSelectionEndpoint(),
+ yTable1_2.createMultiSelectionEndpoint());
+ }
+
+ public static final class Bean {
+ private String name;
+
+ public Bean(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java
new file mode 100644
index 0000000..919dec6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java
@@ -0,0 +1,100 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTab;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTabSheet;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TabsheetSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TabsheetSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ YTabSheet yTabsheet = factory.createTabSheet();
+ yLayout.getElements().add(yTabsheet);
+
+
+ tab1(yTabsheet);
+
+ tab2(yTabsheet);
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void tab1(YTabSheet yTabsheet) {
+ YTab yTab1 = factory.createTab();
+ yTab1.setLabel("Tab 1");
+
+ YVerticalLayout yTab1Content = factory.createVerticalLayout();
+ yTab1.setEmbeddable(yTab1Content);
+
+ YTextField yTextfield1 = factory.createTextField();
+ yTextfield1.setLabel("Huhu");
+ yTextfield1.setValue("Huhu");
+ yTab1Content.addElement(yTextfield1);
+
+ yTabsheet.getTabs().add(yTab1);
+ }
+
+ public void tab2(YTabSheet yTabsheet) {
+ YTab yTab2 = factory.createTab();
+ yTab2.setLabel("Tab 2");
+
+ YVerticalLayout yTab2Content = factory.createVerticalLayout();
+ yTab2.setEmbeddable(yTab2Content);
+
+ YTextField yTextfield2 = factory.createTextField();
+ yTextfield2.setLabel("Haha");
+ yTextfield2.setValue("Haha");
+ yTab2Content.addElement(yTextfield2);
+
+ yTabsheet.getTabs().add(yTab2);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java
new file mode 100644
index 0000000..c35663e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextAreaDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextArea;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TextAreaSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TextAreaSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YTextArea yText2_1 = factory.createTextArea();
+ yText2_1.setLabel("minLength 3");
+ row2.addElement(yText2_1);
+ YTextAreaDatatype yDt2_2 = factory.createTextAreaDatatype();
+ yDt2_2.setMinLength(3);
+ yText2_1.setDatatype(yDt2_2);
+
+ YTextArea yText2_2 = factory.createTextArea();
+ yText2_2.setLabel("maxLength 10:");
+ row2.addElement(yText2_2);
+ YTextAreaDatatype yDt2_1 = factory.createTextAreaDatatype();
+ yDt2_1.setMaxLength(10);
+ yText2_2.setDatatype(yDt2_1);
+
+ YTextArea yText2_3 = factory.createTextArea();
+ yText2_3.setLabel("regexp: \\d+");
+ row2.addElement(yText2_3);
+ YTextAreaDatatype yDt2_3 = factory.createTextAreaDatatype();
+ yDt2_3.setRegExpression("\\d+");
+ yText2_3.setDatatype(yDt2_3);
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YTextArea yText1_1 = factory.createTextArea();
+ yText1_1.setLabel("Field1");
+ YTextArea yText1_2 = factory.createTextArea();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java
new file mode 100644
index 0000000..d9479da
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java
@@ -0,0 +1,128 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TextFieldSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TextFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row3() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YCheckBox yCheckbox = factory.createCheckBox();
+ yCheckbox.setLabel("Click for readonly");
+ YTextField yText = factory.createTextField();
+ yText.setLabel("Becomes read only");
+ row1.addElement(yCheckbox);
+ row1.addElement(yText);
+
+// yText.setEditable(value);
+
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ yText.getValueBindingEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YTextField yText2_1 = factory.createTextField();
+ yText2_1.setLabel("minLength 3");
+ row2.addElement(yText2_1);
+ YTextDatatype yDt2_2 = factory.createTextDatatype();
+ yDt2_2.setMinLength(3);
+ yText2_1.setDatatype(yDt2_2);
+
+ YTextField yText2_2 = factory.createTextField();
+ yText2_2.setLabel("maxLength 10:");
+ row2.addElement(yText2_2);
+ YTextDatatype yDt2_1 = factory.createTextDatatype();
+ yDt2_1.setMaxLength(10);
+ yText2_2.setDatatype(yDt2_1);
+
+ YTextField yText2_3 = factory.createTextField();
+ yText2_3.setLabel("regexp: \\d+");
+ row2.addElement(yText2_3);
+ YTextDatatype yDt2_3 = factory.createTextDatatype();
+ yDt2_3.setRegExpression("\\d+");
+ yText2_3.setDatatype(yDt2_3);
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YTextField yText1_1 = factory.createTextField();
+ yText1_1.setLabel("A (binds to B):");
+ YTextField yText1_2 = factory.createTextField();
+ yText1_2.setLabel("B (binds to A):");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.getValueBindingEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java
new file mode 100644
index 0000000..7ef3228
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class VisibleSample extends CustomComponent {
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public VisibleSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ final YTextField yText = factory.createTextField();
+ yText.setLabel("text");
+ yText.setValue("Huhu");
+ row2.addElement(yText);
+
+ final YDateTime yDate = factory.createDateTime();
+ yDate.setLabel("time");
+ yDate.setValue(new Date());
+ row2.addElement(yDate);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yDate.setDatatype(yDt2_1);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("visible");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ yText.setVisible(!yText.isVisible());
+ yDate.setVisible(!yDate.isVisible());
+ }
+ });
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.project b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.project
new file mode 100644
index 0000000..ee3fa84
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/.project
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/LICENSE.txt b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..06edf04
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui
+Bundle-Version: 0.9.0.qualifier
+Bundle-ClassPath: .
+Require-Bundle: com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.emf.databinding;bundle-version="1.3.0",
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.beans;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.extension.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.ui.presentation.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)",
+ com.vaadin.client-compiled;bundle-version="[7.5.7,7.7.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Vendor: Eclipse OSBP
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.cm;version="1.4.0",
+ org.osgi.service.component;version="1.2.0",
+ org.osgi.service.http;version="1.2.1",
+ org.slf4j;version="1.6.1"
+Bundle-Activator: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.Activator
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.html b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.ini b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.mappings b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.properties
new file mode 100644
index 0000000..0b9ef63
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/build.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/build.properties
new file mode 100644
index 0000000..0cc7681
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/build.properties
@@ -0,0 +1,6 @@
+#
+
+bin.includes = about.properties, about.mappings, about.ini, about.html, .,\
+ META-INF/,\
+source.. = src/
+output.. = target/classes/
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/pom.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/pom.xml
new file mode 100644
index 0000000..3b23e13
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany). -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Florian Pirchner - initial API and implementation -->
+<!--#======================================================================= -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/setup/user-target.target b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/setup/user-target.target
new file mode 100644
index 0000000..099457c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/setup/user-target.target
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target includeMode="feature" name="user-target" sequenceNumber="59">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.jdt.feature.group" version="3.9.2.v20140221-1700"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.equinox.sdk.feature.group" version="3.9.0.v20140221-1852"/>
+<unit id="org.eclipse.platform.sdk" version="4.3.2.M20140221-1700"/>
+<unit id="org.eclipse.emf.sdk.feature.group" version="2.9.2.v20140203-1126"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.commons.math" version="2.1.0.v201105210652"/>
+<unit id="org.apache.commons.lang" version="2.6.0.v201205030909"/>
+<unit id="org.apache.commons.collections" version="3.2.0.v201005080500"/>
+<unit id="org.apache.commons.beanutils" version="1.8.0.v201205091237"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.junit.source" version="4.10.0.v4_10_0_v20120426-0900"/>
+<unit id="org.junit" version="4.10.0.v4_10_0_v20120426-0900"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.persistence.sdk.feature.group" version="2.5.1.v20130913-5eaeb06"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.source.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.source.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.source.feature.group" version="0.0.1.201406122143"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.source.feature.group" version="0.0.1.201406122143"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.httpcomponents.httpclient" version="4.1.2.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpclient.source" version="4.1.2.v201203221030"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.feature.group" version="0.0.1.201406122002"/>
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.source.feature.group" version="0.0.1.201406122002"/>
+<repository location="http://lun.lunifera.org/downloads/p2/ecview/nightly/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.httpcomponents.httpcore.source" version="4.1.4.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpcore" version="4.1.4.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpcore.nio" version="4.1.0.v201101201700"/>
+<unit id="org.apache.httpcomponents.httpcore.nio.source" version="4.1.0.v201101201700"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location path="${project_loc}/setup/lib" type="Directory"/>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.assert-utilities.feature.group" version="1.2.2"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.source.feature.group" version="0.0.1.201405120903"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.feature.group" version="0.0.1.201405120903"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.vaadin.feature.group" version="7.1.9"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java
new file mode 100644
index 0000000..3a709c2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/Activator.java
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import javax.servlet.ServletException;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+public class Activator implements BundleActivator,
+ServiceTrackerCustomizer<HttpService, HttpService>, BundleListener {
+
+ private static BundleContext context;
+ private static Activator plugin;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ private ServiceTracker<HttpService, HttpService> tracker;
+
+ // used to register servlets
+ private HttpService httpService;
+ private ResourceProvider resourceProvider;
+
+ /**
+ * @return the plugin
+ */
+ public static Activator getPlugin() {
+ return plugin;
+ }
+
+ //
+ // Helper methods to get an instance of the http service
+ //
+ @Override
+ public HttpService addingService(ServiceReference<HttpService> reference) {
+ httpService = context.getService(reference);
+
+ try {
+ // register the servlet at the http service
+ httpService.registerServlet("/", new ECViewTestsServlet(), null,
+ resourceProvider);
+ } catch (ServletException e) {
+ e.printStackTrace();
+ } catch (NamespaceException e) {
+ e.printStackTrace();
+ }
+
+ return httpService;
+ }
+
+ @Override
+ public void removedService(ServiceReference<HttpService> reference,
+ HttpService service) {
+ // unregister the servlet from the http service
+ httpService.unregister("/");
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<HttpService> reference,
+ HttpService service) {
+
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ Activator.plugin = this;
+
+ resourceProvider = new ResourceProvider();
+
+ handleStartedBundles(context);
+
+ // register this instance as a bundle listener to an reference to all
+ // vaadin bundles. Used to find the static resources.
+ bundleContext.addBundleListener(this);
+
+ // Start a HttpService-Tracker to get an instance of HttpService
+ tracker = new ServiceTracker<>(bundleContext, HttpService.class, this);
+ tracker.open();
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // close the HttpService-tracker
+ tracker.close();
+ tracker = null;
+
+
+ resourceProvider = null;
+
+ bundleContext.removeBundleListener(this);
+
+ Activator.context = null;
+ Activator.plugin = null;
+ }
+
+ /**
+ * Tries to find proper started bundles and adds them to resource provider.
+ * Since bundle changed listener will not find them.
+ *
+ * @param context
+ */
+ protected void handleStartedBundles(BundleContext context) {
+ for (Bundle bundle : context.getBundles()) {
+ String name = bundle.getSymbolicName();
+ if (bundle.getState() == Bundle.ACTIVE
+ && (name.startsWith("com.vaadin") || name
+ .equals("org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui"))) {
+ resourceProvider.add(bundle);
+ }
+ }
+ }
+
+ @Override
+ public void bundleChanged(BundleEvent event) {
+ // tracks the starting and stopping of vaadin bundles. If a bundle is a
+ // vaadin bundle it will be added to the resource provider for lookups.
+ String name = event.getBundle().getSymbolicName();
+ if (name.startsWith("com.vaadin")
+ || name.equals("org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui")) {
+ if (event.getType() == BundleEvent.STARTED) {
+ resourceProvider.add(event.getBundle());
+ } else if (event.getType() == BundleEvent.STOPPED) {
+ resourceProvider.remove(event.getBundle());
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java
new file mode 100644
index 0000000..ae16763
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/DummyApplication.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+public class DummyApplication implements IApplication {
+
+ @Override
+ public Object start(IApplicationContext context) throws Exception {
+ return null;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java
new file mode 100644
index 0000000..72b0076
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServlet.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
+
+/**
+ * An implementation of VaadinServlet that uses SimpleUI as its base UI.
+ */
+@SuppressWarnings("serial")
+@VaadinServletConfiguration(ui = ECViewTestsUI.class, productionMode = false)
+public class ECViewTestsServlet extends VaadinServlet {
+
+ @Override
+ protected VaadinServletService createServletService(
+ DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+ ECViewTestsServletService service = new ECViewTestsServletService(this,
+ deploymentConfiguration);
+ service.init();
+ return service;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java
new file mode 100644
index 0000000..9f45cc1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsServletService.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
+
+@SuppressWarnings("serial")
+public class ECViewTestsServletService extends VaadinServletService {
+
+ public ECViewTestsServletService(VaadinServlet servlet,
+ DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+ super(servlet, deploymentConfiguration);
+ }
+
+ @Override
+ public ClassLoader getClassLoader() {
+ return getClass().getClassLoader();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java
new file mode 100644
index 0000000..6636a1b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ECViewTestsUI.java
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.Page;
+import com.vaadin.server.Page.UriFragmentChangedEvent;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+@SuppressWarnings("serial")
+@Theme(Reindeer.THEME_NAME)
+public class ECViewTestsUI extends UI {
+
+ private static final String SAMPLE_PACKAGE = "org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples";
+ private VerticalLayout layout;
+
+ @Override
+ protected void init(VaadinRequest request) {
+ layout = new VerticalLayout();
+ layout.setSizeFull();
+ layout.setMargin(true);
+ layout.setSpacing(true);
+ setContent(layout);
+
+ layout.addComponent(new Label("Insert URL fragment to open testclass"));
+
+ getPage().addUriFragmentChangedListener(
+ new Page.UriFragmentChangedListener() {
+ @Override
+ public void uriFragmentChanged(
+ final UriFragmentChangedEvent event) {
+ getUI().accessSynchronously(new Runnable() {
+ @Override
+ public void run() {
+ VaadinObservables.getRealm(getUI());
+ String fragment = event.getUriFragment();
+ handleFragment(SAMPLE_PACKAGE + "." + fragment);
+ }
+ });
+ }
+ });
+
+ String fragment = request.getPathInfo().replace("/", "");
+ handleFragment(SAMPLE_PACKAGE + "." + fragment);
+ }
+
+ protected void handleFragment(String className) {
+ try {
+ Class<?> clazz = Activator.getContext().getBundle()
+ .loadClass(className);
+ if (Component.class.isAssignableFrom(clazz)) {
+ layout.removeAllComponents();
+
+ Component component = (Component) clazz.newInstance();
+ component.setSizeFull();
+ layout.addComponent(component);
+ } else {
+ handleError(className);
+ }
+ } catch (ClassNotFoundException e) {
+ handleError(className);
+ } catch (InstantiationException e) {
+ handleError(className);
+ } catch (IllegalAccessException e) {
+ handleError(className);
+ }
+ }
+
+ private void handleError(String clazzname) {
+ layout.removeAllComponents();
+ layout.addComponent(new Label(clazzname
+ + " is not a valid test sample!"));
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java
new file mode 100644
index 0000000..9dd2748
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/ResourceProvider.java
@@ -0,0 +1,76 @@
+ /**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
+/**
+ * Resource provider is responsible to look for resources requested by the
+ * HttpService. Therefore it uses the classpath of registered bundles.
+ */
+public class ResourceProvider implements HttpContext {
+
+ private List<Bundle> resources = new ArrayList<Bundle>();
+
+ @Override
+ public URL getResource(String uri) {
+ URL resource = null;
+ // iterate over the vaadin bundles and try to find the requested
+ // resource
+ for (Bundle bundle : resources) {
+ resource = bundle.getResource(uri);
+ if (resource != null) {
+ break;
+ }
+ }
+ return resource;
+ }
+
+ /**
+ * Adds a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void add(Bundle bundle) {
+ if(!resources.contains(bundle)){
+ resources.add(bundle);
+ }
+ }
+
+ /**
+ * Removes a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void remove(Bundle bundle) {
+ resources.remove(bundle);
+ }
+
+ @Override
+ public String getMimeType(String arg0) {
+ return null;
+ }
+
+ @Override
+ public boolean handleSecurity(HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+ return true;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java
new file mode 100644
index 0000000..ec4e364
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/AbstractBean.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * Default implementation of value bean. Offerns {@link PropertyChangeSupport}.
+ */
+public class AbstractBean {
+ private final PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
+ public AbstractBean() {
+ }
+
+ /**
+ * Adds the given property change listener to the change support.
+ *
+ * @param listener
+ * Listener to be added
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Adds the given property change listener to the change support.
+ *
+ * @param property
+ * Name of the property
+ * @param listener
+ * Listener to be added
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(String property,
+ PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(property, listener);
+ }
+
+ /**
+ * Removes the given property change listener from the change support.
+ *
+ * @param listener
+ * Listener to be removed
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes the given property change listener from the change support.
+ *
+ * @param property
+ * Name of the property
+ * @param listener
+ * Listener to be removed
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(String property,
+ PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(property, listener);
+ }
+
+ /**
+ * Fires the property changed event.
+ *
+ * @param property
+ * Name of the property
+ * @param oldValue
+ * The old value
+ * @param newValue
+ * The new value
+ * @see java.beans.PropertyChangeSupport#firePropertyChange(String, Object,
+ * Object)
+ */
+ protected void firePropertyChanged(String property, Object oldValue,
+ Object newValue) {
+ changeSupport.firePropertyChange(property, oldValue, newValue);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java
new file mode 100644
index 0000000..2ce0830
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/CheckBoxSample.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+
+public class CheckBoxSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private CssLayout layout;
+
+ public CheckBoxSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+ CheckBox checkbox = new CheckBox();
+ layout.addComponent(checkbox);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java
new file mode 100644
index 0000000..af07071
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DatetimeFieldSample.java
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class DatetimeFieldSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public DatetimeFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YDateTime yText2_1 = factory.createDateTime();
+ yText2_1.setLabel("date");
+ row2.addElement(yText2_1);
+ YDateTimeDatatype yDt2_2 = createDateTimeDatatype();
+ yDt2_2.setFormat(YDateTimeFormat.DATE);
+ yText2_1.setDatatype(yDt2_2);
+
+ YDateTime yText2_2 = factory.createDateTime();
+ yText2_2.setLabel("time");
+ row2.addElement(yText2_2);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yText2_2.setDatatype(yDt2_1);
+
+ YDateTime yText2_3 = factory.createDateTime();
+ yText2_3.setLabel("datetime");
+ row2.addElement(yText2_3);
+ YDateTimeDatatype yDt2_3 = createDateTimeDatatype();
+ yDt2_3.setFormat(YDateTimeFormat.DATE_TIME);
+ yText2_3.setDatatype(yDt2_3);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("switchLocale");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ Locale locale = context.getLocale();
+ if (locale == Locale.GERMANY) {
+ context.setLocale(Locale.US);
+ } else {
+ context.setLocale(Locale.GERMANY);
+ }
+ }
+ });
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YDateTime yText1_1 = factory.createDateTime();
+ yText1_1.setLabel("Field1");
+ YDateTime yText1_2 = factory.createDateTime();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java
new file mode 100644
index 0000000..391679b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/DecimalFieldSample.java
@@ -0,0 +1,148 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class DecimalFieldSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public DecimalFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YDecimalField yText2_1 = factory.createDecimalField();
+ yText2_1.setLabel("grouping false");
+ row2.addElement(yText2_1);
+ YDecimalDatatype yDt2_2 = factory.createDecimalDatatype();
+ yDt2_2.setGrouping(false);
+ yText2_1.setDatatype(yDt2_2);
+
+ YDecimalField yText2_2 = factory.createDecimalField();
+ yText2_2.setLabel("grouping true");
+ row2.addElement(yText2_2);
+ YDecimalDatatype yDt2_1 = factory.createDecimalDatatype();
+ yDt2_1.setGrouping(true);
+ yText2_2.setDatatype(yDt2_1);
+
+ YDecimalField yText2_3 = factory.createDecimalField();
+ yText2_3.setLabel("mark negative");
+ row2.addElement(yText2_3);
+ YDecimalDatatype yDt2_3 = factory.createDecimalDatatype();
+ yDt2_3.setMarkNegative(true);
+ yText2_3.setDatatype(yDt2_3);
+
+ YDecimalField yText2_4 = factory.createDecimalField();
+ yText2_4.setLabel("digits6");
+ row2.addElement(yText2_4);
+ YDecimalDatatype yDt2_4 = factory.createDecimalDatatype();
+ yDt2_4.setMarkNegative(true);
+ yDt2_4.setPrecision(6);
+ yText2_4.setDatatype(yDt2_4);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("switchLocale");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ Locale locale = context.getLocale();
+ if (locale == Locale.GERMANY) {
+ context.setLocale(Locale.US);
+ } else {
+ context.setLocale(Locale.GERMANY);
+ }
+ }
+ });
+
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YDecimalField yText1_1 = factory.createDecimalField();
+ yText1_1.setLabel("Field1");
+ YDecimalField yText1_2 = factory.createDecimalField();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java
new file mode 100644
index 0000000..a958574
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/EnabledSample.java
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class EnabledSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public EnabledSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ final YTextField yText = factory.createTextField();
+ yText.setLabel("text");
+ yText.setValue("Huhu");
+ row2.addElement(yText);
+
+ final YDateTime yDate = factory.createDateTime();
+ yDate.setLabel("time");
+ yDate.setValue(new Date());
+ row2.addElement(yDate);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yDate.setDatatype(yDt2_1);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("enable");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ yText.setEnabled(!yText.isEnabled());
+ yDate.setEnabled(!yDate.isEnabled());
+ }
+ });
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java
new file mode 100644
index 0000000..34ac4d9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ExecutableSample.java
@@ -0,0 +1,122 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class ExecutableSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ private YTextField yText;
+
+ public ExecutableSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ yText = factory.createTextField();
+ yText.setLabel("ExecType");
+ row1.addElement(yText);
+
+ YButton ySyncRunner = factory.createButton();
+ ySyncRunner.setLabel("exec");
+ row1.addElement(ySyncRunner);
+ ySyncRunner.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ context.exec(new Runnable() {
+ @Override
+ public void run() {
+ yText.setValue("exec");
+ }
+ });
+ }
+ });
+
+ YButton yAsyncRunner = factory.createButton();
+ yAsyncRunner.setLabel("asyncexec");
+ row1.addElement(yAsyncRunner);
+ yAsyncRunner.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ context.execAsync(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(2500);
+ } catch (InterruptedException e) {
+ }
+ yText.setValue("asyncexec");
+ }
+ });
+ }
+ });
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java
new file mode 100644
index 0000000..2a403d1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ListSelectSample.java
@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YList;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class ListSelectSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public ListSelectSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ // public void row2() {
+ // // test row 2
+ // YHorizontalLayout row2 = factory.createHorizontalLayout();
+ // yLayout.addElement(row2);
+ //
+ // YList yList2_1 = factory.createList();
+ // yList2_1.setLabel("minLength 3");
+ // row2.addElement(yList2_1);
+ //
+ // YList yList2_2 = factory.createList();
+ // yList2_2.setLabel("maxLength 10:");
+ // row2.addElement(yList2_2);
+ //
+ // YList yList2_3 = factory.createList();
+ // yList2_3.setLabel("regexp: \\d+");
+ // row2.addElement(yList2_3);
+ // }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("SingleSelection");
+ row1.addElement(label);
+ YList yList1_1 = factory.createList();
+ yList1_1.setId("Field1");
+ yList1_1.setLabel("Field1");
+ yList1_1.setType(String.class);
+ YList yList1_2 = factory.createList();
+ yList1_2.setId("Field2");
+ yList1_2.setLabel("Field2");
+ yList1_2.setType(String.class);
+ row1.addElement(yList1_1);
+ row1.addElement(yList1_2);
+
+ yList1_2.getCollection().add("Sabrina");
+ yList1_2.getCollection().add("Klemens");
+ yList1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yList1_1.createCollectionEndpoint(),
+ yList1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yList1_1.createSelectionEndpoint(),
+ yList1_2.createSelectionEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("Multi Selection");
+ row1.addElement(label);
+ YList yList1_1 = factory.createList();
+ yList1_1.setId("Field3");
+ yList1_1.setLabel("Field3");
+ yList1_1.setType(String.class);
+ yList1_1.setSelectionType(YSelectionType.MULTI);
+ YList yList1_2 = factory.createList();
+ yList1_2.setId("Field4");
+ yList1_2.setLabel("Field4");
+ yList1_2.setType(String.class);
+ yList1_2.setSelectionType(YSelectionType.MULTI);
+ row1.addElement(yList1_1);
+ row1.addElement(yList1_2);
+
+ yList1_2.getCollection().add("Sabrina");
+ yList1_2.getCollection().add("Klemens");
+ yList1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yList1_1.createCollectionEndpoint(),
+ yList1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yList1_1.createMultiSelectionEndpoint(),
+ yList1_2.createMultiSelectionEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java
new file mode 100644
index 0000000..2394440
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/MasterDetailSample.java
@@ -0,0 +1,229 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.BindingFactory;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YEnumListBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class MasterDetailSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public MasterDetailSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ YVerticalLayout row1 = factory.createVerticalLayout();
+ yLayout.addElement(row1);
+
+ YTable yTable1_1 = factory.createTable();
+ yTable1_1.setLabel("Master");
+ yTable1_1.setType(Person.class);
+ row1.addElement(yTable1_1);
+
+ yTable1_1.getCollection().add(
+ new Person("Sabrina", 21, "1220", "Am Nordseeteich", false,
+ Gender.FEMALE));
+ yTable1_1.getCollection().add(
+ new Person("Klemens", 36, "1220", "Irgendwo hinterm Ort", true,
+ Gender.MALE));
+ yTable1_1.getCollection().add(
+ new Person("Flo", 35, "2301", "Hinterm Mond", false,
+ Gender.MALE));
+
+ YGridLayout yGrid = factory.createGridLayout();
+ yLayout.addElement(yGrid);
+
+ YTextField name = factory.createTextField();
+ name.setLabel("Name");
+ yGrid.addElement(name);
+
+ YNumericField age = factory.createNumericField();
+ age.setLabel("Age");
+ yGrid.addElement(age);
+
+ YTextField postalcode = factory.createTextField();
+ postalcode.setLabel("Postalcode");
+ yGrid.addElement(postalcode);
+
+ YTextField street = factory.createTextField();
+ street.setLabel("Street");
+ yGrid.addElement(street);
+
+ YCheckBox hasChild = factory.createCheckBox();
+ hasChild.setLabel("Has child");
+ yGrid.addElement(hasChild);
+
+ YComboBox gender = factory.createComboBox();
+ gender.setLabel("Gender");
+ gender.setType(Gender.class);
+ yGrid.addElement(gender);
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+
+ yBindingSet.addBinding(name.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "name"));
+ yBindingSet.addBinding(age.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "age"));
+ yBindingSet.addBinding(postalcode.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "postalcode"));
+ yBindingSet.addBinding(street.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "street"));
+ yBindingSet.addBinding(hasChild.createValueEndpoint(),
+ selectionEndpoint(yTable1_1, "hasChild"));
+ yBindingSet.addBinding(gender.createSelectionEndpoint(),
+ selectionEndpoint(yTable1_1, "gender"));
+ YEnumListBindingEndpoint enumBinding = BindingFactory.eINSTANCE
+ .createYEnumListBindingEndpoint();
+ enumBinding.setEnum(Gender.class);
+ yBindingSet.addBinding(gender.createCollectionEndpoint(), enumBinding);
+ }
+
+ protected YDetailValueBindingEndpoint selectionEndpoint(YTable yTable1_1,
+ String path) {
+ YEmbeddableSelectionEndpoint result = yTable1_1
+ .createSelectionEndpoint();
+ YDetailValueBindingEndpoint detailBinding = BindingFactory.eINSTANCE
+ .createYDetailValueBindingEndpoint();
+ detailBinding.setMasterObservable(result);
+ detailBinding.setPropertyPath(path);
+ detailBinding.setType(Person.class);
+
+ return detailBinding;
+ }
+
+ public static class Person extends AbstractBean {
+
+ private String name;
+ private int age;
+ private String postalcode;
+ private String street;
+ private boolean hasChild;
+ private Gender gender;
+
+ public Person(String name, int age, String postalcode, String street,
+ boolean hasChild, Gender gender) {
+ super();
+ this.name = name;
+ this.age = age;
+ this.postalcode = postalcode;
+ this.street = street;
+ this.hasChild = hasChild;
+ this.gender = gender;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ firePropertyChanged("name", this.name, this.name = name);
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ firePropertyChanged("age", this.age, this.age = age);
+ }
+
+ public String getPostalcode() {
+ return postalcode;
+ }
+
+ public void setPostalcode(String postalcode) {
+ firePropertyChanged("postalcode", this.postalcode,
+ this.postalcode = postalcode);
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ firePropertyChanged("street", this.street, this.street = street);
+ }
+
+ public boolean isHasChild() {
+ return hasChild;
+ }
+
+ public void setHasChild(boolean hasChild) {
+ firePropertyChanged("hasChild", this.hasChild,
+ this.hasChild = hasChild);
+ }
+
+ public Gender getGender() {
+ return gender;
+ }
+
+ public void setGender(Gender gender) {
+ firePropertyChanged("gender", this.gender, this.gender = gender);
+ }
+ }
+
+ public static enum Gender {
+ MALE, FEMALE
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java
new file mode 100644
index 0000000..bf75e96
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/NumericFieldSample.java
@@ -0,0 +1,115 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YNumericDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class NumericFieldSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public NumericFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YNumericField yText2_1 = factory.createNumericField();
+ yText2_1.setLabel("grouping false");
+ row2.addElement(yText2_1);
+ YNumericDatatype yDt2_2 = factory.createNumericDatatype();
+ yDt2_2.setGrouping(false);
+ yText2_1.setDatatype(yDt2_2);
+
+ YNumericField yText2_2 = factory.createNumericField();
+ yText2_2.setLabel("grouping true");
+ row2.addElement(yText2_2);
+ YNumericDatatype yDt2_1 = factory.createNumericDatatype();
+ yDt2_1.setGrouping(true);
+ yText2_2.setDatatype(yDt2_1);
+
+ YNumericField yText2_3 = factory.createNumericField();
+ yText2_3.setLabel("mark negative");
+ row2.addElement(yText2_3);
+ YNumericDatatype yDt2_3 = factory.createNumericDatatype();
+ yDt2_3.setMarkNegative(true);
+ yText2_3.setDatatype(yDt2_3);
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YNumericField yText1_1 = factory.createNumericField();
+ yText1_1.setLabel("Field1");
+ YNumericField yText1_2 = factory.createNumericField();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java
new file mode 100644
index 0000000..3080f82
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/OptionsGroupSample.java
@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class OptionsGroupSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public OptionsGroupSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ // public void row2() {
+ // // test row 2
+ // YHorizontalLayout row2 = factory.createHorizontalLayout();
+ // yLayout.addElement(row2);
+ //
+ // YOptionsGroup yOptionsGroup2_1 = factory.createOptionsGroup();
+ // yOptionsGroup2_1.setLabel("minLength 3");
+ // row2.addElement(yOptionsGroup2_1);
+ //
+ // YOptionsGroup yOptionsGroup2_2 = factory.createOptionsGroup();
+ // yOptionsGroup2_2.setLabel("maxLength 10:");
+ // row2.addElement(yOptionsGroup2_2);
+ //
+ // YOptionsGroup yOptionsGroup2_3 = factory.createOptionsGroup();
+ // yOptionsGroup2_3.setLabel("regexp: \\d+");
+ // row2.addElement(yOptionsGroup2_3);
+ // }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("SingleSelection");
+ row1.addElement(label);
+ YOptionsGroup yOptionsGroup1_1 = factory.createOptionsGroup();
+ yOptionsGroup1_1.setId("Field1");
+ yOptionsGroup1_1.setLabel("Field1");
+ yOptionsGroup1_1.setType(String.class);
+ YOptionsGroup yOptionsGroup1_2 = factory.createOptionsGroup();
+ yOptionsGroup1_2.setId("Field2");
+ yOptionsGroup1_2.setLabel("Field2");
+ yOptionsGroup1_2.setType(String.class);
+ row1.addElement(yOptionsGroup1_1);
+ row1.addElement(yOptionsGroup1_2);
+
+ yOptionsGroup1_2.getCollection().add("Sabrina");
+ yOptionsGroup1_2.getCollection().add("Klemens");
+ yOptionsGroup1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yOptionsGroup1_1.createCollectionEndpoint(),
+ yOptionsGroup1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yOptionsGroup1_1.createSelectionEndpoint(),
+ yOptionsGroup1_2.createSelectionEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("Multi Selection");
+ row1.addElement(label);
+ YOptionsGroup yOptionsGroup1_1 = factory.createOptionsGroup();
+ yOptionsGroup1_1.setId("Field3");
+ yOptionsGroup1_1.setLabel("Field3");
+ yOptionsGroup1_1.setType(String.class);
+ yOptionsGroup1_1.setSelectionType(YSelectionType.MULTI);
+ YOptionsGroup yOptionsGroup1_2 = factory.createOptionsGroup();
+ yOptionsGroup1_2.setId("Field4");
+ yOptionsGroup1_2.setLabel("Field4");
+ yOptionsGroup1_2.setType(String.class);
+ yOptionsGroup1_2.setSelectionType(YSelectionType.MULTI);
+ row1.addElement(yOptionsGroup1_1);
+ row1.addElement(yOptionsGroup1_2);
+
+ yOptionsGroup1_2.getCollection().add("Sabrina");
+ yOptionsGroup1_2.getCollection().add("Klemens");
+ yOptionsGroup1_2.getCollection().add("Flo");
+
+ yBindingSet.addBinding(yOptionsGroup1_1.createCollectionEndpoint(),
+ yOptionsGroup1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yOptionsGroup1_1.createMultiSelectionEndpoint(),
+ yOptionsGroup1_2.createMultiSelectionEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java
new file mode 100644
index 0000000..0433d92
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/ReadonlySample.java
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class ReadonlySample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public ReadonlySample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ final YTextField yText = factory.createTextField();
+ yText.setLabel("text");
+ yText.setValue("Huhu");
+ row2.addElement(yText);
+
+ final YDateTime yDate = factory.createDateTime();
+ yDate.setLabel("time");
+ yDate.setValue(new Date());
+ row2.addElement(yDate);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yDate.setDatatype(yDt2_1);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("readonly");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ yText.setEditable(!yText.isEditable());
+ yDate.setEditable(!yDate.isEditable());
+ }
+ });
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java
new file mode 100644
index 0000000..eb0e43a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TableSample.java
@@ -0,0 +1,172 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TableSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TableSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ // public void row2() {
+ // // test row 2
+ // YHorizontalLayout row2 = factory.createHorizontalLayout();
+ // yLayout.addElement(row2);
+ //
+ // YTable yTable2_1 = factory.createTable();
+ // yTable2_1.setLabel("minLength 3");
+ // row2.addElement(yTable2_1);
+ //
+ // YTable yTable2_2 = factory.createTable();
+ // yTable2_2.setLabel("maxLength 10:");
+ // row2.addElement(yTable2_2);
+ //
+ // YTable yTable2_3 = factory.createTable();
+ // yTable2_3.setLabel("regexp: \\d+");
+ // row2.addElement(yTable2_3);
+ // }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("SingleSelection");
+ row1.addElement(label);
+ YTable yTable1_1 = factory.createTable();
+ yTable1_1.setId("Field1");
+ yTable1_1.setLabel("Field1");
+ yTable1_1.setType(Bean.class);
+ YTable yTable1_2 = factory.createTable();
+ yTable1_2.setId("Field2");
+ yTable1_2.setLabel("Field2");
+ yTable1_2.setType(Bean.class);
+ row1.addElement(yTable1_1);
+ row1.addElement(yTable1_2);
+
+ yTable1_2.getCollection().add(new Bean("Sabrina"));
+ yTable1_2.getCollection().add(new Bean("Klemens"));
+ yTable1_2.getCollection().add(new Bean("Flo"));
+
+ yBindingSet.addBinding(yTable1_1.createCollectionEndpoint(),
+ yTable1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yTable1_1.createSelectionEndpoint(),
+ yTable1_2.createSelectionEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+
+ YLabel label = factory.createLabel();
+ label.setLabel("Multi Selection");
+ row1.addElement(label);
+ YTable yTable1_1 = factory.createTable();
+ yTable1_1.setId("Field3");
+ yTable1_1.setLabel("Field3");
+ yTable1_1.setType(Bean.class);
+ yTable1_1.setSelectionType(YSelectionType.MULTI);
+ YTable yTable1_2 = factory.createTable();
+ yTable1_2.setId("Field4");
+ yTable1_2.setLabel("Field4");
+ yTable1_2.setType(Bean.class);
+ yTable1_2.setSelectionType(YSelectionType.MULTI);
+ row1.addElement(yTable1_1);
+ row1.addElement(yTable1_2);
+
+ yTable1_2.getCollection().add(new Bean("Sabrina"));
+ yTable1_2.getCollection().add(new Bean("Klemens"));
+ yTable1_2.getCollection().add(new Bean("Flo"));
+
+ yBindingSet.addBinding(yTable1_1.createCollectionEndpoint(),
+ yTable1_2.createCollectionEndpoint());
+ yBindingSet.addBinding(yTable1_1.createMultiSelectionEndpoint(),
+ yTable1_2.createMultiSelectionEndpoint());
+ }
+
+ public static final class Bean {
+ private String name;
+
+ public Bean(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java
new file mode 100644
index 0000000..0ee8195
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TabsheetSample.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTab;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTabSheet;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TabsheetSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TabsheetSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ YTabSheet yTabsheet = factory.createTabSheet();
+ yLayout.getElements().add(yTabsheet);
+
+
+ tab1(yTabsheet);
+
+ tab2(yTabsheet);
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void tab1(YTabSheet yTabsheet) {
+ YTab yTab1 = factory.createTab();
+ yTab1.setLabel("Tab 1");
+
+ YVerticalLayout yTab1Content = factory.createVerticalLayout();
+ yTab1.setEmbeddable(yTab1Content);
+
+ YTextField yTextfield1 = factory.createTextField();
+ yTextfield1.setLabel("Huhu");
+ yTextfield1.setValue("Huhu");
+ yTab1Content.addElement(yTextfield1);
+
+ yTabsheet.getTabs().add(yTab1);
+ }
+
+ public void tab2(YTabSheet yTabsheet) {
+ YTab yTab2 = factory.createTab();
+ yTab2.setLabel("Tab 2");
+
+ YVerticalLayout yTab2Content = factory.createVerticalLayout();
+ yTab2.setEmbeddable(yTab2Content);
+
+ YTextField yTextfield2 = factory.createTextField();
+ yTextfield2.setLabel("Haha");
+ yTextfield2.setValue("Haha");
+ yTab2Content.addElement(yTextfield2);
+
+ yTabsheet.getTabs().add(yTab2);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java
new file mode 100644
index 0000000..82e9d93
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextAreaSample.java
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextAreaDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextArea;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TextAreaSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TextAreaSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ // TODO - fix me FP
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YTextArea yText2_1 = factory.createTextArea();
+ yText2_1.setLabel("minLength 3");
+ row2.addElement(yText2_1);
+ YTextAreaDatatype yDt2_2 = factory.createTextAreaDatatype();
+ yDt2_2.setMinLength(3);
+ yText2_1.setDatatype(yDt2_2);
+
+ YTextArea yText2_2 = factory.createTextArea();
+ yText2_2.setLabel("maxLength 10:");
+ row2.addElement(yText2_2);
+ YTextAreaDatatype yDt2_1 = factory.createTextAreaDatatype();
+ yDt2_1.setMaxLength(10);
+ yText2_2.setDatatype(yDt2_1);
+
+ YTextArea yText2_3 = factory.createTextArea();
+ yText2_3.setLabel("regexp: \\d+");
+ row2.addElement(yText2_3);
+ YTextAreaDatatype yDt2_3 = factory.createTextAreaDatatype();
+ yDt2_3.setRegExpression("\\d+");
+ yText2_3.setDatatype(yDt2_3);
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YTextArea yText1_1 = factory.createTextArea();
+ yText1_1.setLabel("Field1");
+ YTextArea yText1_2 = factory.createTextArea();
+ yText1_2.setLabel("Field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java
new file mode 100644
index 0000000..f63e49b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/TextFieldSample.java
@@ -0,0 +1,138 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class TextFieldSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ public TextFieldSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row1();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row3() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YCheckBox yCheckbox = factory.createCheckBox();
+ yCheckbox.setLabel("Click for readonly");
+ YTextField yText = factory.createTextField();
+ yText.setLabel("Becomes read only");
+ row1.addElement(yCheckbox);
+ row1.addElement(yText);
+
+ // yText.setEditable(value);
+
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ yText.createValueEndpoint());
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ YTextField yText2_1 = factory.createTextField();
+ yText2_1.setLabel("minLength 3");
+ yText2_1.setCssID("minLength");
+ row2.addElement(yText2_1);
+ YTextDatatype yDt2_2 = factory.createTextDatatype();
+ yDt2_2.setMinLength(3);
+ yText2_1.setDatatype(yDt2_2);
+
+ YTextField yText2_2 = factory.createTextField();
+ yText2_2.setLabel("maxLength 10:");
+ yText2_2.setCssID("maxLength");
+ row2.addElement(yText2_2);
+ YTextDatatype yDt2_1 = factory.createTextDatatype();
+ yDt2_1.setMaxLength(10);
+ yText2_2.setDatatype(yDt2_1);
+
+ YTextField yText2_3 = factory.createTextField();
+ yText2_3.setLabel("regexp: \\d+");
+ yText2_3.setCssID("regexp");
+ row2.addElement(yText2_3);
+ YTextDatatype yDt2_3 = factory.createTextDatatype();
+ yDt2_3.setRegExpression("\\d+");
+ yText2_3.setDatatype(yDt2_3);
+ }
+
+ public void row1() {
+ // test row 1
+ YHorizontalLayout row1 = factory.createHorizontalLayout();
+ yLayout.addElement(row1);
+ YTextField yText1_1 = factory.createTextField();
+ yText1_1.setCssID("field1");
+ yText1_1.setLabel("A (binds to B):");
+ YTextField yText1_2 = factory.createTextField();
+ yText1_2.setLabel("B (binds to A):");
+ yText1_2.setCssID("field2");
+ row1.addElement(yText1_1);
+ row1.addElement(yText1_2);
+
+ yBindingSet.addBinding(yText1_1.createValueEndpoint(),
+ yText1_2.createValueEndpoint());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java
new file mode 100644
index 0000000..4008be0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ui/samples/VisibleSample.java
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.ui.samples;
+
+import java.util.Date;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class VisibleSample extends CustomComponent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ private CssLayout layout;
+
+ private YView yView;
+
+ private YBindingSet yBindingSet;
+
+ private YVerticalLayout yLayout;
+
+ private IViewContext context;
+
+ public VisibleSample() {
+ layout = new CssLayout();
+ setCompositionRoot(layout);
+
+ init();
+ }
+
+ protected void init() {
+
+ Locale.setDefault(Locale.GERMANY);
+
+ yView = factory.createView();
+ yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ yBindingSet = yView.getOrCreateBindingSet();
+
+ row2();
+
+ // render now, fill in values later
+ // to avoid overwriting values with bindings to empty fields
+ VaadinRenderer renderer = new VaadinRenderer();
+ try {
+ context = renderer.render(layout, yView, null);
+ } catch (ContextException e) {
+ layout.addComponent(new Label(e.toString()));
+ }
+ }
+
+ public void row2() {
+ // test row 2
+ YHorizontalLayout row2 = factory.createHorizontalLayout();
+ yLayout.addElement(row2);
+
+ final YTextField yText = factory.createTextField();
+ yText.setLabel("text");
+ yText.setValue("Huhu");
+ row2.addElement(yText);
+
+ final YDateTime yDate = factory.createDateTime();
+ yDate.setLabel("time");
+ yDate.setValue(new Date());
+ row2.addElement(yDate);
+ YDateTimeDatatype yDt2_1 = createDateTimeDatatype();
+ yDt2_1.setFormat(YDateTimeFormat.TIME);
+ yDate.setDatatype(yDt2_1);
+
+ YButton yLocaleSwitcher = factory.createButton();
+ yLocaleSwitcher.setLabel("visible");
+ row2.addElement(yLocaleSwitcher);
+ yLocaleSwitcher.addClickListener(new YButtonClickListener() {
+ @Override
+ public void clicked(YButton yButton) {
+ yText.setVisible(!yText.isVisible());
+ yDate.setVisible(!yDate.isVisible());
+ }
+ });
+ }
+
+ protected YDateTimeDatatype createDateTimeDatatype() {
+ return ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.project b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.project
new file mode 100644
index 0000000..d41bba6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/LICENSE.txt b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f4801f7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,46 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-ClassPath: .
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.knowhowlab.osgi.testing.assertions;bundle-version="[1.3.0,1.3.1)",
+ org.knowhowlab.osgi.testing.utils;bundle-version="[1.2.2,1.2.3)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.emf.databinding;bundle-version="1.3.0",
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.beans;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.extension.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.ui.presentation.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)",
+ org.jsoup;bundle-version="1.7.2",
+ org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)",
+ org.slf4j.api;bundle-version="1.7.2",
+ org.eclipse.osbp.runtime.designer.api;bundle-version="0.9.0",
+ org.eclipse.equinox.ds;bundle-version="1.4.200"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model;version="0.9.0",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl;version="0.9.0",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.util;version="0.9.0"
+Bundle-Vendor: Eclipse OSBP
+Bundle-Localization: plugin
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.cm;version="1.4.0",
+ org.osgi.service.component;version="1.2.0",
+ org.osgi.service.http;version="1.2.1"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.Activator
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/build.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/build.properties
new file mode 100644
index 0000000..5bef6ac
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/build.properties
@@ -0,0 +1,9 @@
+output.. = target/classes/
+bin.includes = .,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ LICENSE.txt
+jars.compile.order = .
+source.. = src/
+src.includes = LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.ecore b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.ecore
new file mode 100644
index 0000000..8c8a081
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.ecore
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http://www.osbp.org/vaadin/presentation/tests"
+ nsPrefix="model">
+ <eClassifiers xsi:type="ecore:EClass" name="EmfFoo">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EmfBar">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="myfoo" eType="#//EmfFoo"
+ containment="true"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.genmodel b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.genmodel
new file mode 100644
index 0000000..9681efe
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/emfmodel/model.genmodel
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src"
+ modelPluginID="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests" modelName="Model"
+ rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="6.0" copyrightFields="false" operationReflection="true" importOrganizing="true">
+ <foreignModel>model.ecore</foreignModel>
+ <genPackages prefix="Model" basePackage="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf"
+ disposableProviderFactory="true" ecorePackage="model.ecore#/">
+ <genClasses ecoreClass="model.ecore#//Foo">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//Foo/name"/>
+ </genClasses>
+ <genClasses ecoreClass="model.ecore#//Bar">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//Bar/name"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference model.ecore#//Bar/myfoos"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.properties
new file mode 100644
index 0000000..24680b9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Model Model
+providerName = www.example.org
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.xml
new file mode 100644
index 0000000..36f8abb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/plugin.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <!-- @generated model -->
+ <package
+ uri="http://www.osbp.org/vaadin/presentation/tests"
+ class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage"
+ genModel="emfmodel/model.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/pom.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/pom.xml
new file mode 100644
index 0000000..db127a4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany). -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Florian Pirchner - initial API and implementation -->
+<!--#======================================================================= -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Test.class</include>
+ <include>**/*Tests.class</include>
+ </includes>
+ <failIfNoTests>false</failIfNoTests>
+ <showEclipseLog>true</showEclipseLog>
+ <!-- <argLine>${ui.test.vmargs}</argLine> -->
+ <bundleStartLevel>
+ <bundle>
+ <id>org.eclipse.osgi</id>
+ <level>-1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.common</id>
+ <level>1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.ds</id>
+ <level>2</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.log</id>
+ <level>1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.services</id>
+ <level>1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.common.editparts.emf</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.extension.editparts.emf</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ </bundleStartLevel>
+
+ <dependencies>
+ <!-- Plugins -->
+ <dependency>
+ <type>eclipse-plugin</type>
+ <artifactId>org.eclipse.equinox.ds</artifactId>
+ <version>0.0.0</version>
+ </dependency>
+ <dependency>
+ <type>eclipse-plugin</type>
+ <artifactId>org.eclipse.equinox.util</artifactId>
+ <version>0.0.0</version>
+ </dependency>
+ </dependencies>
+
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <properties>
+ <osbp.skip.javadoc>true</osbp.skip.javadoc>
+ </properties>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/Activator.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/Activator.java
new file mode 100644
index 0000000..a552726
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/Activator.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests;
+
+import org.knowhowlab.osgi.testing.assertions.BundleAssert;
+import org.knowhowlab.osgi.testing.assertions.ServiceAssert;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator implements BundleActivator {
+
+ @SuppressWarnings("unused")
+ private static final Logger logger = LoggerFactory
+ .getLogger(Activator.class);
+
+ private static Activator instance;
+ public static BundleContext context;
+
+ /**
+ * @return the instance
+ */
+ public static Activator getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ instance = this;
+
+ BundleAssert.setDefaultBundleContext(context);
+ ServiceAssert.setDefaultBundleContext(context);
+
+ // BundleHelper.ensureSetup();
+ }
+
+ /**
+ * Returns the bundle with the given id.
+ *
+ * @param id
+ * @return
+ */
+ public static Bundle findBundle(String id) {
+ for (Bundle bundle : context.getBundles()) {
+ if (bundle.getSymbolicName().equals(id)) {
+ return bundle;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ instance = null;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ModelUtilTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ModelUtilTests.java
new file mode 100644
index 0000000..b81b522
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/ModelUtilTests.java
@@ -0,0 +1,311 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.context.ViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableValueBindingEndpointEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IBindingEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IBindingSetEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IValueBindingEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBinding;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlot;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlotValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.notification.ILifecycleService;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.util.emf.ModelUtil;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation.DefaultUI;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.DecimalField;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+public class ModelUtilTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+ private DecimalField text1;
+ private DecimalField text2;
+ private IEmbeddableEditpart layoutEditpart;
+ private IEmbeddableEditpart text1Editpart;
+ private IEmbeddableEditpart text2Editpart;
+ private YDecimalField yText1;
+ private YDecimalField yText2;
+ private YBindingSet yBindingSet;
+ private ValueBean bean1;
+ private ValueBean bean2;
+ private YView yView;
+ private IViewEditpart viewEditpart;
+ private YGridLayout yLayout;
+ private IViewContext viewContext;
+ private YEmbeddableValueEndpoint yText1ValueEndpoint;
+ private YBinding yText1ValueBinding;
+
+ @Before
+ public void initialize() throws ContextException {
+
+ Locale.setDefault(Locale.US);
+
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+
+ yView = factory.createView();
+ yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ yText1 = factory.createDecimalField();
+ yText1.setCssID("ID_0815");
+ yText1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yText1);
+ yText2 = factory.createDecimalField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ renderer.render(rootLayout, yView, null);
+
+ viewEditpart = ModelUtil.findEditpart(yView);
+ layoutEditpart = ModelUtil.findEditpart(yLayout);
+ text1Editpart = ModelUtil.findEditpart(yText1);
+ text2Editpart = ModelUtil.findEditpart(yText2);
+ viewContext = ModelUtil.getViewContext(yLayout);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ text1 = (DecimalField) text1Presentation.getWidget();
+ text2 = (DecimalField) text2Presentation.getWidget();
+
+ yBindingSet = yView.getOrCreateBindingSet();
+ yView.setBindingSet(yBindingSet);
+ YBeanValueBindingEndpoint beanBinding1 = factory
+ .createBeanBindingEndpoint();
+ bean1 = new ValueBean(9988.77);
+ beanBinding1.setPropertyPath("doubleValue");
+ beanBinding1.setBean(bean1);
+
+ yText1ValueEndpoint = yText1.createValueEndpoint();
+ yText1ValueBinding = yBindingSet.addBinding(yText1ValueEndpoint,
+ beanBinding1);
+
+ YBeanValueBindingEndpoint beanBinding2 = factory
+ .createBeanBindingEndpoint();
+ bean2 = new ValueBean(9988.77);
+ beanBinding2.setPropertyPath("doubleValue");
+ beanBinding2.setBean(bean2);
+ yBindingSet.addBinding(yText2.createValueEndpoint(), beanBinding2);
+ }
+
+ @Test
+ public void test_testenvironment() {
+
+ // model to ui & bean
+ yText1.setValue(111.11);
+ yText2.setValue(222.22);
+ assertEquals("111.11", text1.getValue());
+ assertEquals("222.22", text2.getValue());
+ assertEquals(111.11, bean1.getDoubleValue(), 0);
+ assertEquals(222.22, bean2.getDoubleValue(), 0);
+
+ // bean to ui & model
+ bean1.setDoubleValue(333.33);
+ bean2.setDoubleValue(444.44);
+ assertEquals("333.33", text1.getValue());
+ assertEquals("444.44", text2.getValue());
+ assertEquals(333.33, yText1.getValue(), 0);
+ assertEquals(444.44, yText2.getValue(), 0);
+
+ // ui to bean & model
+ text1.setValue("555.55");
+ text2.setValue("666.66");
+ assertEquals(555.55, yText1.getValue(), 0);
+ assertEquals(666.66, yText2.getValue(), 0);
+ assertEquals(555.55, bean1.getDoubleValue(), 0);
+ assertEquals(666.66, bean2.getDoubleValue(), 0);
+
+ }
+
+ @Test
+ public void test_getViewContext() {
+ IViewContext testContext = ModelUtil.getViewContext(yText1);
+ assertEquals(viewContext, testContext);
+ testContext = ModelUtil.getViewContext(yText2);
+ assertEquals(viewContext, testContext);
+ testContext = ModelUtil.getViewContext(yLayout);
+ assertEquals(viewContext, testContext);
+ }
+
+ @Test
+ public void test_getWidget() {
+ Object layout_w = ModelUtil.getWidget(yLayout);
+ Object text1_w = ModelUtil.getWidget(yText1);
+ Object text2_w = ModelUtil.getWidget(yText2);
+ assertNotNull(layout_w);
+ assertNotNull(text1_w);
+ assertNotNull(text2_w);
+ assertEquals(layoutEditpart.getPresentation().getWidget(), layout_w);
+
+ }
+
+ @Test
+ public void test_getUIBindings() {
+ Set<Binding> uiBindings = text1Editpart.getPresentation()
+ .getUIBindings();
+ Set<Binding> uiBindings2 = ModelUtil.getUIBindings(yText1);
+ assertEquals(uiBindings2.size(), uiBindings.size());
+ for (Binding binding : uiBindings2) {
+ assertTrue(uiBindings.contains(binding));
+ }
+ for (Binding binding : uiBindings) {
+ assertTrue(uiBindings2.contains(binding));
+ }
+ }
+
+ @Test
+ public void test_getValueBinding() {
+ IValueBindingEditpart editpart = ModelUtil
+ .findEditpart(yText1ValueBinding);
+ Binding valueBinding2 = ModelUtil.getValueBinding(yText1);
+ assertEquals(editpart.getBinding(), valueBinding2);
+ }
+
+ @Test
+ public void test_getValueBindingEditpart() {
+ IValueBindingEditpart editpart = ModelUtil
+ .findEditpart(yText1ValueBinding);
+ YBinding yBinding = yText1.getValueBindingEndpoint().getBinding();
+ IValueBindingEditpart bindingEditpart = ModelUtil.findEditpart(yBinding);
+ assertEquals(editpart, bindingEditpart);
+ }
+
+ @Test
+ public void test_getValueEndpointEditpart() {
+ YEmbeddableValueEndpoint yBinding = yText1.getValueBindingEndpoint();
+ IEmbeddableValueBindingEndpointEditpart editpart1 = ModelUtil
+ .getValueEndpointEditpart(yBinding);
+ IEmbeddableValueBindingEndpointEditpart editpart2 = DelegatingEditPartManager
+ .getInstance().findEditpart(yBinding);
+
+ assertEquals(editpart1, editpart2);
+ }
+
+ @Test
+ public void test_getPresentation() {
+ IEmbeddableEditpart editpart = DelegatingEditPartManager.getInstance()
+ .findEditpart(yText1);
+ IWidgetPresentation<?> presentation = editpart.getPresentation();
+ assertEquals(presentation, ModelUtil.getPresentation(yText1));
+ }
+
+ @Test
+ public void test_getModelBindingEditparts() {
+ YBindingSet bindingset = yText1.getView().getBindingSet();
+ IBindingSetEditpart bindingSetEditpart = ModelUtil
+ .findEditpart(bindingset);
+ List<IBindingEditpart<?>> bindings = bindingSetEditpart
+ .findBindings(yText1);
+ assertEquals(bindings, ModelUtil.getModelBindingEditparts(yText1));
+ }
+
+ @Test
+ public void test_getLifecacleService() {
+ ILifecycleService service = viewContext
+ .getService(ILifecycleService.class.getName());
+ assertEquals(service, ModelUtil.getLifecylceService(viewContext));
+ }
+
+ @Test
+ public void test_getEditpart() {
+ IElementEditpart editpart = DelegatingEditPartManager.getInstance()
+ .findEditpart(yLayout);
+ assertEquals(editpart, ModelUtil.findEditpart(yLayout));
+ }
+
+ @Test
+ public void test_getBindingManager() {
+ IECViewBindingManager manager = viewContext
+ .getService(IECViewBindingManager.class.getName());
+ assertEquals(manager, ModelUtil.getBindingManager(viewContext));
+ }
+
+ // @Test
+ // public void test_createViewSetByEditpart() {
+ // IViewSetEditpart editpart = DelegatingEditPartManager.getInstance()
+ // .createEditpart(CoreModelPackage.eNS_URI,
+ // IViewSetEditpart.class);
+ // YViewSet set = (YViewSet) editpart.getModel();
+ // assertNotNull(set);
+ // }
+
+// @Test
+// public void test_URI_ForBeanSlot_ViewContext() {
+// IViewEditpart editpart = DelegatingEditPartManager.getInstance()
+// .createEditpart(new ViewContext(), CoreModelPackage.eNS_URI, IViewEditpart.class);
+// YView yView = (YView) editpart.getModel();
+//
+// YBeanSlot ySlot = factory.createBeanSlot();
+// ySlot.setName("slotNo1");
+// ySlot.setValueType(String.class);
+// yView.getBeanSlots().add(ySlot);
+//
+// assertEquals("view://bean/slotNo1", ModelUtil.getURI(ySlot).toString());
+// }
+//
+// @Test
+// public void test_URI_ForBeanSlotBinding_ViewContext() {
+// IViewEditpart editpart = DelegatingEditPartManager.getInstance()
+// .getEditpart(new ViewContext(), CoreModelPackage.eNS_URI, IViewEditpart.class);
+// YView yView = (YView) editpart.getModel();
+//
+// YBeanSlot ySlot = factory.createBeanSlot();
+// ySlot.setName("slotNo1");
+// ySlot.setValueType(String.class);
+// yView.getBeanSlots().add(ySlot);
+//
+// YBeanSlotValueBindingEndpoint yEndpoint = CoreModelFactory.eINSTANCE
+// .createYBeanSlotValueBindingEndpoint();
+// yEndpoint.setAttributePath("item.group.name");
+// yEndpoint.setBeanSlot(ySlot);
+//
+// assertEquals("view://bean/slotNo1#item.group.name",
+// ModelUtil.getURI(yEndpoint).toString());
+// }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfBar.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfBar.java
new file mode 100644
index 0000000..6062291
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfBar.java
@@ -0,0 +1,98 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '
+ * <em><b>Emf Bar</b></em>'. <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getName
+ * <em>Name</em>}</li>
+ * <li>
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getMyfoo
+ * <em>Myfoo</em>}</li>
+ * </ul>
+ *
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage#getEmfBar()
+ * @model
+ * @generated
+ */
+public interface EmfBar extends EObject {
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!--
+ * begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really
+ * should be more of a description here...
+ *
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage#getEmfBar_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getName
+ * <em>Name</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Myfoo</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Myfoo</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ *
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Myfoo</em>' containment reference.
+ * @see #setMyfoo(EmfFoo)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage#getEmfBar_Myfoo()
+ * @model containment="true"
+ * @generated
+ */
+ EmfFoo getMyfoo();
+
+ /**
+ * Sets the value of the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getMyfoo
+ * <em>Myfoo</em>}' containment reference. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Myfoo</em>' containment reference.
+ * @see #getMyfoo()
+ * @generated
+ */
+ void setMyfoo(EmfFoo value);
+
+} // EmfBar
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfFoo.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfFoo.java
new file mode 100644
index 0000000..e4e592e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/EmfFoo.java
@@ -0,0 +1,65 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '
+ * <em><b>Emf Foo</b></em>'. <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo#getName
+ * <em>Name</em>}</li>
+ * </ul>
+ *
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage#getEmfFoo()
+ * @model
+ * @generated
+ */
+public interface EmfFoo extends EObject {
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!--
+ * begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really
+ * should be more of a description here...
+ *
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage#getEmfFoo_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo#getName
+ * <em>Name</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // EmfFoo
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelFactory.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelFactory.java
new file mode 100644
index 0000000..8192aca
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelFactory.java
@@ -0,0 +1,62 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a
+ * create method for each non-abstract class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage
+ * @generated
+ */
+public interface ModelFactory extends EFactory {
+ /**
+ * The singleton instance of the factory. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ ModelFactory eINSTANCE = org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.ModelFactoryImpl
+ .init();
+
+ /**
+ * Returns a new object of class '<em>Emf Foo</em>'. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return a new object of class '<em>Emf Foo</em>'.
+ * @generated
+ */
+ EmfFoo createEmfFoo();
+
+ /**
+ * Returns a new object of class '<em>Emf Bar</em>'. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return a new object of class '<em>Emf Bar</em>'.
+ * @generated
+ */
+ EmfBar createEmfBar();
+
+ /**
+ * Returns the package supported by this factory. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return the package supported by this factory.
+ * @generated
+ */
+ ModelPackage getModelPackage();
+
+} // ModelFactory
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelPackage.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelPackage.java
new file mode 100644
index 0000000..80331bf
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/ModelPackage.java
@@ -0,0 +1,285 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains
+ * accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each operation of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface ModelPackage extends EPackage {
+ /**
+ * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNAME = "model";
+
+ /**
+ * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_URI = "http://www.osbp.org/vaadin/presentation/tests";
+
+ /**
+ * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_PREFIX = "model";
+
+ /**
+ * The singleton instance of the package. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ ModelPackage eINSTANCE = org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.ModelPackageImpl
+ .init();
+
+ /**
+ * The meta object id for the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfFooImpl
+ * <em>Emf Foo</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfFooImpl
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.ModelPackageImpl#getEmfFoo()
+ * @generated
+ */
+ int EMF_FOO = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_FOO__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Emf Foo</em>' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_FOO_FEATURE_COUNT = 1;
+
+ /**
+ * The number of operations of the '<em>Emf Foo</em>' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_FOO_OPERATION_COUNT = 0;
+
+ /**
+ * The meta object id for the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfBarImpl
+ * <em>Emf Bar</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfBarImpl
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.ModelPackageImpl#getEmfBar()
+ * @generated
+ */
+ int EMF_BAR = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_BAR__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Myfoo</b></em>' containment reference.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_BAR__MYFOO = 1;
+
+ /**
+ * The number of structural features of the '<em>Emf Bar</em>' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_BAR_FEATURE_COUNT = 2;
+
+ /**
+ * The number of operations of the '<em>Emf Bar</em>' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int EMF_BAR_OPERATION_COUNT = 0;
+
+ /**
+ * Returns the meta object for class '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo
+ * <em>Emf Foo</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Emf Foo</em>'.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo
+ * @generated
+ */
+ EClass getEmfFoo();
+
+ /**
+ * Returns the meta object for the attribute '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo#getName
+ * <em>Name</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo#getName()
+ * @see #getEmfFoo()
+ * @generated
+ */
+ EAttribute getEmfFoo_Name();
+
+ /**
+ * Returns the meta object for class '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar
+ * <em>Emf Bar</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Emf Bar</em>'.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar
+ * @generated
+ */
+ EClass getEmfBar();
+
+ /**
+ * Returns the meta object for the attribute '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getName
+ * <em>Name</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getName()
+ * @see #getEmfBar()
+ * @generated
+ */
+ EAttribute getEmfBar_Name();
+
+ /**
+ * Returns the meta object for the containment reference '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getMyfoo
+ * <em>Myfoo</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the containment reference '<em>Myfoo</em>'.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar#getMyfoo()
+ * @see #getEmfBar()
+ * @generated
+ */
+ EReference getEmfBar_Myfoo();
+
+ /**
+ * Returns the factory that creates the instances of the model. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ ModelFactory getModelFactory();
+
+ /**
+ * <!-- begin-user-doc --> Defines literals for the meta objects that
+ * represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each operation of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfFooImpl
+ * <em>Emf Foo</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfFooImpl
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.ModelPackageImpl#getEmfFoo()
+ * @generated
+ */
+ EClass EMF_FOO = eINSTANCE.getEmfFoo();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute
+ * feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute EMF_FOO__NAME = eINSTANCE.getEmfFoo_Name();
+
+ /**
+ * The meta object literal for the '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfBarImpl
+ * <em>Emf Bar</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfBarImpl
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.ModelPackageImpl#getEmfBar()
+ * @generated
+ */
+ EClass EMF_BAR = eINSTANCE.getEmfBar();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute
+ * feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute EMF_BAR__NAME = eINSTANCE.getEmfBar_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Myfoo</b></em>' containment
+ * reference feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference EMF_BAR__MYFOO = eINSTANCE.getEmfBar_Myfoo();
+
+ }
+
+} // ModelPackage
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfBarImpl.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfBarImpl.java
new file mode 100644
index 0000000..ae29bfa
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfBarImpl.java
@@ -0,0 +1,270 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+/**
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '
+ * <em><b>Emf Bar</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfBarImpl#getName
+ * <em>Name</em>}</li>
+ * <li>
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfBarImpl#getMyfoo
+ * <em>Myfoo</em>}</li>
+ * </ul>
+ *
+ *
+ * @generated
+ */
+public class EmfBarImpl extends MinimalEObjectImpl.Container implements EmfBar {
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getMyfoo() <em>Myfoo</em>}' containment
+ * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getMyfoo()
+ * @generated
+ * @ordered
+ */
+ protected EmfFoo myfoo;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected EmfBarImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return ModelPackage.Literals.EMF_BAR;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET,
+ ModelPackage.EMF_BAR__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EmfFoo getMyfoo() {
+ return myfoo;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public NotificationChain basicSetMyfoo(EmfFoo newMyfoo,
+ NotificationChain msgs) {
+ EmfFoo oldMyfoo = myfoo;
+ myfoo = newMyfoo;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this,
+ Notification.SET, ModelPackage.EMF_BAR__MYFOO, oldMyfoo,
+ newMyfoo);
+ if (msgs == null)
+ msgs = notification;
+ else
+ msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setMyfoo(EmfFoo newMyfoo) {
+ if (newMyfoo != myfoo) {
+ NotificationChain msgs = null;
+ if (myfoo != null)
+ msgs = ((InternalEObject) myfoo).eInverseRemove(this,
+ EOPPOSITE_FEATURE_BASE - ModelPackage.EMF_BAR__MYFOO,
+ null, msgs);
+ if (newMyfoo != null)
+ msgs = ((InternalEObject) newMyfoo).eInverseAdd(this,
+ EOPPOSITE_FEATURE_BASE - ModelPackage.EMF_BAR__MYFOO,
+ null, msgs);
+ msgs = basicSetMyfoo(newMyfoo, msgs);
+ if (msgs != null)
+ msgs.dispatch();
+ } else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET,
+ ModelPackage.EMF_BAR__MYFOO, newMyfoo, newMyfoo));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd,
+ int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case ModelPackage.EMF_BAR__MYFOO:
+ return basicSetMyfoo(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case ModelPackage.EMF_BAR__NAME:
+ return getName();
+ case ModelPackage.EMF_BAR__MYFOO:
+ return getMyfoo();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case ModelPackage.EMF_BAR__NAME:
+ setName((String) newValue);
+ return;
+ case ModelPackage.EMF_BAR__MYFOO:
+ setMyfoo((EmfFoo) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case ModelPackage.EMF_BAR__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case ModelPackage.EMF_BAR__MYFOO:
+ setMyfoo((EmfFoo) null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case ModelPackage.EMF_BAR__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT
+ .equals(name);
+ case ModelPackage.EMF_BAR__MYFOO:
+ return myfoo != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy())
+ return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EmfBarImpl
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfFooImpl.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfFooImpl.java
new file mode 100644
index 0000000..1dbc154
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/EmfFooImpl.java
@@ -0,0 +1,175 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+/**
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '
+ * <em><b>Emf Foo</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl.EmfFooImpl#getName
+ * <em>Name</em>}</li>
+ * </ul>
+ *
+ *
+ * @generated
+ */
+public class EmfFooImpl extends MinimalEObjectImpl.Container implements EmfFoo {
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected EmfFooImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return ModelPackage.Literals.EMF_FOO;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET,
+ ModelPackage.EMF_FOO__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case ModelPackage.EMF_FOO__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case ModelPackage.EMF_FOO__NAME:
+ setName((String) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case ModelPackage.EMF_FOO__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case ModelPackage.EMF_FOO__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT
+ .equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy())
+ return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EmfFooImpl
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelFactoryImpl.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelFactoryImpl.java
new file mode 100644
index 0000000..ee0b0b7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelFactoryImpl.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+/**
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+public class ModelFactoryImpl extends EFactoryImpl implements ModelFactory {
+ /**
+ * Creates the default factory implementation. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public static ModelFactory init() {
+ try {
+ ModelFactory theModelFactory = (ModelFactory) EPackage.Registry.INSTANCE
+ .getEFactory(ModelPackage.eNS_URI);
+ if (theModelFactory != null) {
+ return theModelFactory;
+ }
+ } catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new ModelFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public ModelFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case ModelPackage.EMF_FOO:
+ return createEmfFoo();
+ case ModelPackage.EMF_BAR:
+ return createEmfBar();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName()
+ + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EmfFoo createEmfFoo() {
+ EmfFooImpl emfFoo = new EmfFooImpl();
+ return emfFoo;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EmfBar createEmfBar() {
+ EmfBarImpl emfBar = new EmfBarImpl();
+ return emfBar;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ModelPackage getModelPackage() {
+ return (ModelPackage) getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static ModelPackage getPackage() {
+ return ModelPackage.eINSTANCE;
+ }
+
+} // ModelFactoryImpl
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelPackageImpl.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelPackageImpl.java
new file mode 100644
index 0000000..8053052
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/impl/ModelPackageImpl.java
@@ -0,0 +1,249 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+/**
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass emfFooEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass emfBarEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the
+ * package package URI value.
+ * <p>
+ * Note: the correct way to create the package is via the static factory
+ * method {@link #init init()}, which also performs initialization of the
+ * package, or returns the registered package, if one already exists. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private ModelPackageImpl() {
+ super(eNS_URI, ModelFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model,
+ * and for any others upon which it depends.
+ *
+ * <p>
+ * This method is used to initialize {@link ModelPackage#eINSTANCE} when
+ * that field is accessed. Clients should not invoke it directly. Instead,
+ * they should simply access that field to obtain the package. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static ModelPackage init() {
+ if (isInited)
+ return (ModelPackage) EPackage.Registry.INSTANCE
+ .getEPackage(ModelPackage.eNS_URI);
+
+ // Obtain or create and register package
+ ModelPackageImpl theModelPackage = (ModelPackageImpl) (EPackage.Registry.INSTANCE
+ .get(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE
+ .get(eNS_URI) : new ModelPackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theModelPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theModelPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theModelPackage.freeze();
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage);
+ return theModelPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getEmfFoo() {
+ return emfFooEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getEmfFoo_Name() {
+ return (EAttribute) emfFooEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getEmfBar() {
+ return emfBarEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getEmfBar_Name() {
+ return (EAttribute) emfBarEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getEmfBar_Myfoo() {
+ return (EReference) emfBarEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ModelFactory getModelFactory() {
+ return (ModelFactory) getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is guarded to
+ * have no affect on any invocation but its first. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated)
+ return;
+ isCreated = true;
+
+ // Create classes and their features
+ emfFooEClass = createEClass(EMF_FOO);
+ createEAttribute(emfFooEClass, EMF_FOO__NAME);
+
+ emfBarEClass = createEClass(EMF_BAR);
+ createEAttribute(emfBarEClass, EMF_BAR__NAME);
+ createEReference(emfBarEClass, EMF_BAR__MYFOO);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized)
+ return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes, features, and operations; add parameters
+ initEClass(emfFooEClass, EmfFoo.class, "EmfFoo", !IS_ABSTRACT,
+ !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEmfFoo_Name(), ecorePackage.getEString(), "name",
+ null, 0, 1, EmfFoo.class, !IS_TRANSIENT, !IS_VOLATILE,
+ IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
+
+ initEClass(emfBarEClass, EmfBar.class, "EmfBar", !IS_ABSTRACT,
+ !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEmfBar_Name(), ecorePackage.getEString(), "name",
+ null, 0, 1, EmfBar.class, !IS_TRANSIENT, !IS_VOLATILE,
+ IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
+ initEReference(getEmfBar_Myfoo(), this.getEmfFoo(), null, "myfoo",
+ null, 0, 1, EmfBar.class, !IS_TRANSIENT, !IS_VOLATILE,
+ IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} // ModelPackageImpl
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelAdapterFactory.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelAdapterFactory.java
new file mode 100644
index 0000000..b19bcf2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelAdapterFactory.java
@@ -0,0 +1,152 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+
+/**
+ * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides
+ * an adapter <code>createXXX</code> method for each class of the model. <!--
+ * end-user-doc -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage
+ * @generated
+ */
+public class ModelAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static ModelPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public ModelAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = ModelPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc --> This implementation returns <code>true</code> if
+ * the object is either the model's package or is an instance object of the
+ * model. <!-- end-user-doc -->
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject) object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ModelSwitch<Adapter> modelSwitch = new ModelSwitch<Adapter>() {
+ @Override
+ public Adapter caseEmfFoo(EmfFoo object) {
+ return createEmfFooAdapter();
+ }
+
+ @Override
+ public Adapter caseEmfBar(EmfBar object) {
+ return createEmfBarAdapter();
+ }
+
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @param target
+ * the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject) target);
+ }
+
+ /**
+ * Creates a new adapter for an object of class '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo
+ * <em>Emf Foo</em>}'. <!-- begin-user-doc --> This default implementation
+ * returns null so that we can easily ignore cases; it's useful to ignore a
+ * case when inheritance will catch all the cases anyway. <!-- end-user-doc
+ * -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo
+ * @generated
+ */
+ public Adapter createEmfFooAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '
+ * {@link org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar
+ * <em>Emf Bar</em>}'. <!-- begin-user-doc --> This default implementation
+ * returns null so that we can easily ignore cases; it's useful to ignore a
+ * case when inheritance will catch all the cases anyway. <!-- end-user-doc
+ * -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar
+ * @generated
+ */
+ public Adapter createEmfBarAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case. <!-- begin-user-doc --> This
+ * default implementation returns null. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} // ModelAdapterFactory
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelSwitch.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelSwitch.java
new file mode 100644
index 0000000..260347f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/emf/model/util/ModelSwitch.java
@@ -0,0 +1,150 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.Switch;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance
+ * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object and proceeding up the
+ * inheritance hierarchy until a non-null result is returned, which is the
+ * result of the switch. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage
+ * @generated
+ */
+public class ModelSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static ModelPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public ModelSwitch() {
+ if (modelPackage == null) {
+ modelPackage = ModelPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns
+ * a non null result; it yields that result. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code>
+ * call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case ModelPackage.EMF_FOO: {
+ EmfFoo emfFoo = (EmfFoo) theEObject;
+ T result = caseEmfFoo(emfFoo);
+ if (result == null)
+ result = defaultCase(theEObject);
+ return result;
+ }
+ case ModelPackage.EMF_BAR: {
+ EmfBar emfBar = (EmfBar) theEObject;
+ T result = caseEmfBar(emfBar);
+ if (result == null)
+ result = defaultCase(theEObject);
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '
+ * <em>Emf Foo</em>'. <!-- begin-user-doc --> This implementation returns
+ * null; returning a non-null result will terminate the switch. <!--
+ * end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '
+ * <em>Emf Foo</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmfFoo(EmfFoo object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '
+ * <em>Emf Bar</em>'. <!-- begin-user-doc --> This implementation returns
+ * null; returning a non-null result will terminate the switch. <!--
+ * end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '
+ * <em>Emf Bar</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmfBar(EmfBar object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '
+ * <em>EObject</em>'. <!-- begin-user-doc --> This implementation returns
+ * null; returning a non-null result will terminate the switch, but this is
+ * the last case anyway. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '
+ * <em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} // ModelSwitch
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/AbstractBean.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/AbstractBean.java
new file mode 100644
index 0000000..1bba237
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/AbstractBean.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * Default implementation of value bean. Offerns {@link PropertyChangeSupport}.
+ */
+public class AbstractBean {
+ private final PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
+ public AbstractBean() {
+ }
+
+ /**
+ * Adds the given property change listener to the change support.
+ *
+ * @param listener
+ * Listener to be added
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Adds the given property change listener to the change support.
+ *
+ * @param property
+ * Name of the property
+ * @param listener
+ * Listener to be added
+ * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(String property,
+ PropertyChangeListener listener) {
+ changeSupport.addPropertyChangeListener(property, listener);
+ }
+
+ /**
+ * Removes the given property change listener from the change support.
+ *
+ * @param listener
+ * Listener to be removed
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes the given property change listener from the change support.
+ *
+ * @param property
+ * Name of the property
+ * @param listener
+ * Listener to be removed
+ * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String,
+ * java.beans.PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(String property,
+ PropertyChangeListener listener) {
+ changeSupport.removePropertyChangeListener(property, listener);
+ }
+
+ /**
+ * Fires the property changed event.
+ *
+ * @param property
+ * Name of the property
+ * @param oldValue
+ * The old value
+ * @param newValue
+ * The new value
+ * @see java.beans.PropertyChangeSupport#firePropertyChange(String, Object,
+ * Object)
+ */
+ protected void firePropertyChanged(String property, Object oldValue,
+ Object newValue) {
+ changeSupport.firePropertyChange(property, oldValue, newValue);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Bar.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Bar.java
new file mode 100644
index 0000000..5acafa0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Bar.java
@@ -0,0 +1,168 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+
+@SuppressWarnings("serial")
+public class Bar implements Serializable {
+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
+ this);
+
+ private boolean disposed;
+
+ private String name;
+
+ private Foo myfoo;
+
+ /**
+ * Returns true, if the object is disposed. Disposed means, that it is
+ * prepared for garbage collection and may not be used anymore. Accessing
+ * objects that are already disposed will cause runtime exceptions.
+ */
+ public boolean isDisposed() {
+ return this.disposed;
+ }
+
+ /**
+ * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#addPropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#removePropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName,
+ listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#firePropertyChange(String, Object, Object)
+ */
+ public void firePropertyChange(final String propertyName,
+ final Object oldValue, final Object newValue) {
+ propertyChangeSupport.firePropertyChange(propertyName, oldValue,
+ newValue);
+ }
+
+ /**
+ * Checks whether the object is disposed.
+ *
+ * @throws RuntimeException
+ * if the object is disposed.
+ */
+ private void checkDisposed() {
+ if (isDisposed()) {
+ throw new RuntimeException("Object already disposed: " + this);
+ }
+ }
+
+ /**
+ * Calling dispose will destroy that instance. The internal state will be
+ * set to 'disposed' and methods of that object must not be used anymore.
+ * Each call will result in runtime exceptions.
+ * If this object keeps composition containments, these will be disposed
+ * too. So the whole composition containment tree will be disposed on
+ * calling this method.
+ */
+ public void dispose() {
+ if (isDisposed()) {
+ return;
+ }
+ disposed = true;
+ }
+
+ /**
+ * Returns the name property or <code>null</code> if not present.
+ */
+ public String getName() {
+ checkDisposed();
+ return this.name;
+ }
+
+ /**
+ * Sets the <code>name</code> property to this instance.
+ *
+ * @param name
+ * - the property
+ * @throws RuntimeException
+ * if instance is <code>disposed</code>
+ *
+ */
+ public void setName(final String name) {
+ firePropertyChange("name", this.name, this.name = name);
+ }
+
+ /**
+ * Returns the myfoo property or <code>null</code> if not present.
+ */
+ public Foo getMyfoo() {
+ checkDisposed();
+ return this.myfoo;
+ }
+
+/**
+ * Sets the <code>myfoo</code> property to this instance.
+ * Since the reference has an opposite reference, the opposite <code>foo#
+ * mybars</code> of the <code>myfoo</code> will be handled automatically and no
+ * further coding is required to keep them in sync.<p>
+ * See {@link foo#setMybars(foo)
+ *
+ * @param myfoo - the property
+ * @throws RuntimeException if instance is <code>disposed</code>
+ *
+ */
+ public void setMyfoo(final Foo myfoo) {
+ checkDisposed();
+ if (this.myfoo != null) {
+ this.myfoo.internalRemoveFromMybars(this);
+ }
+ internalSetMyfoo(myfoo);
+ if (this.myfoo != null) {
+ this.myfoo.internalAddToMybars(this);
+ }
+
+ }
+
+ /**
+ * For internal use only!
+ */
+ public void internalSetMyfoo(final Foo myfoo) {
+ firePropertyChange("myfoo", this.myfoo, this.myfoo = myfoo);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/BarHashById.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/BarHashById.java
new file mode 100644
index 0000000..b5108b4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/BarHashById.java
@@ -0,0 +1,168 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+
+@SuppressWarnings("serial")
+public class BarHashById implements Serializable {
+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
+ this);
+
+ private final String id;
+
+ private boolean disposed;
+
+ private String name;
+
+ public BarHashById(String id) {
+ super();
+ this.id = id;
+ }
+
+ /**
+ * Returns true, if the object is disposed. Disposed means, that it is
+ * prepared for garbage collection and may not be used anymore. Accessing
+ * objects that are already disposed will cause runtime exceptions.
+ */
+ public boolean isDisposed() {
+ return this.disposed;
+ }
+
+ /**
+ * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#addPropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#removePropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName,
+ listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#firePropertyChange(String, Object, Object)
+ */
+ public void firePropertyChange(final String propertyName,
+ final Object oldValue, final Object newValue) {
+ propertyChangeSupport.firePropertyChange(propertyName, oldValue,
+ newValue);
+ }
+
+ /**
+ * Checks whether the object is disposed.
+ *
+ * @throws RuntimeException
+ * if the object is disposed.
+ */
+ private void checkDisposed() {
+ if (isDisposed()) {
+ throw new RuntimeException("Object already disposed: " + this);
+ }
+ }
+
+ /**
+ * Calling dispose will destroy that instance. The internal state will be
+ * set to 'disposed' and methods of that object must not be used anymore.
+ * Each call will result in runtime exceptions.
+ * If this object keeps composition containments, these will be disposed
+ * too. So the whole composition containment tree will be disposed on
+ * calling this method.
+ */
+ public void dispose() {
+ if (isDisposed()) {
+ return;
+ }
+ disposed = true;
+ }
+
+ /**
+ * Returns the name property or <code>null</code> if not present.
+ */
+ public String getName() {
+ checkDisposed();
+ return this.name;
+ }
+
+ /**
+ * Sets the <code>name</code> property to this instance.
+ *
+ * @param name
+ * - the property
+ * @throws RuntimeException
+ * if instance is <code>disposed</code>
+ *
+ */
+ public void setName(final String name) {
+ firePropertyChange("name", this.name, this.name = name);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ BarHashById other = (BarHashById) obj;
+ if (disposed != other.disposed)
+ return false;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Foo.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Foo.java
new file mode 100644
index 0000000..e9bef89
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/Foo.java
@@ -0,0 +1,218 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
+
+@SuppressWarnings("serial")
+public class Foo implements Serializable {
+ private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
+ this);
+
+ private boolean disposed;
+
+ private String name;
+
+ private List<Bar> mybars;
+
+ /**
+ * Returns true, if the object is disposed. Disposed means, that it is
+ * prepared for garbage collection and may not be used anymore. Accessing
+ * objects that are already disposed will cause runtime exceptions.
+ */
+ public boolean isDisposed() {
+ return this.disposed;
+ }
+
+ /**
+ * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#addPropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#removePropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName,
+ listener);
+ }
+
+ /**
+ * @see PropertyChangeSupport#firePropertyChange(String, Object, Object)
+ */
+ public void firePropertyChange(final String propertyName,
+ final Object oldValue, final Object newValue) {
+ propertyChangeSupport.firePropertyChange(propertyName, oldValue,
+ newValue);
+ }
+
+ /**
+ * Checks whether the object is disposed.
+ *
+ * @throws RuntimeException
+ * if the object is disposed.
+ */
+ private void checkDisposed() {
+ if (isDisposed()) {
+ throw new RuntimeException("Object already disposed: " + this);
+ }
+ }
+
+ /**
+ * Calling dispose will destroy that instance. The internal state will be
+ * set to 'disposed' and methods of that object must not be used anymore.
+ * Each call will result in runtime exceptions.
+ * If this object keeps composition containments, these will be disposed
+ * too. So the whole composition containment tree will be disposed on
+ * calling this method.
+ */
+ public void dispose() {
+ if (isDisposed()) {
+ return;
+ }
+ try {
+ // Dispose all the composition references.
+ if (this.mybars != null) {
+ for (Bar bar : this.mybars) {
+ bar.dispose();
+ }
+ this.mybars = null;
+ }
+
+ } finally {
+ disposed = true;
+ }
+
+ }
+
+ /**
+ * Returns the name property or <code>null</code> if not present.
+ */
+ public String getName() {
+ checkDisposed();
+ return this.name;
+ }
+
+ /**
+ * Sets the <code>name</code> property to this instance.
+ *
+ * @param name
+ * - the property
+ * @throws RuntimeException
+ * if instance is <code>disposed</code>
+ *
+ */
+ public void setName(final String name) {
+ firePropertyChange("name", this.name, this.name = name);
+ }
+
+ /**
+ * Returns an unmodifiable list of mybars.
+ */
+ public List<Bar> getMybars() {
+ checkDisposed();
+ return Collections.unmodifiableList(internalGetMybars());
+ }
+
+ /**
+ * Returns the list of <code>bar</code>s thereby lazy initializing it. For
+ * internal use only!
+ *
+ * @return list - the resulting list
+ *
+ */
+ private List<Bar> internalGetMybars() {
+ if (this.mybars == null) {
+ this.mybars = new java.util.ArrayList<Bar>();
+ }
+ return this.mybars;
+ }
+
+ /**
+ * Adds the given bar to this object.
+ * <p>
+ * Since the reference is a composition reference, the opposite reference
+ * <code>bar#myfoo</code> of the <code>bar</code> will be handled
+ * automatically and no further coding is required to keep them in sync.
+ * <p>
+ * See {@link bar#setMyfoo(bar)}.
+ *
+ * @param bar
+ * - the property
+ * @throws RuntimeException
+ * if instance is <code>disposed</code>
+ *
+ */
+ public void addToMybars(final Bar bar) {
+ checkDisposed();
+ bar.setMyfoo(this);
+ }
+
+ /**
+ * Removes the given bar from this object.
+ * <p>
+ * Since the reference is a cascading reference, the opposite reference
+ * (bar.myfoo) of the bar will be handled automatically and no further
+ * coding is required to keep them in sync. See {@link bar#setMyfoo(bar)}.
+ *
+ * @param bar
+ * - the property
+ * @throws RuntimeException
+ * if instance is <code>disposed</code>
+ *
+ */
+ public void removeFromMybars(final Bar bar) {
+ checkDisposed();
+ bar.setMyfoo(null);
+ }
+
+ /**
+ * For internal use only!
+ */
+ public void internalAddToMybars(final Bar bar) {
+ internalGetMybars().add(bar);
+ }
+
+ /**
+ * For internal use only!
+ */
+ public void internalRemoveFromMybars(final Bar bar) {
+ internalGetMybars().remove(bar);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/ValueBean.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/ValueBean.java
new file mode 100644
index 0000000..f8deb1f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/model/ValueBean.java
@@ -0,0 +1,131 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model;
+
+import java.util.Date;
+
+public class ValueBean extends AbstractBean {
+
+ private String value;
+ private boolean boolValue;
+ private Date dateValue;
+ private int intValue;
+ private long longValue;
+ private double doubleValue;
+ private float floatValue;
+
+ public ValueBean(String value) {
+ super();
+ this.value = value;
+ }
+
+ public ValueBean(boolean value) {
+ super();
+ this.boolValue = value;
+ }
+
+ public ValueBean(Date value) {
+ super();
+ this.dateValue = value;
+ }
+
+ public ValueBean(int value) {
+ super();
+ this.intValue = value;
+ }
+
+ public ValueBean(long value) {
+ super();
+ this.longValue = value;
+ }
+
+ public ValueBean(double value) {
+ super();
+ this.doubleValue = value;
+ }
+
+ public ValueBean(float value) {
+ super();
+ this.floatValue = value;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(String value) {
+ firePropertyChanged("value", this.value, this.value = value);
+ }
+
+ public boolean isBoolValue() {
+ return boolValue;
+ }
+
+ public void setBoolValue(boolean boolValue) {
+ firePropertyChanged("boolValue", this.boolValue,
+ this.boolValue = boolValue);
+ }
+
+ public Date getDateValue() {
+ return dateValue;
+ }
+
+ public void setDateValue(Date dateValue) {
+ firePropertyChanged("dateValue", this.dateValue,
+ this.dateValue = dateValue);
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public void setIntValue(int intValue) {
+ firePropertyChanged("intValue", this.intValue, this.intValue = intValue);
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ public void setLongValue(long longValue) {
+ firePropertyChanged("longValue", this.longValue,
+ this.longValue = longValue);
+ }
+
+ public double getDoubleValue() {
+ return doubleValue;
+ }
+
+ public void setDoubleValue(double doubleValue) {
+ firePropertyChanged("doubleValue", this.doubleValue,
+ this.doubleValue = doubleValue);
+ }
+
+ public float getFloatValue() {
+ return floatValue;
+ }
+
+ public void setFloatValue(float floatValue) {
+ firePropertyChanged("floatValue", this.floatValue,
+ this.floatValue = floatValue);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BindingManagerTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BindingManagerTests.java
new file mode 100644
index 0000000..7561bf3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BindingManagerTests.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManager;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+
+@SuppressWarnings("restriction")
+public class BindingManagerTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private BindingManager bindingManager;
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ bindingManager = new BindingManager(new DefaultViewContext(),
+ VaadinObservables.getRealm(UI.getCurrent()));
+ }
+
+ @Test
+ public void test_bindEnabled() {
+ TextField text = new TextField();
+ YTextField yText = factory.createTextField();
+ yText.setEnabled(yText.isInitialEditable());
+
+ bindingManager.bindEnabled(yText, text);
+ assertTrue(text.isEnabled());
+
+ yText.setEnabled(false);
+ assertFalse(text.isEnabled());
+
+ // test target to model
+ text.setEnabled(true);
+ // -> no update
+ assertFalse(yText.isEnabled());
+ }
+
+ @Test
+ public void test_bindVisible() {
+ TextField text = new TextField();
+ YTextField yText = factory.createTextField();
+ yText.setVisible(yText.isInitialVisible());
+
+ bindingManager.bindVisible(yText, text);
+ assertTrue(text.isVisible());
+
+ yText.setVisible(false);
+ assertFalse(text.isVisible());
+
+ // test target to model
+ text.setVisible(true);
+ // -> no update
+ assertFalse(yText.isVisible());
+ }
+
+ @Test
+ public void test_bindReadonly() {
+ TextField text = new TextField();
+ YTextField yText = factory.createTextField();
+ yText.setEditable(yText.isInitialEditable());
+
+ bindingManager.bindReadonly(yText, text);
+ assertFalse(text.isReadOnly());
+
+ yText.setEditable(true);
+ assertFalse(text.isReadOnly());
+
+ // test target to model
+ text.setReadOnly(false);
+ assertTrue(yText.isEditable());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BrowserPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BrowserPresentationTests.java
new file mode 100644
index 0000000..0a36388
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BrowserPresentationTests.java
@@ -0,0 +1,424 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YBrowser;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBrowserEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.BrowserPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.BrowserFrame;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TextFieldPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class BrowserPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yBrowser
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YBrowser yBrowser = factory.createBrowser();
+ yGridlayout.getElements().add(yBrowser);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart textEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yBrowser);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yBrowser
+ YView yView = factory.createView();
+ YBrowser yBrowser = factory.createBrowser();
+ yView.setContent(yBrowser);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart textEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+
+ BrowserFrame text = (BrowserFrame) presentation.getWidget();
+ assertNotNull(text);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yBrowser
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YBrowser yBrowser1 = factory.createBrowser();
+ yBrowser1.setCssID("ID_0815");
+ yBrowser1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yBrowser1);
+ YBrowser yBrowser2 = factory.createBrowser();
+ yLayout.getElements().add(yBrowser2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yBrowser1);
+ IBrowserEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yBrowser2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+
+ BrowserFrame text1 = (BrowserFrame) text1Presentation.getWidget();
+ BrowserFrame text2 = (BrowserFrame) text2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(text1.getStyleName().contains("anyOtherClass"));
+ assertTrue(text2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", text1.getId());
+ assertEquals(text2Editpart.getId(), text2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yBrowser
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YBrowser yBrowser1 = factory.createBrowser();
+ yLayout.getElements().add(yBrowser1);
+ YBrowser yBrowser2 = factory.createBrowser();
+ yLayout.getElements().add(yBrowser2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yBrowser1);
+ IBrowserEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yBrowser2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ BrowserFrame text1 = (BrowserFrame) text1Presentation.getWidget();
+ BrowserFrame text2 = (BrowserFrame) text2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(text1.isVisible());
+ assertTrue(text1.isEnabled());
+ assertFalse(text1.isReadOnly());
+
+ assertTrue(text2.isVisible());
+ assertTrue(text2.isEnabled());
+ assertFalse(text2.isReadOnly());
+
+ yBrowser1.setVisible(false);
+ assertFalse(text1.isVisible());
+
+ yBrowser1.setEnabled(false);
+ assertFalse(text1.isEnabled());
+
+ yBrowser1.setEditable(false);
+ assertTrue(text1.isReadOnly());
+
+ // target to model -> UI element does not send notifications for
+ // readOnly state changes
+ text1.setReadOnly(false);
+ assertFalse(yBrowser1.isEditable());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YBrowser yBrowser = factory.createBrowser();
+ yView.setContent(yBrowser);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart textEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+
+ }
+
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YBrowser yBrowser = factory.createBrowser();
+ yGridlayout.getElements().add(yBrowser);
+
+ // set the i18n key
+ yBrowser.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IBrowserEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ BrowserPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YBrowser yBrowser = factory.createBrowser();
+ yLayout.getElements().add(yBrowser);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ BrowserFrame browser = (BrowserFrame) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yBrowser.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yBrowser.isEditable());
+ assertFalse(!browser.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yBrowser.isEditable());
+ assertTrue(!browser.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YBrowser yBrowser = factory.createBrowser();
+ yLayout.getElements().add(yBrowser);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ BrowserFrame browser = (BrowserFrame) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yBrowser.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yBrowser.isVisible());
+ assertFalse(browser.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yBrowser.isVisible());
+ assertTrue(browser.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YBrowser yBrowser = factory.createBrowser();
+ yLayout.getElements().add(yBrowser);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IBrowserEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yBrowser);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ BrowserFrame browser = (BrowserFrame) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yBrowser.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yBrowser.isEnabled());
+ assertFalse(browser.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yBrowser.isEnabled());
+ assertTrue(browser.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BundleHelper.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BundleHelper.java
new file mode 100644
index 0000000..d6cc2b6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/BundleHelper.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.knowhowlab.osgi.testing.assertions.BundleAssert.assertBundleAvailable;
+import static org.knowhowlab.osgi.testing.assertions.ServiceAssert.assertServiceAvailable;
+
+import org.knowhowlab.osgi.testing.utils.BundleUtils;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.Activator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * Helps checking required bundles
+ *
+ * @author admin
+ *
+ */
+public class BundleHelper {
+
+ public static void ensureSetup() throws BundleException {
+ ensureNeededBundlesAvailable();
+ ensureNeededServicesAvailable();
+ }
+
+ public static void ensureNeededBundlesAvailable() throws BundleException {
+
+ // check bundles available
+ assertBundleAvailable("org.eclipse.osbp.runtime.web.http");
+ assertBundleAvailable("org.eclipse.osbp.runtime.web.jetty");
+ assertBundleAvailable("org.eclipse.equinox.ds");
+ assertBundleAvailable("org.eclipse.equinox.util");
+ assertBundleAvailable("org.eclipse.equinox.cm");
+
+ // stop jetty
+ Bundle jetty = BundleUtils.findBundle(Activator.context,
+ "org.eclipse.equinox.http.jetty");
+ if (jetty != null) {
+ jetty.stop();
+ }
+
+ // start ds
+ Bundle ds = BundleUtils.findBundle(Activator.context,
+ "org.eclipse.equinox.ds");
+ if (ds == null) {
+ throw new IllegalStateException(
+ "Bundle org.eclipse.equinox.ds is missing!");
+ }
+ if (ds.getState() != Bundle.STARTING && ds.getState() != Bundle.ACTIVE) {
+ ds.start();
+ }
+
+ // start cm
+ Bundle cm = BundleUtils.findBundle(Activator.context,
+ "org.eclipse.equinox.cm");
+ if (cm == null) {
+ throw new IllegalStateException(
+ "Bundle org.eclipse.equinox.cm is missing!");
+ }
+ if (cm.getState() != Bundle.STARTING && cm.getState() != Bundle.ACTIVE) {
+ cm.start();
+ }
+ }
+
+ public static void ensureNeededServicesAvailable() throws BundleException {
+ assertServiceAvailable("org.osgi.service.cm.ConfigurationAdmin");
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ButtonPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ButtonPresentationTests.java
new file mode 100644
index 0000000..60ca730
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ButtonPresentationTests.java
@@ -0,0 +1,415 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IButtonEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ButtonPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link ButtonPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class ButtonPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yButton
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YButton yButton = factory.createButton();
+ yGridlayout.getElements().add(yButton);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart buttonEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton);
+ IWidgetPresentation<Component> presentation = buttonEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yButton);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yButton
+ YView yView = factory.createView();
+ YButton yButton = factory.createButton();
+ yView.setContent(yButton);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart buttonEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton);
+ IWidgetPresentation<Component> presentation = buttonEditpart
+ .getPresentation();
+ Button button = (Button) presentation.getWidget();
+ assertNotNull(button);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yButton
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YButton yButton1 = factory.createButton();
+ yButton1.setCssID("ID_0815");
+ yButton1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yButton1);
+ YButton yButton2 = factory.createButton();
+ yLayout.getElements().add(yButton2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart button1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton1);
+ IButtonEditpart button2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton2);
+ IWidgetPresentation<Component> button1Presentation = button1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> button2Presentation = button2Editpart
+ .getPresentation();
+
+ Button button1 = (Button) button1Presentation.getWidget();
+ Button button2 = (Button) button2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(button1.getStyleName().contains("anyOtherClass"));
+ assertTrue(button2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", button1.getId());
+ assertEquals(button2Editpart.getId(), button2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yButton
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YButton yButton1 = factory.createButton();
+ yLayout.getElements().add(yButton1);
+ YButton yButton2 = factory.createButton();
+ yLayout.getElements().add(yButton2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart button1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton1);
+ IButtonEditpart button2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton2);
+ IWidgetPresentation<Component> button1Presentation = button1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> button2Presentation = button2Editpart
+ .getPresentation();
+ Button button1 = (Button) button1Presentation.getWidget();
+ Button button2 = (Button) button2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(button1.isVisible());
+ assertTrue(button1.isEnabled());
+ assertFalse(button1.isReadOnly());
+
+ assertTrue(button2.isVisible());
+ assertTrue(button2.isEnabled());
+ assertFalse(button2.isReadOnly());
+
+ yButton1.setVisible(false);
+ assertFalse(button1.isVisible());
+
+ yButton1.setEnabled(false);
+ assertFalse(button1.isEnabled());
+
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YButton yButton = factory.createButton();
+ yGridlayout.getElements().add(yButton);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart buttonEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yButton);
+ IWidgetPresentation<Component> presentation = buttonEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YButton yButton = factory.createButton();
+ yGridlayout.getElements().add(yButton);
+
+ // set the i18n key
+ yButton.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext context = renderer.render(rootLayout, yView, parameter);
+ IButtonEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(context, yButton);
+ ButtonPresentation presentation = editpart.getPresentation();
+
+ Button button = (Button) presentation.getWidget();
+ assertEquals("Alter", button.getCaption());
+
+ context.setLocale(Locale.ENGLISH);
+ assertEquals("Age", button.getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YButton yButton = factory.createButton();
+ yLayout.getElements().add(yButton);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yButton);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Button button = (Button) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yButton.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yButton.isEditable());
+ assertFalse(!button.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yButton.isEditable());
+ assertTrue(!button.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YButton yButton = factory.createButton();
+ yLayout.getElements().add(yButton);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yButton);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Button button = (Button) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yButton.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yButton.isVisible());
+ assertFalse(button.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yButton.isVisible());
+ assertTrue(button.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YButton yButton = factory.createButton();
+ yLayout.getElements().add(yButton);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IButtonEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yButton);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Button button = (Button) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yButton.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yButton.isEnabled());
+ assertFalse(button.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yButton.isEnabled());
+ assertTrue(button.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CheckBoxPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CheckBoxPresentationTests.java
new file mode 100644
index 0000000..e667e51
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CheckBoxPresentationTests.java
@@ -0,0 +1,477 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.CheckBoxPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link CheckBoxPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class CheckBoxPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yGridlayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yCheckBox);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yView.setContent(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+
+ CheckBox checkBox = (CheckBox) presentation.getWidget();
+ assertNotNull(checkBox);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yCheckBox1.setCssID("ID_0815");
+ yCheckBox1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yCheckBox1);
+ YCheckBox yCheckBox2 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox1);
+ ICheckboxEditpart checkBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox2);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> checkBox2Presentation = checkBox2Editpart
+ .getPresentation();
+
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+ CheckBox checkBox2 = (CheckBox) checkBox2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(checkBox1.getStyleName().contains("anyOtherClass"));
+ assertTrue(checkBox2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", checkBox1.getId());
+ assertEquals(checkBox2Editpart.getId(), checkBox2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox1);
+ YCheckBox yCheckBox2 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox1);
+ ICheckboxEditpart checkBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox2);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> checkBox2Presentation = checkBox2Editpart
+ .getPresentation();
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+ CheckBox checkBox2 = (CheckBox) checkBox2Presentation.getWidget();
+
+ // start tests
+ //
+ assertFalse(checkBox1.getValue());
+ assertTrue(checkBox1.isVisible());
+ assertTrue(checkBox1.isEnabled());
+ assertFalse(checkBox1.isReadOnly());
+
+ assertTrue(checkBox2.isVisible());
+ assertTrue(checkBox2.isEnabled());
+ assertFalse(checkBox2.isReadOnly());
+
+ yCheckBox1.setVisible(false);
+ assertFalse(checkBox1.isVisible());
+
+ yCheckBox1.setEnabled(false);
+ assertFalse(checkBox1.isEnabled());
+
+ yCheckBox1.setEditable(false);
+ assertTrue(checkBox1.isReadOnly());
+
+ // target to model
+ checkBox1.setReadOnly(false);
+ assertTrue(yCheckBox1.isEditable());
+
+ yCheckBox1.setValue(false);
+ assertFalse(checkBox1.getValue());
+
+ yCheckBox1.setValue(true);
+ assertTrue(checkBox1.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox1);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ checkBox1.setValue(false);
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(true);
+ beanBinding.setPropertyPath("boolValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yCheckBox1.createValueEndpoint(), beanBinding);
+ assertTrue(yCheckBox1.isValue());
+ assertTrue(checkBox1.getValue());
+
+ bean.setBoolValue(false);
+ assertFalse(checkBox1.getValue());
+ assertFalse(yCheckBox1.isValue());
+
+ checkBox1.setValue(true);
+ assertTrue(bean.isBoolValue());
+ assertTrue(yCheckBox1.isValue());
+
+ yCheckBox1.setValue(false);
+ assertFalse(bean.isBoolValue());
+ assertFalse(checkBox1.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yGridlayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yGridlayout.getElements().add(yCheckBox);
+
+ // set the i18n key
+ yCheckBox.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ CheckBoxPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yCheckBox.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isEditable());
+ assertFalse(!box.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isEditable());
+ assertTrue(!box.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yCheckBox.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isVisible());
+ assertFalse(box.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isVisible());
+ assertTrue(box.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yCheckBox.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isEnabled());
+ assertFalse(box.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isEnabled());
+ assertTrue(box.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ComboBoxPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ComboBoxPresentationTests.java
new file mode 100644
index 0000000..2203a9f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ComboBoxPresentationTests.java
@@ -0,0 +1,1373 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IComboBoxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ComboBoxPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Bar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Foo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.eclipse.osbp.runtime.web.vaadin.components.widget.LazyLoadingComboBox;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link ComboBoxPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class ComboBoxPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YComboBox yComboBox = factory.createComboBox();
+ yGridlayout.getElements().add(yComboBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox);
+ IWidgetPresentation<Component> presentation = comboBoxEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yComboBox);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YComboBox yComboBox = factory.createComboBox();
+ yView.setContent(yComboBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox);
+ IWidgetPresentation<Component> presentation = comboBoxEditpart
+ .getPresentation();
+
+ LazyLoadingComboBox comboBox = (LazyLoadingComboBox) presentation
+ .getWidget();
+ assertNotNull(comboBox);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setCssID("ID_0815");
+ yComboBox1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yComboBox1);
+ YComboBox yComboBox2 = factory.createComboBox();
+ yLayout.getElements().add(yComboBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IComboBoxEditpart comboBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox2);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> comboBox2Presentation = comboBox2Editpart
+ .getPresentation();
+
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+ LazyLoadingComboBox comboBox2 = (LazyLoadingComboBox) comboBox2Presentation
+ .getWidget();
+
+ // assert css class
+
+ assertTrue(comboBox1.getStyleName().contains("anyOtherClass"));
+ assertTrue(comboBox2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", comboBox1.getId());
+ assertEquals(comboBox2Editpart.getId(), comboBox2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(String.class);
+ yLayout.getElements().add(yComboBox1);
+ YComboBox yComboBox2 = factory.createComboBox();
+ yComboBox2.setType(String.class);
+ yLayout.getElements().add(yComboBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IComboBoxEditpart comboBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox2);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> comboBox2Presentation = comboBox2Editpart
+ .getPresentation();
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+ LazyLoadingComboBox comboBox2 = (LazyLoadingComboBox) comboBox2Presentation
+ .getWidget();
+
+ // start tests
+ //
+ assertTrue(comboBox1.isVisible());
+ assertTrue(comboBox1.isEnabled());
+ assertFalse(comboBox1.isReadOnly());
+
+ assertTrue(comboBox2.isVisible());
+ assertTrue(comboBox2.isEnabled());
+ assertFalse(comboBox2.isReadOnly());
+
+ yComboBox1.setVisible(false);
+ assertFalse(comboBox1.isVisible());
+
+ yComboBox1.setEnabled(false);
+ assertFalse(comboBox1.isEnabled());
+
+ yComboBox1.setEditable(false);
+ assertTrue(comboBox1.isReadOnly());
+
+ // target to model
+ comboBox1.setReadOnly(false);
+ assertTrue(yComboBox1.isEditable());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(String.class);
+ yLayout.getElements().add(yComboBox1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+
+ // start tests
+ //
+
+ Container.Indexed container = (Indexed) comboBox1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ // add
+ container.addItem("Blabla");
+ assertEquals(1, yComboBox1.getCollection().size());
+ assertEquals(1, container.size());
+
+ yComboBox1.getCollection().add("Huhu");
+ assertEquals(2, yComboBox1.getCollection().size());
+ assertEquals(2, container.size());
+
+ // add at index
+ yComboBox1.getCollection().add(0, "First");
+ assertEquals("First", yComboBox1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ container.addItemAt(0, "Another First");
+ assertEquals("Another First", yComboBox1.getCollection().get(0));
+ assertEquals("Another First", container.getItemIds(0, 1).get(0));
+
+ // move
+ yComboBox1.getCollection().move(1, 0);
+ assertEquals("First", yComboBox1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ // remove all
+ container.removeAllItems();
+ assertEquals(0, yComboBox1.getCollection().size());
+ assertEquals(0, container.size());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_ComboToCombo() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(String.class);
+ yLayout.getElements().add(yComboBox1);
+ YComboBox yComboBox2 = factory.createComboBox();
+ yComboBox2.setType(String.class);
+ yLayout.getElements().add(yComboBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IComboBoxEditpart comboBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox2);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> comboBox2Presentation = comboBox2Editpart
+ .getPresentation();
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+ LazyLoadingComboBox comboBox2 = (LazyLoadingComboBox) comboBox2Presentation
+ .getWidget();
+
+ Container.Indexed indexedDs1 = (Indexed) comboBox1
+ .getContainerDataSource();
+ Container.Indexed indexedDs2 = (Indexed) comboBox2
+ .getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yComboBox1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yComboBox2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ assertEquals(0, yComboBox1.getCollection().size());
+ assertEquals(0, yComboBox2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+
+ // add to yCombo1
+ yComboBox1.getCollection().add("Huhu");
+ assertEquals(1, yComboBox2.getCollection().size());
+ assertEquals("Huhu", yComboBox2.getCollection().get(0));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add to yCombo1
+ yComboBox1.getCollection().add("Huhu2");
+ assertEquals(2, yComboBox2.getCollection().size());
+ assertEquals("Huhu", yComboBox2.getCollection().get(0));
+ assertEquals("Huhu2", yComboBox2.getCollection().get(1));
+ assertEquals("Huhu", yComboBox1.getCollection().get(0));
+ assertEquals("Huhu2", yComboBox1.getCollection().get(1));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ // remove from yCombo2
+ yComboBox2.getCollection().remove("Huhu");
+ assertEquals(1, yComboBox1.getCollection().size());
+ assertEquals(1, yComboBox2.getCollection().size());
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add another to yCombo2
+ yComboBox2.getCollection().add("Blabla");
+ assertEquals(2, yComboBox1.getCollection().size());
+ assertEquals(2, yComboBox2.getCollection().size());
+ assertEquals("Huhu2", yComboBox1.getCollection().get(0));
+ assertEquals("Blabla", yComboBox1.getCollection().get(1));
+ assertEquals("Huhu2", yComboBox2.getCollection().get(0));
+ assertEquals("Blabla", yComboBox2.getCollection().get(1));
+ assertEquals("Huhu2", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yComboBox2.getCollection().move(0, 1);
+ assertEquals(2, yComboBox1.getCollection().size());
+ assertEquals(2, yComboBox2.getCollection().size());
+ assertEquals("Blabla", yComboBox1.getCollection().get(0));
+ assertEquals("Huhu2", yComboBox1.getCollection().get(1));
+ assertEquals("Blabla", yComboBox2.getCollection().get(0));
+ assertEquals("Huhu2", yComboBox2.getCollection().get(1));
+ assertEquals("Blabla", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yComboBox2.getCollection().clear();
+ assertEquals(0, yComboBox1.getCollection().size());
+ assertEquals(0, yComboBox2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(String.class);
+ yLayout.getElements().add(yComboBox1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) comboBox1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox1.getSelection());
+
+ // add
+ yComboBox1.getCollection().add("Huhu");
+ yComboBox1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+
+ // test set selection
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertEquals("Huhu", comboBox1.getValue());
+
+ comboBox1.setValue("Haha");
+ assertEquals("Haha", yComboBox1.getSelection());
+ assertEquals("Haha", comboBox1.getValue());
+
+ // test set selection null
+ comboBox1.setValue(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+
+ comboBox1.setValue("Haha");
+ assertEquals("Haha", yComboBox1.getSelection());
+ assertEquals("Haha", comboBox1.getValue());
+
+ yComboBox1.setSelection(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+
+ // test remove element that is selected
+ // add
+ yComboBox1.getCollection().add("Huhu");
+ yComboBox1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertEquals("Huhu", comboBox1.getValue());
+
+ yComboBox1.getCollection().remove("Huhu");
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox1.getSelection());
+
+ // test remove element that is selected
+ // add
+ yComboBox1.getCollection().add("Huhu");
+ assertEquals(2, container.size());
+
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertEquals("Huhu", comboBox1.getValue());
+
+ comboBox1.setValue(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yLayout.getElements().add(yComboBox1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) comboBox1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox1.getSelection());
+
+ // add
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+
+ // test set selection -> Not a valid selection
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertNull("Huhu", comboBox1.getValue());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_ComboToCombo() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(String.class);
+ yLayout.getElements().add(yComboBox1);
+ YComboBox yComboBox2 = factory.createComboBox();
+ yComboBox2.setType(String.class);
+ yLayout.getElements().add(yComboBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IComboBoxEditpart comboBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox2);
+ IWidgetPresentation<Component> comboBox1Presentation = comboBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> comboBox2Presentation = comboBox2Editpart
+ .getPresentation();
+ LazyLoadingComboBox comboBox1 = (LazyLoadingComboBox) comboBox1Presentation
+ .getWidget();
+ LazyLoadingComboBox comboBox2 = (LazyLoadingComboBox) comboBox2Presentation
+ .getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yComboBox1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yComboBox2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yComboBox1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yComboBox2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) comboBox1
+ .getContainerDataSource();
+ Container.Indexed container2 = (Indexed) comboBox2
+ .getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox1.getSelection());
+
+ // add
+ yComboBox1.getCollection().add("Huhu");
+ yComboBox2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox2.getSelection());
+ assertNull(comboBox2.getValue());
+
+ // test set selection
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertEquals("Huhu", comboBox1.getValue());
+ assertEquals("Huhu", yComboBox2.getSelection());
+ assertEquals("Huhu", comboBox2.getValue());
+
+ comboBox1.setValue("Haha");
+ assertEquals("Haha", yComboBox1.getSelection());
+ assertEquals("Haha", comboBox1.getValue());
+ assertEquals("Haha", yComboBox2.getSelection());
+ assertEquals("Haha", comboBox2.getValue());
+
+ // test set selection null
+ comboBox1.setValue(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox2.getSelection());
+ assertNull(comboBox2.getValue());
+
+ comboBox1.setValue("Haha");
+ assertEquals("Haha", yComboBox1.getSelection());
+ assertEquals("Haha", comboBox1.getValue());
+ assertEquals("Haha", yComboBox2.getSelection());
+ assertEquals("Haha", comboBox2.getValue());
+
+ comboBox2.setValue(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox2.getSelection());
+ assertNull(comboBox2.getValue());
+
+ comboBox2.setValue("Haha");
+ assertEquals("Haha", yComboBox1.getSelection());
+ assertEquals("Haha", comboBox1.getValue());
+ assertEquals("Haha", yComboBox2.getSelection());
+ assertEquals("Haha", comboBox2.getValue());
+
+ yComboBox1.setSelection(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox2.getSelection());
+ assertNull(comboBox2.getValue());
+
+ comboBox2.setValue("Haha");
+ assertEquals("Haha", yComboBox1.getSelection());
+ assertEquals("Haha", comboBox1.getValue());
+ assertEquals("Haha", yComboBox2.getSelection());
+ assertEquals("Haha", comboBox2.getValue());
+
+ yComboBox2.setSelection(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox2.getSelection());
+ assertNull(comboBox2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertEquals("Huhu", yComboBox2.getSelection());
+ assertEquals("Huhu", comboBox1.getValue());
+ assertEquals("Huhu", comboBox2.getValue());
+
+ yComboBox1.getCollection().remove("Huhu");
+ assertNull(comboBox1.getValue());
+ assertNull(comboBox2.getValue());
+ assertNull(yComboBox1.getSelection());
+ assertNull(yComboBox2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yComboBox2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yComboBox1.setSelection("Huhu");
+ assertEquals("Huhu", yComboBox1.getSelection());
+ assertEquals("Huhu", comboBox1.getValue());
+ assertEquals("Huhu", yComboBox2.getSelection());
+ assertEquals("Huhu", comboBox2.getValue());
+
+ comboBox2.setValue(null);
+ assertNull(yComboBox1.getSelection());
+ assertNull(comboBox1.getValue());
+ assertNull(yComboBox2.getSelection());
+ assertNull(comboBox2.getValue());
+ }
+
+ @Test
+ public void test_SelectionBinding_Single_WithAttributePath()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(Bar.class);
+ yLayout.getElements().add(yComboBox1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YEmbeddableSelectionEndpoint selectionBindingEndpoint = yComboBox1
+ .createSelectionEndpoint();
+ selectionBindingEndpoint.setAttributePath("myfoo.name");
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ selectionBindingEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart combobox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IWidgetPresentation<Component> combobox1Presentation = combobox1Editpart
+ .getPresentation();
+ LazyLoadingComboBox combobox1 = (LazyLoadingComboBox) combobox1Presentation
+ .getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) combobox1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(combobox1.getValue());
+ assertNull(yComboBox1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yComboBox1.getCollection().add(bar1);
+ yComboBox1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(combobox1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yComboBox1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yComboBox1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yComboBox1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ combobox1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ combobox1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ combobox1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ combobox1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yComboBox1.getCollection().clear();
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(combobox1.getValue());
+
+ // test setValue to textfield
+ yComboBox1.getCollection().add(bar1);
+ yComboBox1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yComboBox1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yComboBox1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YComboBox yComboBox = factory.createComboBox();
+ yComboBox.setType(String.class);
+ yGridlayout.getElements().add(yComboBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart comboBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox);
+ IWidgetPresentation<Component> presentation = comboBoxEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(6, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToBean()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(Bar.class);
+ yLayout.getElements().add(yComboBox1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yComboBox1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setPropertyPath("myfoo.name");
+ yDetailEndpoint.setType(Bar.class);
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart combobox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IWidgetPresentation<Component> combobox1Presentation = combobox1Editpart
+ .getPresentation();
+ LazyLoadingComboBox combobox1 = (LazyLoadingComboBox) combobox1Presentation
+ .getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) combobox1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(combobox1.getValue());
+ assertNull(yComboBox1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yComboBox1.getCollection().add(bar1);
+ yComboBox1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(combobox1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yComboBox1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yComboBox1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yComboBox1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ combobox1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ combobox1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ combobox1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ combobox1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yComboBox1.getCollection().clear();
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(combobox1.getValue());
+
+ // test setValue to textfield
+ yComboBox1.getCollection().add(bar1);
+ yComboBox1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yComboBox1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yComboBox1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToEmf()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox1 = factory.createComboBox();
+ yComboBox1.setType(EmfBar.class);
+ yComboBox1.setEmfNsURI(ModelPackage.eINSTANCE.getNsURI());
+ yLayout.getElements().add(yComboBox1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yComboBox1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setType(EmfBar.class);
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfBar_Myfoo());
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfFoo_Name());
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart combobox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yComboBox1);
+ IWidgetPresentation<Component> combobox1Presentation = combobox1Editpart
+ .getPresentation();
+ LazyLoadingComboBox combobox1 = (LazyLoadingComboBox) combobox1Presentation
+ .getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) combobox1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(combobox1.getValue());
+ assertNull(yComboBox1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ EmfBar bar1 = ModelFactory.eINSTANCE.createEmfBar();
+ bar1.setName("Bar1");
+ EmfFoo foo1 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ EmfBar bar2 = ModelFactory.eINSTANCE.createEmfBar();
+ bar2.setName("Bar2");
+ EmfFoo foo2 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yComboBox1.getCollection().add(bar1);
+ yComboBox1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(combobox1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yComboBox1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yComboBox1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yComboBox1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ combobox1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ combobox1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ combobox1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ combobox1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yComboBox1.getCollection().clear();
+
+ assertNull(yComboBox1.getSelection());
+ assertNull(combobox1.getValue());
+
+ // test setValue to textfield
+ yComboBox1.getCollection().add(bar1);
+ yComboBox1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yComboBox1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yComboBox1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YComboBox yComboBox = factory.createComboBox();
+ yComboBox.setType(String.class);
+ yView.setContent(yComboBox);
+
+ // set the i18n key
+ yComboBox.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IComboBoxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yComboBox);
+ ComboBoxPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox = factory.createComboBox();
+ yComboBox.setType(String.class);
+ yLayout.getElements().add(yComboBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yComboBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ LazyLoadingComboBox box = (LazyLoadingComboBox) presentation
+ .getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yComboBox.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yComboBox.isEditable());
+ assertFalse(!box.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yComboBox.isEditable());
+ assertTrue(!box.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox = factory.createComboBox();
+ yComboBox.setType(String.class);
+ yLayout.getElements().add(yComboBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yComboBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ LazyLoadingComboBox box = (LazyLoadingComboBox) presentation
+ .getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yComboBox.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yComboBox.isVisible());
+ assertFalse(box.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yComboBox.isVisible());
+ assertTrue(box.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YComboBox yComboBox = factory.createComboBox();
+ yComboBox.setType(String.class);
+ yLayout.getElements().add(yComboBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IComboBoxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yComboBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ LazyLoadingComboBox box = (LazyLoadingComboBox) presentation
+ .getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yComboBox.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yComboBox.isEnabled());
+ assertFalse(box.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yComboBox.isEnabled());
+ assertTrue(box.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CssLayoutPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CssLayoutPresentationTests.java
new file mode 100644
index 0000000..649f8e9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/CssLayoutPresentationTests.java
@@ -0,0 +1,583 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Locale;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCssLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICssLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.CheckBoxPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.CssLayoutPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ViewPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link CssLayoutPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class CssLayoutPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ CssLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ yView.setContent(null);
+ assertTrue(layoutEP.isDisposed());
+ assertTrue(checkBoxEP.isDisposed());
+ assertTrue(textEP.isDisposed());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ yView.setContent(yLayout);
+
+ layoutEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext, yLayout);
+ checkBoxEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext,
+ yCheckBox);
+ textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ assertTrue(layoutEP.isRendered());
+ assertTrue(textEP.isRendered());
+ assertTrue(checkBoxEP.isRendered());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_removeField_AddAndInsert_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ CssLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ CssLayout layout = (CssLayout) layoutPres.getWidget();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertTrue(textPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.removeElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ yLayout.addElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.moveElement(0, yCheckBox);
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yView.setContent(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+
+ CheckBox checkBox = (CheckBox) presentation.getWidget();
+ assertNotNull(checkBox);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yCheckBox1.setCssID("ID_0815");
+ yCheckBox1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yCheckBox1);
+ YCheckBox yCheckBox2 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox1);
+ ICheckboxEditpart checkBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox2);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> checkBox2Presentation = checkBox2Editpart
+ .getPresentation();
+
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+ CheckBox checkBox2 = (CheckBox) checkBox2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(checkBox1.getStyleName().contains("anyOtherClass"));
+ assertTrue(checkBox2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", checkBox1.getId());
+ assertEquals(checkBox2Editpart.getId(), checkBox2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ IWidgetPresentation<Component> layoutPres = layoutEP.getPresentation();
+ CssLayout layout = (CssLayout) layoutPres.getWidget();
+
+ // start tests
+ //
+ assertTrue(layout.isVisible());
+ assertTrue(layout.isEnabled());
+ assertFalse(layout.isReadOnly());
+
+ yLayout.setVisible(false);
+ assertFalse(layout.isVisible());
+
+ }
+
+ @Test
+ public void test_Dispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ CssLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ @Test
+ public void test_ContextDispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IViewEditpart viewEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yView);
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ ViewPresentation viewPres = viewEP.getPresentation();
+ CssLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ viewContext.dispose();
+ assertFalse(viewPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(viewEP.isDisposed());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ Assert.assertNotNull(yView.getContent());
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ IWidgetPresentation<Component> presentation = layoutEP
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(3, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_isRendered_unrender_byEditpart() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ CssLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ ComponentContainer widget = layoutPres.getWidget();
+ Assert.assertNotNull(widget.getParent());
+ layoutEP.requestUnrender();
+ Assert.assertNull(widget.getParent());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+ }
+
+ @Test
+ public void test_isRendered_unrender_Child_byEditpart()
+ throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ICssLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ CssLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ checkBoxEP.requestUnrender();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ CssLayout layout = (CssLayout) layoutPres.getWidget();
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ checkBoxEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YCssLayout yLayout = factory.createCssLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yCheckBox.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isEditable());
+ assertFalse(!box.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isEditable());
+ assertTrue(!box.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DateTimePresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DateTimePresentationTests.java
new file mode 100644
index 0000000..fba1d32
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DateTimePresentationTests.java
@@ -0,0 +1,529 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.print.attribute.standard.DateTimeAtProcessing;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.model.datatypes.DatatypesFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeResolution;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IDateTimeEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.DateTimePresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TextFieldPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class DateTimePresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDateTime yText = factory.createDateTime();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yText);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YDateTime yText = factory.createDateTime();
+ yView.setContent(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+
+ DateField text = (DateField) presentation.getWidget();
+ assertNotNull(text);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDateTime yText1 = factory.createDateTime();
+ yText1.setCssID("ID_0815");
+ yText1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yText1);
+ YDateTime yText2 = factory.createDateTime();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ IDateTimeEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+
+ DateField text1 = (DateField) text1Presentation.getWidget();
+ DateField text2 = (DateField) text2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(text1.getStyleName().contains("anyOtherClass"));
+ assertTrue(text2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", text1.getId());
+ assertEquals(text2Editpart.getId(), text2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDateTime yText1 = factory.createDateTime();
+ yLayout.getElements().add(yText1);
+ YDateTime yText2 = factory.createDateTime();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ IDateTimeEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ DateField text1 = (DateField) text1Presentation.getWidget();
+ DateField text2 = (DateField) text2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(text1.isVisible());
+ assertTrue(text1.isEnabled());
+ assertFalse(text1.isReadOnly());
+
+ assertTrue(text2.isVisible());
+ assertTrue(text2.isEnabled());
+ assertFalse(text2.isReadOnly());
+
+ yText1.setVisible(false);
+ assertFalse(text1.isVisible());
+
+ yText1.setEnabled(false);
+ assertFalse(text1.isEnabled());
+
+ yText1.setEditable(false);
+ assertTrue(text1.isReadOnly());
+
+ // target to model
+ text1.setReadOnly(false);
+ assertTrue(yText1.isEditable());
+
+ Date date = new Date();
+ yText1.setValue(date);
+ assertEquals(date, text1.getValue());
+
+ date = new Date();
+ text1.setValue(date);
+ assertEquals(date, yText1.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDateTime yText1 = factory.createDateTime();
+ yLayout.getElements().add(yText1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DateField text1 = (DateField) text1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(new Date());
+ beanBinding.setPropertyPath("dateValue");
+ beanBinding.setBean(bean);
+
+ yBindingSet.addBinding(yText1.createValueEndpoint(), beanBinding);
+ bean.setDateValue(new Date(100000));
+ assertEquals(bean.getDateValue(), text1.getValue());
+ assertEquals(bean.getDateValue(), yText1.getValue());
+
+ bean.setDateValue(new Date(100001));
+ assertEquals(bean.getDateValue(), text1.getValue());
+ assertEquals(bean.getDateValue().getTime(), yText1.getValue().getTime());
+
+ Date date = new Date(100002);
+ text1.setValue(date);
+ assertEquals(date, bean.getDateValue());
+ assertEquals(date, yText1.getValue());
+
+ date = new Date(100003);
+ yText1.setValue(date);
+ assertEquals(date, bean.getDateValue());
+ assertEquals(date, text1.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDateTime yText = factory.createDateTime();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDateTime yText = factory.createDateTime();
+ yGridlayout.getElements().add(yText);
+
+ // set the i18n key
+ yText.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IDateTimeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yText);
+ DateTimePresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+
+ @Test
+ public void test_Format() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDateTime yText = factory.createDateTime();
+ YDateTimeDatatype yDt = ExtDatatypesFactory.eINSTANCE.createYDateTimeDatatype();
+ // a not allowed setting
+ yDt.setFormat(YDateTimeFormat.DATE);
+ yDt.setResolution(YDateTimeResolution.SECOND);
+ yText.setDatatype(yDt);
+
+ yGridlayout.getElements().add(yText);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IDateTimeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yText);
+ DateTimePresentation presentation = editpart.getPresentation();
+
+ DateField widget = (DateField) presentation.getWidget();
+ assertEquals("dd.MM.yyyy", widget.getDateFormat());
+ assertEquals(Resolution.DAY, widget.getResolution());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDateTime yText = factory.createDateTime();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ DateField datetime = (DateField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isEditable());
+ assertFalse(!datetime.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isEditable());
+ assertTrue(!datetime.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDateTime yText = factory.createDateTime();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ DateField datetime = (DateField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isVisible());
+ assertFalse(datetime.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isVisible());
+ assertTrue(datetime.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDateTime yText = factory.createDateTime();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDateTimeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ DateField datetime = (DateField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isEnabled());
+ assertFalse(datetime.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isEnabled());
+ assertTrue(datetime.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DecimalFieldPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DecimalFieldPresentationTests.java
new file mode 100644
index 0000000..e7f3acd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DecimalFieldPresentationTests.java
@@ -0,0 +1,1330 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IValueBindingEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory;
+import org.eclipse.osbp.ecview.core.common.model.core.YDelegateConverter;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.DelegatingConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IDecimalFieldEditpart;
+import org.eclipse.osbp.ecview.core.util.emf.ModelUtil;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.DecimalField;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TextFieldPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class DecimalFieldPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ Locale.setDefault(Locale.GERMANY);
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ @After
+ public void after() {
+ DelegatingConverterFactory.getInstance().clear();
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDecimalField yText = factory.createDecimalField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yText);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YDecimalField yText = factory.createDecimalField();
+ yView.setContent(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ DecimalField text = (DecimalField) presentation.getWidget();
+ assertNotNull(text);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yText1 = factory.createDecimalField();
+ yText1.setCssID("ID_0815");
+ yText1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yText1);
+ YDecimalField yText2 = factory.createDecimalField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ IDecimalFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+
+ DecimalField text1 = (DecimalField) text1Presentation.getWidget();
+ DecimalField text2 = (DecimalField) text2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(text1.getStyleName().contains("anyOtherClass"));
+ assertTrue(text2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", text1.getId());
+ assertEquals(text2Editpart.getId(), text2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yText1 = factory.createDecimalField();
+ yLayout.getElements().add(yText1);
+ YDecimalField yText2 = factory.createDecimalField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ IDecimalFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ DecimalField text1 = (DecimalField) text1Presentation.getWidget();
+ DecimalField text2 = (DecimalField) text2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(text1.isVisible());
+ assertTrue(text1.isEnabled());
+ assertFalse(text1.isReadOnly());
+
+ assertTrue(text2.isVisible());
+ assertTrue(text2.isEnabled());
+ assertFalse(text2.isReadOnly());
+
+ yText1.setVisible(false);
+ assertFalse(text1.isVisible());
+
+ yText1.setEnabled(false);
+ assertFalse(text1.isEnabled());
+
+ yText1.setEditable(false);
+ assertTrue(text1.isReadOnly());
+
+ // target to model
+ text1.setReadOnly(false);
+ assertTrue(yText1.isEditable());
+
+ yText1.setValue(1122.33);
+ assertEquals("1.122,33", text1.getValue());
+
+ yText1.setValue(3322.11);
+ assertEquals("3.322,11", text1.getValue());
+
+ text1.setValue("9.988,77");
+ assertEquals(9988.77, yText1.getValue(), 0);
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField1 = factory.createDecimalField();
+ yLayout.getElements().add(yField1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field1 = (DecimalField) text1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(9988.77);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yField1.createValueEndpoint(), beanBinding);
+ assertEquals("9.988,77", field1.getValue());
+ assertEquals(9988.77, yField1.getValue(), 0);
+
+ bean.setDoubleValue(2233.44);
+ assertEquals("2.233,44", field1.getValue());
+ assertEquals(2233.44, yField1.getValue(), 0);
+
+ field1.setValue("4.455,66");
+ assertEquals(4455.66, bean.getDoubleValue(), 0);
+ assertEquals(4455.66, yField1.getValue(), 0);
+
+ yField1.setValue(7788.99);
+ assertEquals(7788.99, bean.getDoubleValue(), 0);
+ assertEquals("7.788,99", field1.getValue());
+ }
+
+ @Test
+ public void test_CreateBindingBeforeRendering() throws ContextException {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField1 = factory.createDecimalField();
+ yLayout.getElements().add(yField1);
+
+ //
+ // ADD THE BINDING BEFORE RENDERING
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(9988.77);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yField1.createValueEndpoint(), beanBinding);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field1 = (DecimalField) text1Presentation.getWidget();
+
+ assertEquals("9.988,77", field1.getValue());
+ assertEquals(9988.77, yField1.getValue(), 0);
+
+ bean.setDoubleValue(2233.44);
+ assertEquals("2.233,44", field1.getValue());
+ assertEquals(2233.44, yField1.getValue(), 0);
+
+ field1.setValue("4.455,66");
+ assertEquals(4455.66, bean.getDoubleValue(), 0);
+ assertEquals(4455.66, yField1.getValue(), 0);
+
+ yField1.setValue(7788.99);
+ assertEquals(7788.99, bean.getDoubleValue(), 0);
+ assertEquals("7.788,99", field1.getValue());
+ }
+
+ /**
+ * Test whether negative values receive an additional CSS style
+ *
+ * @throws ContextException
+ *
+ */
+ @Test
+ public void test_MarkNegative() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDecimalField yText = factory.createDecimalField();
+
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ DecimalField field = (DecimalField) presentation.getWidget();
+ yText.setValue(99);
+ assertEquals("99,00", field.getValue());
+ assertFalse(field.getStyleName().contains("lun-negative-value"));
+ yText.setValue(-99);
+ assertEquals("-99,00", field.getValue());
+ assertTrue(field.getStyleName().contains("lun-negative-value"));
+ }
+
+ @Test
+ public void test_Grouping() throws ContextException {
+
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField1 = factory.createDecimalField();
+ yLayout.getElements().add(yField1);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setGrouping(true);
+ yField1.setDatatype(dt1);
+
+ YDecimalField yField2 = factory.createDecimalField();
+ yLayout.getElements().add(yField2);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setGrouping(false);
+ yField2.setDatatype(dt2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field1 = (DecimalField) text1Presentation.getWidget();
+
+ IDecimalFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField2);
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ DecimalField field2 = (DecimalField) text2Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(9988.77);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yField1.createValueEndpoint(), beanBinding);
+ assertEquals("9.988,77", field1.getValue());
+ assertEquals(9988.77, yField1.getValue(), 0);
+
+ YBeanValueBindingEndpoint beanBinding2 = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean2 = new ValueBean(9988.77);
+ beanBinding2.setPropertyPath("doubleValue");
+ beanBinding2.setBean(bean2);
+ yBindingSet.addBinding(yField2.createValueEndpoint(), beanBinding2);
+ assertEquals("9988,77", field2.getValue());
+ assertEquals(9988.77, yField2.getValue(), 0);
+
+ bean.setDoubleValue(2233.44);
+ assertEquals("2.233,44", field1.getValue());
+ assertEquals(2233.44, yField1.getValue(), 0);
+
+ bean2.setDoubleValue(2233.44);
+ assertEquals("2233,44", field2.getValue());
+ assertEquals(2233.44, yField2.getValue(), 0);
+
+ field1.setValue("4.455,66");
+ assertEquals(4455.66, bean.getDoubleValue(), 0);
+ assertEquals(4455.66, yField1.getValue(), 0);
+
+ // grouped value in ungrouped field is not converted
+ field2.setValue("4.455,66");
+ // assertEquals("4455,66", field2.getValue());
+ // assertEquals(4455.66, bean2.getDoubleValue(), 0);
+ // assertEquals(4455.66, yField2.getValue(), 0);
+
+ field2.setValue("4455,66");
+ assertEquals("4455,66", field2.getValue());
+ assertEquals(4455.66, bean2.getDoubleValue(), 0);
+ assertEquals(4455.66, yField2.getValue(), 0);
+
+ yField1.setValue(7788.99);
+ assertEquals(7788.99, bean.getDoubleValue(), 0);
+ assertEquals("7.788,99", field1.getValue());
+
+ yField2.setValue(7788.99);
+ assertEquals(7788.99, bean2.getDoubleValue(), 0);
+ assertEquals("7788,99", field2.getValue());
+
+ }
+
+ @Test
+ public void test_Precision() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField1 = factory.createDecimalField();
+ yLayout.getElements().add(yField1);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setPrecision(3);
+ yField1.setDatatype(dt1);
+
+ YDecimalField yField2 = factory.createDecimalField();
+ yLayout.getElements().add(yField2);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setPrecision(0);
+ yField2.setDatatype(dt2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field1 = (DecimalField) text1Presentation.getWidget();
+
+ IDecimalFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField2);
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ DecimalField field2 = (DecimalField) text2Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(9988.77);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yField1.createValueEndpoint(), beanBinding);
+ assertEquals("9.988,770", field1.getValue());
+ assertEquals(9988.77, yField1.getValue(), 0);
+
+ YBeanValueBindingEndpoint beanBinding2 = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean2 = new ValueBean(9988.77);
+ beanBinding2.setPropertyPath("doubleValue");
+ beanBinding2.setBean(bean2);
+ yBindingSet.addBinding(yField2.createValueEndpoint(), beanBinding2);
+ assertEquals("9.989", field2.getValue());
+ assertEquals(9989, yField2.getValue(), 0);
+ // rounded value should be written back to bean itself
+ assertEquals(9989, bean2.getDoubleValue(), 0);
+
+ bean.setDoubleValue(2233.44);
+ assertEquals("2.233,440", field1.getValue());
+ assertEquals(2233.44, yField1.getValue(), 0);
+
+ bean2.setDoubleValue(2233.44);
+ assertEquals("2.233", field2.getValue());
+ assertEquals(2233, yField2.getValue(), 0);
+ // rounded value should be written back to bean itself
+ assertEquals(2233, bean2.getDoubleValue(), 0);
+
+ field1.setValue("4.455,66");
+ assertEquals(4455.660, bean.getDoubleValue(), 0);
+ assertEquals(4455.66, yField1.getValue(), 0);
+
+ field2.setValue("4.455,66");
+ assertEquals("4.456", field2.getValue());
+ assertEquals(4456, yField2.getValue(), 0);
+ assertEquals(4456, bean2.getDoubleValue(), 0);
+
+ yField1.setValue(7788.99);
+ assertEquals(7788.99, bean.getDoubleValue(), 0);
+ assertEquals("7.788,990", field1.getValue());
+
+ yField2.setValue(7788.99);
+ assertEquals(7789, bean2.getDoubleValue(), 0);
+ assertEquals("7.789", field2.getValue());
+ assertEquals(7789, yField2.getValue(), 0);
+
+ }
+
+ @Test
+ public void test_BindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YDecimalField yText = factory.createDecimalField();
+ yView.setContent(yText);
+ YDecimalDatatype dt = factory.createDecimalDatatype();
+ dt.setGrouping(true);
+ yText.setDatatype(dt);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractVaadinWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ DecimalField text = (DecimalField) presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(123.0);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+
+ YEmbeddableValueEndpoint valueEndpoint = yText.createValueEndpoint();
+ yBindingSet.addBinding(valueEndpoint, beanBinding);
+ assertEquals("123,00", text.getValue());
+ assertEquals(123, bean.getDoubleValue(), 0);
+
+ IElementEditpart beanBindingEditPart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, beanBinding);
+ IElementEditpart valueEndpointEditPart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, valueEndpoint);
+
+ Set<Binding> toUIBindings = presentation.getUIBindings();
+
+ Binding binding = ModelUtil.getValueBinding(yText);
+ assertFalse(textEditpart.isDisposed());
+ assertFalse(presentation.isDisposed());
+ assertFalse(binding.isDisposed());
+ assertFalse(beanBindingEditPart.isDisposed());
+ assertFalse(valueEndpointEditPart.isDisposed());
+ for (Binding toUiBinding : toUIBindings) {
+ assertFalse(toUiBinding.isDisposed());
+ }
+
+ textEditpart.dispose();
+ assertTrue(textEditpart.isDisposed());
+ assertTrue(presentation.isDisposed());
+ assertTrue(binding.isDisposed());
+ assertTrue(beanBindingEditPart.isDisposed());
+ assertTrue(valueEndpointEditPart.isDisposed());
+ for (Binding toUiBinding : toUIBindings) {
+ assertTrue(toUiBinding.isDisposed());
+ }
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_BindingWithUnrender() throws ContextException {
+ YView yView = factory.createView();
+ YDecimalField yText = factory.createDecimalField();
+ yView.setContent(yText);
+ YDecimalDatatype dt = factory.createDecimalDatatype();
+ dt.setGrouping(true);
+ yText.setDatatype(dt);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractVaadinWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ DecimalField text = (DecimalField) presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(123.0);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+
+ YEmbeddableValueEndpoint valueEndpoint = yText.createValueEndpoint();
+ yBindingSet.addBinding(valueEndpoint, beanBinding);
+ assertEquals("123,00", text.getValue());
+ assertEquals(123, bean.getDoubleValue(), 0);
+
+ IElementEditpart beanBindingEditPart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, beanBinding);
+ IElementEditpart valueEndpointEditPart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, valueEndpoint);
+
+ Assert.assertFalse(presentation.isDisposed());
+ Assert.assertTrue(presentation.isRendered());
+ Binding binding = ModelUtil.getValueBinding(yText);
+ IValueBindingEditpart bindingEditpart = ModelUtil
+ .getValueBindingEditpart(yText);
+ Assert.assertFalse(binding.isDisposed());
+ Assert.assertFalse(bindingEditpart.isDisposed());
+ Assert.assertTrue(bindingEditpart.isBound());
+
+ Set<Binding> uiBindings = new HashSet<Binding>(
+ presentation.getUIBindings());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertFalse(uiBinding.isDisposed());
+ }
+
+ Assert.assertFalse(beanBindingEditPart.isDisposed());
+ Assert.assertFalse(valueEndpointEditPart.isDisposed());
+
+ //
+ // Unrender
+ //
+ presentation.unrender();
+
+ Assert.assertFalse(presentation.isDisposed());
+ Assert.assertFalse(presentation.isRendered());
+ Assert.assertTrue(binding.isDisposed());
+ Assert.assertFalse(bindingEditpart.isDisposed());
+ Assert.assertFalse(bindingEditpart.isBound());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertTrue(uiBinding.isDisposed());
+ }
+
+ Assert.assertTrue(beanBindingEditPart.isDisposed());
+ Assert.assertTrue(valueEndpointEditPart.isDisposed());
+
+ //
+ // now render the element again
+ //
+ rootLayout.addComponent(presentation.createWidget(rootLayout));
+
+ beanBindingEditPart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, beanBinding);
+ valueEndpointEditPart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, valueEndpoint);
+
+ Assert.assertFalse(presentation.isDisposed());
+ Assert.assertTrue(presentation.isRendered());
+ binding = ModelUtil.getValueBinding(yText);
+ bindingEditpart = ModelUtil.getValueBindingEditpart(yText);
+ Assert.assertFalse(binding.isDisposed());
+ Assert.assertFalse(bindingEditpart.isDisposed());
+ Assert.assertTrue(bindingEditpart.isBound());
+
+ uiBindings = new HashSet<Binding>(presentation.getUIBindings());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertFalse(uiBinding.isDisposed());
+ }
+
+ Assert.assertFalse(beanBindingEditPart.isDisposed());
+ Assert.assertFalse(valueEndpointEditPart.isDisposed());
+
+ //
+ // And unrender
+ //
+ presentation.unrender();
+
+ Assert.assertFalse(presentation.isDisposed());
+ Assert.assertFalse(presentation.isRendered());
+ Assert.assertTrue(binding.isDisposed());
+ Assert.assertFalse(bindingEditpart.isDisposed());
+ Assert.assertFalse(bindingEditpart.isBound());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertTrue(uiBinding.isDisposed());
+ }
+
+ Assert.assertTrue(beanBindingEditPart.isDisposed());
+ Assert.assertTrue(valueEndpointEditPart.isDisposed());
+
+ }
+
+ @Test
+ public void test_Binding_RemoveAndAddElement() throws ContextException {
+ YView yView = factory.createView();
+ YDecimalField yText = factory.createDecimalField();
+ yView.setContent(yText);
+ YDecimalDatatype dt = factory.createDecimalDatatype();
+ dt.setGrouping(true);
+ yText.setDatatype(dt);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractVaadinWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ DecimalField text = (DecimalField) presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(123.0);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+
+ YEmbeddableValueEndpoint valueEndpoint = yText.createValueEndpoint();
+ yBindingSet.addBinding(valueEndpoint, beanBinding);
+ assertEquals("123,00", text.getValue());
+ assertEquals(123, bean.getDoubleValue(), 0);
+
+ IElementEditpart beanBindingEditPart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, beanBinding);
+ IElementEditpart valueEndpointEditPart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, valueEndpoint);
+
+ Assert.assertFalse(presentation.isDisposed());
+ Assert.assertTrue(presentation.isRendered());
+ Binding binding = ModelUtil.getValueBinding(yText);
+ IValueBindingEditpart bindingEditpart = ModelUtil
+ .getValueBindingEditpart(yText);
+ Assert.assertFalse(binding.isDisposed());
+ Assert.assertFalse(bindingEditpart.isDisposed());
+ Assert.assertTrue(bindingEditpart.isBound());
+
+ Set<Binding> uiBindings = new HashSet<Binding>(
+ presentation.getUIBindings());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertFalse(uiBinding.isDisposed());
+ }
+
+ Assert.assertFalse(beanBindingEditPart.isDisposed());
+ Assert.assertFalse(valueEndpointEditPart.isDisposed());
+
+ //
+ // Unrender by remove
+ //
+ yView.setContent(null);
+
+ Assert.assertTrue(presentation.isDisposed());
+ Assert.assertFalse(presentation.isRendered());
+ Assert.assertTrue(binding.isDisposed());
+ Assert.assertTrue(bindingEditpart.isDisposed());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertTrue(uiBinding.isDisposed());
+ }
+
+ Assert.assertTrue(beanBindingEditPart.isDisposed());
+ Assert.assertTrue(valueEndpointEditPart.isDisposed());
+
+ //
+ // now render the element again
+ //
+ yView.setContent(yText);
+
+ textEditpart = DelegatingEditPartManager.getInstance().getEditpart(viewContext,
+ yText);
+ presentation = textEditpart.getPresentation();
+
+ beanBindingEditPart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, beanBinding);
+ valueEndpointEditPart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, valueEndpoint);
+
+ Assert.assertFalse(presentation.isDisposed());
+ Assert.assertTrue(presentation.isRendered());
+ binding = ModelUtil.getValueBinding(yText);
+ bindingEditpart = ModelUtil.getValueBindingEditpart(yText);
+ Assert.assertFalse(binding.isDisposed());
+ Assert.assertFalse(bindingEditpart.isDisposed());
+ Assert.assertTrue(bindingEditpart.isBound());
+
+ uiBindings = new HashSet<Binding>(presentation.getUIBindings());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertFalse(uiBinding.isDisposed());
+ }
+
+ Assert.assertFalse(beanBindingEditPart.isDisposed());
+ Assert.assertFalse(valueEndpointEditPart.isDisposed());
+
+ //
+ // And unrender
+ //
+ yView.setContent(null);
+
+ Assert.assertTrue(presentation.isDisposed());
+ Assert.assertFalse(presentation.isRendered());
+ Assert.assertTrue(binding.isDisposed());
+ Assert.assertTrue(bindingEditpart.isDisposed());
+ for (Binding uiBinding : uiBindings) {
+ Assert.assertTrue(uiBinding.isDisposed());
+ }
+
+ Assert.assertTrue(beanBindingEditPart.isDisposed());
+ Assert.assertTrue(valueEndpointEditPart.isDisposed());
+
+ }
+
+ @Test
+ public void testPrecision_ByChangingDatatype() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField = factory.createDecimalField();
+ yLayout.getElements().add(yField);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setPrecision(3);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setPrecision(1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field = (DecimalField) text1Presentation.getWidget();
+
+ // start tests
+ yField.setDatatype(dt1);
+ yField.setValue(112233.44);
+ assertEquals("112.233,440", field.getValue());
+ assertEquals(112233.44, yField.getValue(), 0);
+
+ yField.setDatatype(dt2);
+ assertEquals("112.233,4", field.getValue());
+ assertEquals(112233.4, yField.getValue(), 0);
+
+ yField.setValue(567.890);
+ assertEquals("567,9", field.getValue());
+ assertEquals(567.9, yField.getValue(), 0);
+ }
+
+ @Test
+ public void testMarkNegative_ByChangingDatatype() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField = factory.createDecimalField();
+ yLayout.getElements().add(yField);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setMarkNegative(true);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setMarkNegative(false);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field = (DecimalField) text1Presentation.getWidget();
+
+ // start tests
+ yField.setDatatype(dt1);
+ yField.setValue(112233);
+ assertEquals("112.233,00", field.getValue());
+ assertEquals(112233.0, yField.getValue(), 0);
+ assertFalse(field.getStyleName().contains("lun-negative-value"));
+
+ yField.setValue(-112233.0);
+ assertEquals("-112.233,00", field.getValue());
+ assertEquals(-112233.0, yField.getValue(), 0);
+ assertTrue(field.getStyleName().contains("lun-negative-value"));
+
+ yField.setDatatype(dt2);
+ assertEquals("-112.233,00", field.getValue());
+ assertEquals(-112233.0, yField.getValue(), 0);
+ assertFalse(field.getStyleName().contains("lun-negative-value"));
+ }
+
+ @Test
+ public void testGrouping_ByChangingDatatype() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yField = factory.createDecimalField();
+ yLayout.getElements().add(yField);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setGrouping(true);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setPrecision(1);
+ dt2.setGrouping(false);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ DecimalField field = (DecimalField) text1Presentation.getWidget();
+
+ // start tests
+ yField.setDatatype(dt1);
+ yField.setValue(112233.44);
+ assertEquals("112.233,44", field.getValue());
+ assertEquals(112233.44, yField.getValue(), 0);
+
+ yField.setDatatype(dt2);
+ assertEquals("112233,4", field.getValue());
+ assertEquals(112233.4, yField.getValue(), 0);
+
+ yField.setValue(4567.890);
+ assertEquals("4567,9", field.getValue());
+ assertEquals(4567.9, yField.getValue(), 0);
+ ;
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ yDecimal.setValue(123456789.1122);
+ YDecimalDatatype yDt = factory.createDecimalDatatype();
+ yDt.setPrecision(4);
+ yDecimal.setDatatype(yDt);
+
+ yGridlayout.getElements().add(yDecimal);
+
+ // set the i18n key
+ yDecimal.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IDecimalFieldEditpart decimalEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ AbstractFieldWidgetPresenter<Component> presentation = decimalEditpart
+ .getPresentation();
+
+ DecimalField decimalField = (DecimalField) presentation.getWidget();
+ assertEquals("Alter", presentation.getWidget().getCaption());
+ assertEquals("123.456.789,1122", decimalField.getValue());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ assertEquals("123,456,789.1122", decimalField.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ yLayout.getElements().add(yDecimal);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ DecimalField decimalField = (DecimalField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yDecimal.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yDecimal.isEditable());
+ assertFalse(!decimalField.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yDecimal.isEditable());
+ assertTrue(!decimalField.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ yLayout.getElements().add(yDecimal);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ DecimalField decimalField = (DecimalField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yDecimal.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yDecimal.isVisible());
+ assertFalse(decimalField.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yDecimal.isVisible());
+ assertTrue(decimalField.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ yLayout.getElements().add(yDecimal);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ DecimalField decimalField = (DecimalField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yDecimal.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yDecimal.isEnabled());
+ assertFalse(decimalField.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yDecimal.isEnabled());
+ assertTrue(decimalField.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Converter() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ YDelegateConverter yConverter = CoreModelFactory.eINSTANCE
+ .createYDelegateConverter();
+ yConverter.setConverterId("text.test");
+ yDecimal.setConverter(yConverter);
+ yGridlayout.getElements().add(yDecimal);
+
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ DecimalField text = (DecimalField) presentation.getWidget();
+
+ yDecimal.setValue(123);
+ assertEquals(123, yDecimal.getValue(), 0);
+ assertEquals("123.00 EUR", text.getValue());
+
+ text.setValue("321.00 EUR");
+ assertEquals(321, yDecimal.getValue(), 0);
+ assertEquals("321.00 EUR", text.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ConverterAndDatatype() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ YDelegateConverter yConverter = CoreModelFactory.eINSTANCE
+ .createYDelegateConverter();
+ yConverter.setConverterId("text.test");
+ yDecimal.setConverter(yConverter);
+
+ YDecimalDatatype dt = factory.createDecimalDatatype();
+ dt.setGrouping(true);
+ dt.setPrecision(4);
+ yDecimal.setDatatype(dt);
+
+ yGridlayout.getElements().add(yDecimal);
+
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ DecimalField text = (DecimalField) presentation.getWidget();
+
+ yDecimal.setValue(123);
+ assertEquals(123, yDecimal.getValue(), 0);
+ assertEquals("123.0000 EUR", text.getValue());
+
+ text.setValue("321.0000 EUR");
+ assertEquals(321, yDecimal.getValue(), 0);
+ assertEquals("321.0000 EUR", text.getValue());
+
+ dt.setPrecision(0);
+ assertEquals(321, yDecimal.getValue(), 0);
+ assertEquals("321 EUR", text.getValue());
+
+ dt.setPrecision(3);
+ assertEquals(321, yDecimal.getValue(), 0);
+ assertEquals("321.000 EUR", text.getValue());
+
+ }
+
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Converter_RemoveAndAdd() throws Exception {
+
+ Locale.setDefault(Locale.US);
+
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YDecimalField yDecimal = factory.createDecimalField();
+ YDelegateConverter yConverter = CoreModelFactory.eINSTANCE
+ .createYDelegateConverter();
+ yConverter.setConverterId("text.test");
+ yDecimal.setConverter(yConverter);
+
+ YDecimalDatatype dt = factory.createDecimalDatatype();
+ dt.setGrouping(true);
+ dt.setPrecision(4);
+ yDecimal.setDatatype(dt);
+
+ yGridlayout.getElements().add(yDecimal);
+
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IDecimalFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ DecimalField text = (DecimalField) presentation.getWidget();
+
+ yDecimal.setValue(123);
+ assertEquals(123, yDecimal.getValue(), 0);
+ assertEquals("123.0000 EUR", text.getValue());
+
+ yDecimal.setConverter(null);
+ yDecimal.setValue(321);
+ assertEquals(321, yDecimal.getValue(), 0);
+ assertEquals("321.0000", text.getValue());
+
+ yDecimal.setConverter(yConverter);
+ yDecimal.setValue(123);
+ assertEquals(123, yDecimal.getValue(), 0);
+ assertEquals("123.0000 EUR", text.getValue());
+ }
+
+ private static class ConverterFactory implements IConverterFactory {
+
+ @Override
+ public boolean isFor(IViewContext uiContext, IConverterEditpart editpart) {
+ return true;
+ }
+
+ @Override
+ public Object createConverter(IViewContext uiContext,
+ IConverterEditpart editpart) throws IllegalArgumentException {
+ return new Converter();
+ }
+ }
+
+ /**
+ */
+ @SuppressWarnings("serial")
+ private static class Converter extends DecimalConverter {
+
+ @Override
+ protected NumberFormat getFormat(Locale locale) {
+ DecimalFormat result = new DecimalFormat(
+ super.getNumberFormatPattern() + " EUR",
+ DecimalFormatSymbols.getInstance(Locale.US));
+ return result;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java
new file mode 100644
index 0000000..a867174
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultUI.java
@@ -0,0 +1,150 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import java.util.Properties;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinService;
+import com.vaadin.server.VaadinServletService;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.shared.communication.PushMode;
+import com.vaadin.ui.UI;
+
+@SuppressWarnings("serial")
+public class DefaultUI extends UI {
+
+ public DefaultUI() {
+ try {
+ VaadinSession session = new CustomVaadinSession(
+ new VaadinServletService(null,
+ new CustomDeploymentConfiguration()));
+ setSession(session);
+
+ VaadinSession.setCurrent(session);
+
+ } catch (ServiceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @Override
+ protected void init(VaadinRequest request) {
+
+ }
+
+ private class CustomVaadinSession extends VaadinSession {
+
+ Lock lock = new ReentrantLock();
+
+ public CustomVaadinSession(VaadinService service) {
+ super(service);
+ }
+
+ @Override
+ public Lock getLockInstance() {
+ return lock;
+ }
+
+ }
+
+ private static class CustomDeploymentConfiguration implements
+ DeploymentConfiguration {
+
+ @Override
+ public boolean isProductionMode() {
+ return false;
+ }
+
+ @Override
+ public boolean isXsrfProtectionEnabled() {
+ return false;
+ }
+
+ @Override
+ public boolean isSyncIdCheckEnabled() {
+ return false;
+ }
+
+ @Override
+ public int getResourceCacheTime() {
+ return 0;
+ }
+
+ @Override
+ public int getHeartbeatInterval() {
+ return 0;
+ }
+
+ @Override
+ public boolean isCloseIdleSessions() {
+ return false;
+ }
+
+ @Override
+ public PushMode getPushMode() {
+ return PushMode.DISABLED;
+ }
+
+ @Override
+ public Properties getInitParameters() {
+ return new Properties();
+ }
+
+ @Override
+ public String getApplicationOrSystemProperty(String propertyName,
+ String defaultValue) {
+ return null;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public LegacyProperyToStringMode getLegacyPropertyToStringMode() {
+ return LegacyProperyToStringMode.DISABLED;
+ }
+
+ @Override
+ public boolean isSendUrlsAsParameters() {
+ return false;
+ }
+
+ @Override
+ public String getUIClassName() {
+ return null;
+ }
+
+ @Override
+ public String getUIProviderClassName() {
+ return null;
+ }
+
+ @Override
+ public String getWidgetset(String defaultValue) {
+ return null;
+ }
+
+ @Override
+ public String getResourcesPath() {
+ return null;
+ }
+
+ @Override
+ public String getClassLoaderName() {
+ return null;
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultViewContext.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultViewContext.java
new file mode 100644
index 0000000..252a3dc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/DefaultViewContext.java
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import org.eclipse.osbp.ecview.core.common.context.ViewContext;
+
+public class DefaultViewContext extends ViewContext {
+
+ public DefaultViewContext() {
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/FormLayoutPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/FormLayoutPresentationTests.java
new file mode 100644
index 0000000..7c429a1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/FormLayoutPresentationTests.java
@@ -0,0 +1,583 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Locale;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YFormLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IFormLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.CheckBoxPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.FormLayoutPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ViewPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link FormLayoutPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class FormLayoutPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ FormLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ yView.setContent(null);
+ assertTrue(layoutEP.isDisposed());
+ assertTrue(checkBoxEP.isDisposed());
+ assertTrue(textEP.isDisposed());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ yView.setContent(yLayout);
+
+ layoutEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext, yLayout);
+ checkBoxEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext,
+ yCheckBox);
+ textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ assertTrue(layoutEP.isRendered());
+ assertTrue(textEP.isRendered());
+ assertTrue(checkBoxEP.isRendered());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_removeField_AddAndInsert_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ FormLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ FormLayout layout = (FormLayout) layoutPres.getWidget();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertTrue(textPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.removeElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ yLayout.addElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.moveElement(0, yCheckBox);
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yView.setContent(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+
+ CheckBox checkBox = (CheckBox) presentation.getWidget();
+ assertNotNull(checkBox);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yCheckBox1.setCssID("ID_0815");
+ yCheckBox1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yCheckBox1);
+ YCheckBox yCheckBox2 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox1);
+ ICheckboxEditpart checkBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox2);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> checkBox2Presentation = checkBox2Editpart
+ .getPresentation();
+
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+ CheckBox checkBox2 = (CheckBox) checkBox2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(checkBox1.getStyleName().contains("anyOtherClass"));
+ assertTrue(checkBox2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", checkBox1.getId());
+ assertEquals(checkBox2Editpart.getId(), checkBox2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ IWidgetPresentation<Component> layoutPres = layoutEP.getPresentation();
+ FormLayout layout = (FormLayout) layoutPres.getWidget();
+
+ // start tests
+ //
+ assertTrue(layout.isVisible());
+ assertTrue(layout.isEnabled());
+ assertFalse(layout.isReadOnly());
+
+ yLayout.setVisible(false);
+ assertFalse(layout.isVisible());
+
+ }
+
+ @Test
+ public void test_Dispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ FormLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ @Test
+ public void test_ContextDispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IViewEditpart viewEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yView);
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ ViewPresentation viewPres = viewEP.getPresentation();
+ FormLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ viewContext.dispose();
+ assertFalse(viewPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(viewEP.isDisposed());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ Assert.assertNotNull(yView.getContent());
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ IWidgetPresentation<Component> presentation = layoutEP
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(3, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_isRendered_unrender_byEditpart() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ FormLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ ComponentContainer widget = layoutPres.getWidget();
+ Assert.assertNotNull(widget.getParent());
+ layoutEP.requestUnrender();
+ Assert.assertNull(widget.getParent());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+ }
+
+ @Test
+ public void test_isRendered_unrender_Child_byEditpart()
+ throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IFormLayoutEditpart layoutEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ FormLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ checkBoxEP.requestUnrender();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ FormLayout layout = (FormLayout) layoutPres.getWidget();
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ checkBoxEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YFormLayout yLayout = factory.createFormLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yCheckBox.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isEditable());
+ assertFalse(!box.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isEditable());
+ assertTrue(!box.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/HorizontalLayoutPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/HorizontalLayoutPresentationTests.java
new file mode 100644
index 0000000..e92eea3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/HorizontalLayoutPresentationTests.java
@@ -0,0 +1,584 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Locale;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IHorizontalLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.CheckBoxPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.HorizontalLayoutPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ViewPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link HorizontalLayoutPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class HorizontalLayoutPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ HorizontalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ yView.setContent(null);
+ assertTrue(layoutEP.isDisposed());
+ assertTrue(checkBoxEP.isDisposed());
+ assertTrue(textEP.isDisposed());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ yView.setContent(yLayout);
+
+ layoutEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext, yLayout);
+ checkBoxEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext,
+ yCheckBox);
+ textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ assertTrue(layoutEP.isRendered());
+ assertTrue(textEP.isRendered());
+ assertTrue(checkBoxEP.isRendered());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_removeField_AddAndInsert_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ HorizontalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ HorizontalLayout layout = (HorizontalLayout) layoutPres.getWidget();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertTrue(textPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.removeElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ yLayout.addElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.moveElement(0, yCheckBox);
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yView.setContent(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+
+ CheckBox checkBox = (CheckBox) presentation.getWidget();
+ assertNotNull(checkBox);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yCheckBox1.setCssID("ID_0815");
+ yCheckBox1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yCheckBox1);
+ YCheckBox yCheckBox2 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox1);
+ ICheckboxEditpart checkBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yCheckBox2);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> checkBox2Presentation = checkBox2Editpart
+ .getPresentation();
+
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+ CheckBox checkBox2 = (CheckBox) checkBox2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(checkBox1.getStyleName().contains("anyOtherClass"));
+ assertTrue(checkBox2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", checkBox1.getId());
+ assertEquals(checkBox2Editpart.getId(), checkBox2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ IWidgetPresentation<Component> layoutPres = layoutEP.getPresentation();
+ HorizontalLayout layout = (HorizontalLayout) layoutPres.getWidget();
+
+ // start tests
+ //
+ assertTrue(layout.isVisible());
+ assertTrue(layout.isEnabled());
+ assertFalse(layout.isReadOnly());
+
+ yLayout.setVisible(false);
+ assertFalse(layout.isVisible());
+
+ }
+
+ @Test
+ public void test_Dispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ HorizontalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ @Test
+ public void test_ContextDispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IViewEditpart viewEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yView);
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ ViewPresentation viewPres = viewEP.getPresentation();
+ HorizontalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ viewContext.dispose();
+ assertFalse(viewPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(viewEP.isDisposed());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ Assert.assertNotNull(yView.getContent());
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ IWidgetPresentation<Component> presentation = layoutEP
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(3, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_isRendered_unrender_byEditpart() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ HorizontalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ ComponentContainer widget = layoutPres.getWidget();
+ Assert.assertNotNull(widget.getParent());
+ layoutEP.requestUnrender();
+ Assert.assertNull(widget.getParent());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+ }
+
+ @Test
+ public void test_isRendered_unrender_Child_byEditpart()
+ throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IHorizontalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yTextField);
+ HorizontalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ checkBoxEP.requestUnrender();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ HorizontalLayout layout = (HorizontalLayout) layoutPres.getWidget();
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ checkBoxEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YHorizontalLayout yLayout = factory.createHorizontalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yCheckBox.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isEditable());
+ assertFalse(!box.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isEditable());
+ assertTrue(!box.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/I18nServiceForTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/I18nServiceForTests.java
new file mode 100644
index 0000000..2719ad8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/I18nServiceForTests.java
@@ -0,0 +1,70 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+
+/**
+ * A test I18n service.
+ */
+public class I18nServiceForTests extends AbstractDisposable implements
+ II18nService {
+
+ public static final String KEY__NAME = "tests.name";
+ public static final String KEY__AGE = "tests.age";
+ public static final String KEY__VALUE = "tests.value";
+
+ @Override
+ public String getValue(String i18nKey, Locale locale) {
+
+ if (locale == Locale.GERMAN) {
+ return getGerman(i18nKey);
+ } else if (locale == Locale.ENGLISH) {
+ return getEnglish(i18nKey);
+ }
+
+ return getEnglish(i18nKey);
+ }
+
+ private String getEnglish(String i18nKey) {
+ if (i18nKey.equals(KEY__NAME)) {
+ return "Name";
+ } else if (i18nKey.equals(KEY__AGE)) {
+ return "Age";
+ } else if (i18nKey.equals(KEY__VALUE)) {
+ return "Value";
+ } else
+ return "";
+ }
+
+ private String getGerman(String i18nKey) {
+ if (i18nKey.equals(KEY__NAME)) {
+ return "Name";
+ } else if (i18nKey.equals(KEY__AGE)) {
+ return "Alter";
+ } else if (i18nKey.equals(KEY__VALUE)) {
+ return "Wert";
+ } else
+ return "";
+ }
+
+ @Override
+ protected void internalDispose() {
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/LabelPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/LabelPresentationTests.java
new file mode 100644
index 0000000..2f7aada
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/LabelPresentationTests.java
@@ -0,0 +1,414 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ILabelEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.LabelPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link LabelPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class LabelPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yLabel
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YLabel yLabel = factory.createLabel();
+ yGridlayout.getElements().add(yLabel);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart textEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yLabel);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yLabel
+ YView yView = factory.createView();
+ YLabel yLabel = factory.createLabel();
+ yView.setContent(yLabel);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart textEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+
+ Label label = (Label) presentation.getWidget();
+ assertNotNull(label);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yLabel
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YLabel yLabel1 = factory.createLabel();
+ yLabel1.setCssID("ID_0815");
+ yLabel1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yLabel1);
+ YLabel yLabel2 = factory.createLabel();
+ yLayout.getElements().add(yLabel2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart text1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel1);
+ ILabelEditpart text2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+
+ Label label1 = (Label) text1Presentation.getWidget();
+ Label label2 = (Label) text2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(label1.getStyleName().contains("anyOtherClass"));
+ assertTrue(label2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", label1.getId());
+ assertEquals(text2Editpart.getId(), label2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yLabel
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YLabel yLabel1 = factory.createLabel();
+ yLayout.getElements().add(yLabel1);
+ YLabel yLabel2 = factory.createLabel();
+ yLayout.getElements().add(yLabel2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart label1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel1);
+ ILabelEditpart label2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel2);
+ IWidgetPresentation<Component> text1Presentation = label1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = label2Editpart
+ .getPresentation();
+ Label label1 = (Label) text1Presentation.getWidget();
+ Label label2 = (Label) text2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(label1.isVisible());
+ assertTrue(label1.isEnabled());
+ assertFalse(label1.isReadOnly());
+
+ assertTrue(label2.isVisible());
+ assertTrue(label2.isEnabled());
+ assertFalse(label2.isReadOnly());
+
+ yLabel1.setVisible(false);
+ assertFalse(label1.isVisible());
+
+ yLabel1.setEnabled(false);
+ assertFalse(label1.isEnabled());
+
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YLabel yLabel = factory.createLabel();
+ yGridlayout.getElements().add(yLabel);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart textEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YLabel yLabel = factory.createLabel();
+ yGridlayout.getElements().add(yLabel);
+
+ // set the i18n key
+ yLabel.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ ILabelEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ LabelPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YLabel yLabel = factory.createLabel();
+ yLayout.getElements().add(yLabel);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Label label = (Label) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yLabel.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yLabel.isEditable());
+ assertFalse(!label.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yLabel.isEditable());
+ assertTrue(!label.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YLabel yLabel = factory.createLabel();
+ yLayout.getElements().add(yLabel);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Label label = (Label) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yLabel.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yLabel.isVisible());
+ assertFalse(label.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yLabel.isVisible());
+ assertTrue(label.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YLabel yLabel = factory.createLabel();
+ yLayout.getElements().add(yLabel);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ILabelEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yLabel);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Label label = (Label) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yLabel.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yLabel.isEnabled());
+ assertFalse(label.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yLabel.isEnabled());
+ assertTrue(label.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ListPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ListPresentationTests.java
new file mode 100644
index 0000000..e072391
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ListPresentationTests.java
@@ -0,0 +1,1745 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YList;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IListEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ListPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Bar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Foo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link ListPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class ListPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yList
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yGridlayout.getElements().add(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart listEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> presentation = listEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yList);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yList
+ YView yView = factory.createView();
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yView.setContent(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart listEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> presentation = listEditpart
+ .getPresentation();
+
+ ListSelect label = (ListSelect) presentation.getWidget();
+ assertNotNull(label);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yList
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yList1.setCssID("ID_0815");
+ yList1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yList1);
+ YList yList2 = factory.createList();
+ yList2.setType(String.class);
+ yLayout.getElements().add(yList2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IListEditpart list2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList2);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> list2Presentation = list2Editpart
+ .getPresentation();
+
+ ListSelect label1 = (ListSelect) list1Presentation.getWidget();
+ ListSelect label2 = (ListSelect) list2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(label1.getStyleName().contains("anyOtherClass"));
+ assertTrue(label2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", label1.getId());
+ assertEquals(list2Editpart.getId(), label2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yList
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+ YList yList2 = factory.createList();
+ yList2.setType(String.class);
+ yLayout.getElements().add(yList2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart label1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IListEditpart label2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList2);
+ IWidgetPresentation<Component> list1Presentation = label1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> list2Presentation = label2Editpart
+ .getPresentation();
+ ListSelect label1 = (ListSelect) list1Presentation.getWidget();
+ ;
+ ListSelect label2 = (ListSelect) list2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(label1.isVisible());
+ assertTrue(label1.isEnabled());
+ assertFalse(label1.isReadOnly());
+
+ assertTrue(label2.isVisible());
+ assertTrue(label2.isEnabled());
+ assertFalse(label2.isReadOnly());
+
+ yList1.setVisible(false);
+ assertFalse(label1.isVisible());
+
+ yList1.setEnabled(false);
+ assertFalse(label1.isEnabled());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ // start tests
+ //
+
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ // add
+ container.addItem("Blabla");
+ assertEquals(1, yList1.getCollection().size());
+ assertEquals(1, container.size());
+
+ yList1.getCollection().add("Huhu");
+ assertEquals(2, yList1.getCollection().size());
+ assertEquals(2, container.size());
+
+ // add at index
+ yList1.getCollection().add(0, "First");
+ assertEquals("First", yList1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ container.addItemAt(0, "Another First");
+ assertEquals("Another First", yList1.getCollection().get(0));
+ assertEquals("Another First", container.getItemIds(0, 1).get(0));
+
+ // move
+ yList1.getCollection().move(1, 0);
+ assertEquals("First", yList1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ // remove all
+ container.removeAllItems();
+ assertEquals(0, yList1.getCollection().size());
+ assertEquals(0, container.size());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+ YList yList2 = factory.createList();
+ yList2.setType(String.class);
+ yLayout.getElements().add(yList2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IListEditpart list2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList2);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> list2Presentation = list2Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+ ListSelect list2 = (ListSelect) list2Presentation.getWidget();
+
+ Container.Indexed indexedDs1 = (Indexed) list1.getContainerDataSource();
+ Container.Indexed indexedDs2 = (Indexed) list2.getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yList1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yList2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ assertEquals(0, yList1.getCollection().size());
+ assertEquals(0, yList2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+
+ // add to yList1
+ yList1.getCollection().add("Huhu");
+ assertEquals(1, yList2.getCollection().size());
+ assertEquals("Huhu", yList2.getCollection().get(0));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add to yList1
+ yList1.getCollection().add("Huhu2");
+ assertEquals(2, yList2.getCollection().size());
+ assertEquals("Huhu", yList2.getCollection().get(0));
+ assertEquals("Huhu2", yList2.getCollection().get(1));
+ assertEquals("Huhu", yList1.getCollection().get(0));
+ assertEquals("Huhu2", yList1.getCollection().get(1));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ // remove from yList2
+ yList2.getCollection().remove("Huhu");
+ assertEquals(1, yList1.getCollection().size());
+ assertEquals(1, yList2.getCollection().size());
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add another to yList2
+ yList2.getCollection().add("Blabla");
+ assertEquals(2, yList1.getCollection().size());
+ assertEquals(2, yList2.getCollection().size());
+ assertEquals("Huhu2", yList1.getCollection().get(0));
+ assertEquals("Blabla", yList1.getCollection().get(1));
+ assertEquals("Huhu2", yList2.getCollection().get(0));
+ assertEquals("Blabla", yList2.getCollection().get(1));
+ assertEquals("Huhu2", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yList2.getCollection().move(0, 1);
+ assertEquals(2, yList1.getCollection().size());
+ assertEquals(2, yList2.getCollection().size());
+ assertEquals("Blabla", yList1.getCollection().get(0));
+ assertEquals("Huhu2", yList1.getCollection().get(1));
+ assertEquals("Blabla", yList2.getCollection().get(0));
+ assertEquals("Huhu2", yList2.getCollection().get(1));
+ assertEquals("Blabla", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yList2.getCollection().clear();
+ assertEquals(0, yList1.getCollection().size());
+ assertEquals(0, yList2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+
+ // add
+ yList1.getCollection().add("Huhu");
+ yList1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ // test set selection
+ yList1.setSelection("Huhu");
+ assertEquals("Huhu", yList1.getSelection());
+ assertEquals("Huhu", list1.getValue());
+
+ list1.setValue("Haha");
+ assertEquals("Haha", yList1.getSelection());
+ assertEquals("Haha", list1.getValue());
+
+ // test set selection null
+ list1.setValue(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ list1.setValue("Haha");
+ assertEquals("Haha", yList1.getSelection());
+ assertEquals("Haha", list1.getValue());
+
+ yList1.setSelection(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ // test remove element that is selected
+ // add
+ yList1.getCollection().add("Huhu");
+ yList1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ yList1.setSelection("Huhu");
+ assertEquals("Huhu", yList1.getSelection());
+ assertEquals("Huhu", list1.getValue());
+
+ yList1.getCollection().remove("Huhu");
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+
+ // test remove element that is selected
+ // add
+ yList1.getCollection().add("Huhu");
+ assertEquals(2, container.size());
+
+ yList1.setSelection("Huhu");
+ assertEquals("Huhu", yList1.getSelection());
+ assertEquals("Huhu", list1.getValue());
+
+ list1.setValue(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToBean()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(Bar.class);
+ yLayout.getElements().add(yList1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yList1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setPropertyPath("myfoo.name");
+ yDetailEndpoint.setType(Bar.class);
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yList1.getCollection().add(bar1);
+ yList1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yList1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yList1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yList1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ list1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ list1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ list1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ list1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yList1.getCollection().clear();
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ // test setValue to textfield
+ yList1.getCollection().add(bar1);
+ yList1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yList1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yList1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToEmf()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(EmfBar.class);
+ yList1.setEmfNsURI(ModelPackage.eINSTANCE.getNsURI());
+ yLayout.getElements().add(yList1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yList1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setType(EmfBar.class);
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfBar_Myfoo());
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfFoo_Name());
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ EmfBar bar1 = ModelFactory.eINSTANCE.createEmfBar();
+ bar1.setName("Bar1");
+ EmfFoo foo1 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ EmfBar bar2 = ModelFactory.eINSTANCE.createEmfBar();
+ bar2.setName("Bar2");
+ EmfFoo foo2 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yList1.getCollection().add(bar1);
+ yList1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yList1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yList1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yList1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ list1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ list1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ list1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ list1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yList1.getCollection().clear();
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ // test setValue to textfield
+ yList1.getCollection().add(bar1);
+ yList1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yList1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yList1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setSelectionType(YSelectionType.MULTI);
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertTrue(asList(list1.getValue()).isEmpty());
+ assertTrue(yList1.getMultiSelection().isEmpty());
+
+ // add
+ yList1.getCollection().add("Huhu");
+ yList1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertTrue(yList1.getMultiSelection().isEmpty());
+ assertTrue(asList(list1.getValue()).isEmpty());
+
+ // test set selection by model
+ yList1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ yList1.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", yList1.getMultiSelection().get(1));
+ assertTrue(asList(list1.getValue()).contains("Huhu"));
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+ assertEquals(2, yList1.getMultiSelection().size());
+ assertEquals(2, asList(list1.getValue()).size());
+
+ // remove selection
+ yList1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ yList1.getMultiSelection().clear();
+ assertEquals(0, yList1.getMultiSelection().size());
+ assertEquals(0, asList(list1.getValue()).size());
+
+ // test set selection by widget
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ list1.setValue(selection);
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Huhu");
+ selection.add("Haha");
+ list1.setValue(selection);
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", yList1.getMultiSelection().get(1));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals("Haha", asList(list1.getValue()).get(1));
+ assertEquals(2, yList1.getMultiSelection().size());
+ assertEquals(2, asList(list1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Haha");
+ list1.setValue(selection);
+ assertEquals("Haha", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ list1.setValue(selection);
+ assertEquals(0, yList1.getMultiSelection().size());
+ assertEquals(0, asList(list1.getValue()).size());
+
+ }
+
+ private Collection<?> castCollection(Object value) {
+ return (Collection<?>) value;
+ }
+
+ private List<?> asList(Object value) {
+ return new ArrayList<Object>(castCollection(value));
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+
+ // add
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ // test set selection
+ yList1.setSelection("Huhu");
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yList1.setSelectionType(YSelectionType.MULTI);
+ yLayout.getElements().add(yList1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertTrue(asList(list1.getValue()).isEmpty());
+ assertTrue(yList1.getMultiSelection().isEmpty());
+
+ // test set selection by model
+ yList1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ yList1.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", yList1.getMultiSelection().get(1));
+ // sort order is not defined by vaadin --> using Set
+ assertTrue(asList(list1.getValue()).contains("Huhu"));
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+
+ assertEquals(2, yList1.getMultiSelection().size());
+ assertEquals(2, asList(list1.getValue()).size());
+
+ // remove selection
+ yList1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yList1.getMultiSelection().get(0));
+ // sort order is not defined by vaadin --> using Set
+ assertFalse(asList(list1.getValue()).contains("Huhu"));
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ yList1.getMultiSelection().clear();
+ assertEquals(0, yList1.getMultiSelection().size());
+ assertEquals(0, asList(list1.getValue()).size());
+
+ // test set selection by widget
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ list1.setValue(selection);
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Huhu");
+ selection.add("Haha");
+ list1.setValue(selection);
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", yList1.getMultiSelection().get(1));
+ // sort order is not defined by vaadin --> using Set
+ assertTrue(asList(list1.getValue()).contains("Huhu"));
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+ assertEquals(2, yList1.getMultiSelection().size());
+ assertEquals(2, asList(list1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Haha");
+ list1.setValue(selection);
+ assertEquals("Haha", yList1.getMultiSelection().get(0));
+ // sort order is not defined by vaadin --> using Set
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ list1.setValue(selection);
+ assertEquals(0, yList1.getMultiSelection().size());
+ assertEquals(0, asList(list1.getValue()).size());
+ }
+
+ @Test
+ public void test_SelectionBinding_Single_WithAttributePath()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(Bar.class);
+ yLayout.getElements().add(yList1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YEmbeddableSelectionEndpoint selectionBindingEndpoint = yList1
+ .createSelectionEndpoint();
+ selectionBindingEndpoint.setAttributePath("myfoo.name");
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ selectionBindingEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) list1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yList1.getCollection().add(bar1);
+ yList1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yList1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yList1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yList1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ list1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ list1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ list1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ list1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yList1.getCollection().clear();
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+
+ // test setValue to textfield
+ yList1.getCollection().add(bar1);
+ yList1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yList1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yList1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ public void test_type_String() throws ContextException {
+
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yLayout.getElements().add(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart listEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> listPresentation = listEditpart
+ .getPresentation();
+ ListSelect list = (ListSelect) listPresentation.getWidget();
+
+ // start tests
+ //
+ yList.getCollection().add("Blabla");
+ yList.getCollection().add("Huhu");
+
+ // For String values NO BeanItemContainer is prepared.
+ Container.Indexed container = (Indexed) list.getContainerDataSource();
+ assertEquals(0, container.getContainerPropertyIds().size());
+
+ String itemCaption = list.getItemCaption(container.getItemIds()
+ .iterator().next());
+ assertEquals("Blabla", itemCaption);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setSelectionType(YSelectionType.MULTI);
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+ YList yList2 = factory.createList();
+ yList2.setSelectionType(YSelectionType.MULTI);
+ yList2.setType(String.class);
+ yLayout.getElements().add(yList2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IListEditpart list2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList2);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> list2Presentation = list2Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+ ListSelect list2 = (ListSelect) list2Presentation.getWidget();
+
+ // Container.Indexed indexedDs1 = (Indexed)
+ // list1.getContainerDataSource();
+ // Container.Indexed indexedDs2 = (Indexed)
+ // list2.getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yList1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yList2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableMultiSelectionEndpoint endpSel1 = yList1
+ .createMultiSelectionEndpoint();
+ YEmbeddableMultiSelectionEndpoint endpSel2 = yList2
+ .createMultiSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) list1.getContainerDataSource();
+ Container.Indexed container2 = (Indexed) list2.getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertTrue(asList(list1.getValue()).isEmpty());
+ assertTrue(yList1.getMultiSelection().isEmpty());
+ assertTrue(asList(list2.getValue()).isEmpty());
+ assertTrue(yList2.getMultiSelection().isEmpty());
+
+ // add
+ yList1.getCollection().add("Huhu");
+ yList2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertTrue(asList(list1.getValue()).isEmpty());
+ assertTrue(yList1.getMultiSelection().isEmpty());
+ assertTrue(asList(list2.getValue()).isEmpty());
+ assertTrue(yList2.getMultiSelection().isEmpty());
+
+ // test set selection
+ yList1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+ assertEquals("Huhu", yList2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list2.getValue()).get(0));
+ assertEquals(1, yList2.getMultiSelection().size());
+ assertEquals(1, asList(list2.getValue()).size());
+
+ yList2.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", yList1.getMultiSelection().get(1));
+ // sort order is not defined by vaadin --> using Set
+ assertTrue(asList(list1.getValue()).contains("Huhu"));
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+ assertEquals(2, yList1.getMultiSelection().size());
+ assertEquals(2, asList(list1.getValue()).size());
+ assertEquals("Huhu", yList2.getMultiSelection().get(0));
+ assertEquals("Haha", yList2.getMultiSelection().get(1));
+ assertTrue(asList(list2.getValue()).contains("Huhu"));
+ assertTrue(asList(list2.getValue()).contains("Haha"));
+ assertEquals(2, yList2.getMultiSelection().size());
+ assertEquals(2, asList(list2.getValue()).size());
+
+ yList1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+ assertEquals("Haha", yList2.getMultiSelection().get(0));
+ assertEquals("Haha", asList(list2.getValue()).get(0));
+ assertEquals(1, yList2.getMultiSelection().size());
+ assertEquals(1, asList(list2.getValue()).size());
+
+ // clear
+ yList2.getMultiSelection().clear();
+ assertTrue(asList(list1.getValue()).isEmpty());
+ assertTrue(yList1.getMultiSelection().isEmpty());
+ assertTrue(asList(list2.getValue()).isEmpty());
+ assertTrue(yList2.getMultiSelection().isEmpty());
+
+ // test set selection null
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ list1.setValue(selection);
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list1.getValue()).get(0));
+ assertEquals(1, yList1.getMultiSelection().size());
+ assertEquals(1, asList(list1.getValue()).size());
+ assertEquals("Huhu", yList2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(list2.getValue()).get(0));
+ assertEquals(1, yList2.getMultiSelection().size());
+ assertEquals(1, asList(list2.getValue()).size());
+
+ selection.add("Haha");
+ list2.setValue(selection);
+ assertEquals("Huhu", yList1.getMultiSelection().get(0));
+ assertEquals("Haha", yList1.getMultiSelection().get(1));
+ assertTrue(asList(list1.getValue()).contains("Huhu"));
+ assertTrue(asList(list1.getValue()).contains("Haha"));
+ assertEquals(2, yList1.getMultiSelection().size());
+ assertEquals(2, asList(list1.getValue()).size());
+ assertEquals("Huhu", yList2.getMultiSelection().get(0));
+ assertEquals("Haha", yList2.getMultiSelection().get(1));
+ assertTrue(asList(list2.getValue()).contains("Huhu"));
+ assertTrue(asList(list2.getValue()).contains("Haha"));
+ assertEquals(2, yList2.getMultiSelection().size());
+ assertEquals(2, asList(list2.getValue()).size());
+
+ list2.setValue(new ArrayList<String>());
+ assertTrue(asList(list2.getValue()).isEmpty());
+ assertTrue(yList2.getMultiSelection().isEmpty());
+ assertTrue(asList(list1.getValue()).isEmpty());
+ assertTrue(yList1.getMultiSelection().isEmpty());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList1 = factory.createList();
+ yList1.setType(String.class);
+ yLayout.getElements().add(yList1);
+ YList yList2 = factory.createList();
+ yList2.setType(String.class);
+ yLayout.getElements().add(yList2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart list1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList1);
+ IListEditpart list2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList2);
+ IWidgetPresentation<Component> list1Presentation = list1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> list2Presentation = list2Editpart
+ .getPresentation();
+ ListSelect list1 = (ListSelect) list1Presentation.getWidget();
+ ListSelect list2 = (ListSelect) list2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yList1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yList2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yList1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yList2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) list1.getContainerDataSource();
+ Container.Indexed container2 = (Indexed) list2.getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(list1.getValue());
+ assertNull(yList1.getSelection());
+
+ // add
+ yList1.getCollection().add("Huhu");
+ yList2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yList2.getSelection());
+ assertNull(list2.getValue());
+
+ // test set selection
+ yList1.setSelection("Huhu");
+ assertEquals("Huhu", yList1.getSelection());
+ assertEquals("Huhu", list1.getValue());
+ assertEquals("Huhu", yList2.getSelection());
+ assertEquals("Huhu", list2.getValue());
+
+ list1.setValue("Haha");
+ assertEquals("Haha", yList1.getSelection());
+ assertEquals("Haha", list1.getValue());
+ assertEquals("Haha", yList2.getSelection());
+ assertEquals("Haha", list2.getValue());
+
+ // test set selection null
+ list1.setValue(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yList2.getSelection());
+ assertNull(list2.getValue());
+
+ list1.setValue("Haha");
+ assertEquals("Haha", yList1.getSelection());
+ assertEquals("Haha", list1.getValue());
+ assertEquals("Haha", yList2.getSelection());
+ assertEquals("Haha", list2.getValue());
+
+ list2.setValue(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yList2.getSelection());
+ assertNull(list2.getValue());
+
+ list2.setValue("Haha");
+ assertEquals("Haha", yList1.getSelection());
+ assertEquals("Haha", list1.getValue());
+ assertEquals("Haha", yList2.getSelection());
+ assertEquals("Haha", list2.getValue());
+
+ yList1.setSelection(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yList2.getSelection());
+ assertNull(list2.getValue());
+
+ list2.setValue("Haha");
+ assertEquals("Haha", yList1.getSelection());
+ assertEquals("Haha", list1.getValue());
+ assertEquals("Haha", yList2.getSelection());
+ assertEquals("Haha", list2.getValue());
+
+ yList2.setSelection(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yList2.getSelection());
+ assertNull(list2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yList1.setSelection("Huhu");
+ assertEquals("Huhu", yList1.getSelection());
+ assertEquals("Huhu", yList2.getSelection());
+ assertEquals("Huhu", list1.getValue());
+ assertEquals("Huhu", list2.getValue());
+
+ yList1.getCollection().remove("Huhu");
+ assertNull(list1.getValue());
+ assertNull(list2.getValue());
+ assertNull(yList1.getSelection());
+ assertNull(yList2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yList2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yList1.setSelection("Huhu");
+ assertEquals("Huhu", yList1.getSelection());
+ assertEquals("Huhu", list1.getValue());
+ assertEquals("Huhu", yList2.getSelection());
+ assertEquals("Huhu", list2.getValue());
+
+ list2.setValue(null);
+ assertNull(yList1.getSelection());
+ assertNull(list1.getValue());
+ assertNull(yList2.getSelection());
+ assertNull(list2.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yGridlayout.getElements().add(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart listEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> presentation = listEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(6, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yGridlayout.getElements().add(yList);
+
+ // set the i18n key
+ yList.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IListEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ ListPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yLayout.getElements().add(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ ListSelect list = (ListSelect) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yList.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yList.isEditable());
+ assertFalse(!list.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yList.isEditable());
+ assertTrue(!list.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yLayout.getElements().add(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ ListSelect list = (ListSelect) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yList.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yList.isVisible());
+ assertFalse(list.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yList.isVisible());
+ assertTrue(list.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YList yList = factory.createList();
+ yList.setType(String.class);
+ yLayout.getElements().add(yList);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IListEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yList);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ ListSelect list = (ListSelect) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yList.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yList.isEnabled());
+ assertFalse(list.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yList.isEnabled());
+ assertTrue(list.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/NumericFieldPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/NumericFieldPresentationTests.java
new file mode 100644
index 0000000..340fcdb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/NumericFieldPresentationTests.java
@@ -0,0 +1,780 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory;
+import org.eclipse.osbp.ecview.core.common.model.core.YDelegateConverter;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.DelegatingConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YNumericDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.INumericFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.NumberConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.NumericField;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TextFieldPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class NumericFieldPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ Locale.setDefault(Locale.GERMANY);
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ @After
+ public void after() {
+ DelegatingConverterFactory.getInstance().clear();
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YNumericField yText = factory.createNumericField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yText);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YNumericField yText = factory.createNumericField();
+ yView.setContent(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+
+ NumericField text = (NumericField) presentation.getWidget();
+ assertNotNull(text);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yText1 = factory.createNumericField();
+ yText1.setCssID("ID_0815");
+ yText1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yText1);
+ YNumericField yText2 = factory.createNumericField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ INumericFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+
+ NumericField text1 = (NumericField) text1Presentation.getWidget();
+ NumericField text2 = (NumericField) text2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(text1.getStyleName().contains("anyOtherClass"));
+ assertTrue(text2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", text1.getId());
+ assertEquals(text2Editpart.getId(), text2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yText1 = factory.createNumericField();
+ yLayout.getElements().add(yText1);
+ YNumericField yText2 = factory.createNumericField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ INumericFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ NumericField text1 = (NumericField) text1Presentation.getWidget();
+ NumericField text2 = (NumericField) text2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(text1.isVisible());
+ assertTrue(text1.isEnabled());
+ assertFalse(text1.isReadOnly());
+
+ assertTrue(text2.isVisible());
+ assertTrue(text2.isEnabled());
+ assertFalse(text2.isReadOnly());
+
+ yText1.setVisible(false);
+ assertFalse(text1.isVisible());
+
+ yText1.setEnabled(false);
+ assertFalse(text1.isEnabled());
+
+ yText1.setEditable(false);
+ assertTrue(text1.isReadOnly());
+
+ // target to model
+ text1.setReadOnly(false);
+ assertTrue(yText1.isEditable());
+
+ yText1.setValue(112233);
+ assertEquals("112.233", text1.getValue());
+
+ yText1.setValue(332211);
+ assertEquals("332.211", text1.getValue());
+
+ text1.setValue("998.877");
+ assertEquals(998877, yText1.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yField1 = factory.createNumericField();
+ yLayout.getElements().add(yField1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ NumericField field1 = (NumericField) text1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(998877);
+ beanBinding.setPropertyPath("intValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yField1.createValueEndpoint(), beanBinding);
+ assertEquals("998.877", field1.getValue());
+ assertEquals(998877, yField1.getValue());
+
+ bean.setIntValue(223344);
+ assertEquals("223.344", field1.getValue());
+ assertEquals(223344, yField1.getValue());
+
+ field1.setValue("445.566");
+ assertEquals(445566, bean.getIntValue());
+ assertEquals(445566, yField1.getValue());
+
+ yField1.setValue(778899);
+ assertEquals(778899, bean.getIntValue());
+ assertEquals("778.899", field1.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YNumericField yText = factory.createNumericField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void testMarkNegative() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YNumericField yText = factory.createNumericField();
+
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ NumericField field = (NumericField) presentation.getWidget();
+
+ yText.setValue(99);
+ assertEquals("99", field.getValue());
+ assertFalse(field.getStyleName().contains("lun-negative-value"));
+ yText.setValue(-99);
+ assertEquals("-99", field.getValue());
+ assertTrue(field.getStyleName().contains("lun-negative-value"));
+
+ }
+
+ /**
+ * Test grouping of decimals
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testGrouping() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yText1 = factory.createNumericField();
+ yLayout.getElements().add(yText1);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setGrouping(true);
+ yText1.setDatatype(dt1);
+ YNumericField yText2 = factory.createNumericField();
+ yLayout.getElements().add(yText2);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setGrouping(false);
+ yText2.setDatatype(dt2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ INumericFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ NumericField text1 = (NumericField) text1Presentation.getWidget();
+ NumericField text2 = (NumericField) text2Presentation.getWidget();
+
+ yText1.setValue(112233);
+ assertEquals("112.233", text1.getValue());
+
+ yText2.setValue(332211);
+ assertEquals("332211", text2.getValue());
+
+ }
+
+ @Test
+ public void testGrouping_ByChangingDatatype() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yField = factory.createNumericField();
+ yLayout.getElements().add(yField);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setGrouping(true);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setPrecision(1);
+ dt2.setGrouping(false);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ NumericField field = (NumericField) text1Presentation.getWidget();
+
+ // start tests
+ yField.setDatatype(dt1);
+ yField.setValue(112233);
+ assertEquals("112.233", field.getValue());
+ assertEquals(112233, yField.getValue(), 0);
+
+ yField.setDatatype(dt2);
+ assertEquals("112233", field.getValue());
+ assertEquals(112233, yField.getValue(), 0);
+
+ yField.setValue(4567);
+ assertEquals("4567", field.getValue());
+ assertEquals(4567, yField.getValue(), 0);
+ }
+
+ @Test
+ public void testMarkNegative_ByChangingDatatype() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yField = factory.createNumericField();
+ yLayout.getElements().add(yField);
+ YDecimalDatatype dt1 = factory.createDecimalDatatype();
+ dt1.setMarkNegative(true);
+ YDecimalDatatype dt2 = factory.createDecimalDatatype();
+ dt2.setPrecision(1);
+ dt2.setMarkNegative(false);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yField);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ NumericField field = (NumericField) text1Presentation.getWidget();
+
+ // start tests
+ yField.setDatatype(dt1);
+ yField.setValue(112233);
+ assertEquals("112.233", field.getValue());
+ assertEquals(112233, yField.getValue(), 0);
+ assertFalse(field.getStyleName().contains("lun-negative-value"));
+
+ yField.setValue(-112233);
+ assertEquals("-112.233", field.getValue());
+ assertEquals(-112233, yField.getValue(), 0);
+ assertTrue(field.getStyleName().contains("lun-negative-value"));
+
+ yField.setDatatype(dt2);
+ assertEquals("-112.233", field.getValue());
+ assertEquals(-112233, yField.getValue(), 0);
+ assertFalse(field.getStyleName().contains("lun-negative-value"));
+
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YNumericField yText = factory.createNumericField();
+ yText.setValue(123456789);
+ yGridlayout.getElements().add(yText);
+
+ // set the i18n key
+ yText.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ NumericField textField = (NumericField) presentation.getWidget();
+ assertEquals("Alter", presentation.getWidget().getCaption());
+ assertEquals("123.456.789", textField.getValue());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ assertEquals("123,456,789", textField.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yText = factory.createNumericField();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ NumericField textField = (NumericField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isEditable());
+ assertFalse(!textField.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isEditable());
+ assertTrue(!textField.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yText = factory.createNumericField();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ NumericField textField = (NumericField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isVisible());
+ assertFalse(textField.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isVisible());
+ assertTrue(textField.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YNumericField yText = factory.createNumericField();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ NumericField textField = (NumericField) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isEnabled());
+ assertFalse(textField.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isEnabled());
+ assertTrue(textField.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Converter() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YNumericField yDecimal = factory.createNumericField();
+ YDelegateConverter yConverter = CoreModelFactory.eINSTANCE
+ .createYDelegateConverter();
+ yConverter.setConverterId("text.test.numeric");
+ yDecimal.setConverter(yConverter);
+ yGridlayout.getElements().add(yDecimal);
+
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ NumericField text = (NumericField) presentation.getWidget();
+
+ yDecimal.setValue(123);
+ assertEquals(123, yDecimal.getValue(), 0);
+ assertEquals("123 EUR", text.getValue());
+
+ text.setValue("321 EUR");
+ assertEquals(321, yDecimal.getValue(), 0);
+ assertEquals("321 EUR", text.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ConverterAndDatatype() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YNumericField yDecimal = factory.createNumericField();
+ YDelegateConverter yConverter = CoreModelFactory.eINSTANCE
+ .createYDelegateConverter();
+ yConverter.setConverterId("text.test");
+ yDecimal.setConverter(yConverter);
+
+ YNumericDatatype dt = factory.createNumericDatatype();
+ dt.setGrouping(true);
+ yDecimal.setDatatype(dt);
+
+ yGridlayout.getElements().add(yDecimal);
+
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ INumericFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yDecimal);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ NumericField text = (NumericField) presentation.getWidget();
+
+ yDecimal.setValue(1234);
+ assertEquals(1234, yDecimal.getValue(), 0);
+ assertEquals("1,234 EUR", text.getValue());
+
+ text.setValue("3,210 EUR");
+ assertEquals(3210, yDecimal.getValue(), 0);
+ assertEquals("3,210 EUR", text.getValue());
+
+ dt.setGrouping(false);
+ yDecimal.setValue(1234);
+ assertEquals(1234, yDecimal.getValue(), 0);
+ assertEquals("1234 EUR", text.getValue());
+
+ dt.setGrouping(true);
+ yDecimal.setValue(4321);
+ assertEquals(4321, yDecimal.getValue(), 0);
+ assertEquals("4,321 EUR", text.getValue());
+
+ }
+
+ private static class ConverterFactory implements IConverterFactory {
+
+ @Override
+ public boolean isFor(IViewContext uiContext, IConverterEditpart editpart) {
+ return true;
+ }
+
+ @Override
+ public Object createConverter(IViewContext uiContext,
+ IConverterEditpart editpart) throws IllegalArgumentException {
+ return new Converter();
+ }
+ }
+
+ /**
+ */
+ @SuppressWarnings("serial")
+ private static class Converter extends NumberConverter {
+
+ @Override
+ protected NumberFormat getFormat(Locale locale) {
+
+ DecimalFormat result = new DecimalFormat(
+ super.getNumberFormatPattern() + " EUR",
+ DecimalFormatSymbols.getInstance(Locale.US));
+ result.setGroupingUsed(super.isUseGrouping());
+ return result;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/OptionsGroupPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/OptionsGroupPresentationTests.java
new file mode 100644
index 0000000..9641f50
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/OptionsGroupPresentationTests.java
@@ -0,0 +1,1757 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IOptionsGroupEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ListPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.OptionsGroupPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Bar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Foo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.OptionGroup;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link ListPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class OptionsGroupPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yOptionsGroup
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(String.class);
+ yGridlayout.getElements().add(yOptionsGroup);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroupEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ IWidgetPresentation<Component> presentation = optionsGroupEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yOptionsGroup);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yOptionsGroup
+ YView yView = factory.createView();
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(String.class);
+ yView.setContent(yOptionsGroup);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroupEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ IWidgetPresentation<Component> presentation = optionsGroupEditpart
+ .getPresentation();
+
+ OptionGroup group = (OptionGroup) presentation.getWidget();
+ assertNotNull(group);
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yOptionsGroup
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yOptionsGroup1.setCssID("ID_0815");
+ yOptionsGroup1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yOptionsGroup1);
+ YOptionsGroup yOptionsGroup2 = factory.createOptionsGroup();
+ yOptionsGroup2.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IOptionsGroupEditpart optionsGroup2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup2);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> optionsGroup2Presentation = optionsGroup2Editpart
+ .getPresentation();
+
+ OptionGroup label1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+ OptionGroup label2 = (OptionGroup) optionsGroup2Presentation
+ .getWidget();
+
+ // assert css class
+
+ assertTrue(label1.getStyleName().contains("anyOtherClass"));
+ assertTrue(label2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", label1.getId());
+ assertEquals(optionsGroup2Editpart.getId(), label2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yOptionsGroup
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+ YOptionsGroup yOptionsGroup2 = factory.createOptionsGroup();
+ yOptionsGroup2.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart label1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IOptionsGroupEditpart label2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup2);
+ IWidgetPresentation<Component> optionsGroup1Presentation = label1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> optionsGroup2Presentation = label2Editpart
+ .getPresentation();
+ OptionGroup label1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+ OptionGroup label2 = (OptionGroup) optionsGroup2Presentation
+ .getWidget();
+
+ // start tests
+ //
+ assertTrue(label1.isVisible());
+ assertTrue(label1.isEnabled());
+ assertFalse(label1.isReadOnly());
+
+ assertTrue(label2.isVisible());
+ assertTrue(label2.isEnabled());
+ assertFalse(label2.isReadOnly());
+
+ yOptionsGroup1.setVisible(false);
+ assertFalse(label1.isVisible());
+
+ yOptionsGroup1.setEnabled(false);
+ assertFalse(label1.isEnabled());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ // start tests
+ //
+
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ // add
+ container.addItem("Blabla");
+ assertEquals(1, yOptionsGroup1.getCollection().size());
+ assertEquals(1, container.size());
+
+ yOptionsGroup1.getCollection().add("Huhu");
+ assertEquals(2, yOptionsGroup1.getCollection().size());
+ assertEquals(2, container.size());
+
+ // add at index
+ yOptionsGroup1.getCollection().add(0, "First");
+ assertEquals("First", yOptionsGroup1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ container.addItemAt(0, "Another First");
+ assertEquals("Another First", yOptionsGroup1.getCollection().get(0));
+ assertEquals("Another First", container.getItemIds(0, 1).get(0));
+
+ // move
+ yOptionsGroup1.getCollection().move(1, 0);
+ assertEquals("First", yOptionsGroup1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ // remove all
+ container.removeAllItems();
+ assertEquals(0, yOptionsGroup1.getCollection().size());
+ assertEquals(0, container.size());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_OptionGroupToOptionGroup()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+ YOptionsGroup yOptionsGroup2 = factory.createOptionsGroup();
+ yOptionsGroup2.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IOptionsGroupEditpart optionsGroup2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup2);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> optionsGroup2Presentation = optionsGroup2Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+ OptionGroup optionsGroup2 = (OptionGroup) optionsGroup2Presentation
+ .getWidget();
+
+ Container.Indexed indexedDs1 = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ Container.Indexed indexedDs2 = (Indexed) optionsGroup2
+ .getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yOptionsGroup1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yOptionsGroup2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ assertEquals(0, yOptionsGroup1.getCollection().size());
+ assertEquals(0, yOptionsGroup2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+
+ // add to yOptionsGroup1
+ yOptionsGroup1.getCollection().add("Huhu");
+ assertEquals(1, yOptionsGroup2.getCollection().size());
+ assertEquals("Huhu", yOptionsGroup2.getCollection().get(0));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add to yOptionsGroup1
+ yOptionsGroup1.getCollection().add("Huhu2");
+ assertEquals(2, yOptionsGroup2.getCollection().size());
+ assertEquals("Huhu", yOptionsGroup2.getCollection().get(0));
+ assertEquals("Huhu2", yOptionsGroup2.getCollection().get(1));
+ assertEquals("Huhu", yOptionsGroup1.getCollection().get(0));
+ assertEquals("Huhu2", yOptionsGroup1.getCollection().get(1));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ // remove from yOptionsGroup2
+ yOptionsGroup2.getCollection().remove("Huhu");
+ assertEquals(1, yOptionsGroup1.getCollection().size());
+ assertEquals(1, yOptionsGroup2.getCollection().size());
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add another to yOptionsGroup2
+ yOptionsGroup2.getCollection().add("Blabla");
+ assertEquals(2, yOptionsGroup1.getCollection().size());
+ assertEquals(2, yOptionsGroup2.getCollection().size());
+ assertEquals("Huhu2", yOptionsGroup1.getCollection().get(0));
+ assertEquals("Blabla", yOptionsGroup1.getCollection().get(1));
+ assertEquals("Huhu2", yOptionsGroup2.getCollection().get(0));
+ assertEquals("Blabla", yOptionsGroup2.getCollection().get(1));
+ assertEquals("Huhu2", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yOptionsGroup2.getCollection().move(0, 1);
+ assertEquals(2, yOptionsGroup1.getCollection().size());
+ assertEquals(2, yOptionsGroup2.getCollection().size());
+ assertEquals("Blabla", yOptionsGroup1.getCollection().get(0));
+ assertEquals("Huhu2", yOptionsGroup1.getCollection().get(1));
+ assertEquals("Blabla", yOptionsGroup2.getCollection().get(0));
+ assertEquals("Huhu2", yOptionsGroup2.getCollection().get(1));
+ assertEquals("Blabla", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yOptionsGroup2.getCollection().clear();
+ assertEquals(0, yOptionsGroup1.getCollection().size());
+ assertEquals(0, yOptionsGroup2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+
+ // add
+ yOptionsGroup1.getCollection().add("Huhu");
+ yOptionsGroup1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ // test set selection
+ yOptionsGroup1.setSelection("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getSelection());
+ assertEquals("Huhu", optionsGroup1.getValue());
+
+ optionsGroup1.setValue("Haha");
+ assertEquals("Haha", yOptionsGroup1.getSelection());
+ assertEquals("Haha", optionsGroup1.getValue());
+
+ // test set selection null
+ optionsGroup1.setValue(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ optionsGroup1.setValue("Haha");
+ assertEquals("Haha", yOptionsGroup1.getSelection());
+ assertEquals("Haha", optionsGroup1.getValue());
+
+ yOptionsGroup1.setSelection(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ // test remove element that is selected
+ // add
+ yOptionsGroup1.getCollection().add("Huhu");
+ yOptionsGroup1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ yOptionsGroup1.setSelection("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getSelection());
+ assertEquals("Huhu", optionsGroup1.getValue());
+
+ yOptionsGroup1.getCollection().remove("Huhu");
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+
+ // test remove element that is selected
+ // add
+ yOptionsGroup1.getCollection().add("Huhu");
+ assertEquals(2, container.size());
+
+ yOptionsGroup1.setSelection("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getSelection());
+ assertEquals("Huhu", optionsGroup1.getValue());
+
+ optionsGroup1.setValue(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToBean()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(Bar.class);
+ yLayout.getElements().add(yOptionsGroup1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yOptionsGroup1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setPropertyPath("myfoo.name");
+ yDetailEndpoint.setType(Bar.class);
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yOptionsGroup1.getCollection().add(bar1);
+ yOptionsGroup1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yOptionsGroup1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yOptionsGroup1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yOptionsGroup1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ optionsGroup1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ optionsGroup1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ optionsGroup1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ optionsGroup1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yOptionsGroup1.getCollection().clear();
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ // test setValue to textfield
+ yOptionsGroup1.getCollection().add(bar1);
+ yOptionsGroup1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yOptionsGroup1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yOptionsGroup1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToEmf()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(EmfBar.class);
+ yOptionsGroup1.setEmfNsURI(ModelPackage.eINSTANCE.getNsURI());
+ yLayout.getElements().add(yOptionsGroup1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yOptionsGroup1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setType(EmfBar.class);
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfBar_Myfoo());
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfFoo_Name());
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ EmfBar bar1 = ModelFactory.eINSTANCE.createEmfBar();
+ bar1.setName("Bar1");
+ EmfFoo foo1 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ EmfBar bar2 = ModelFactory.eINSTANCE.createEmfBar();
+ bar2.setName("Bar2");
+ EmfFoo foo2 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yOptionsGroup1.getCollection().add(bar1);
+ yOptionsGroup1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yOptionsGroup1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yOptionsGroup1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yOptionsGroup1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ optionsGroup1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ optionsGroup1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ optionsGroup1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ optionsGroup1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yOptionsGroup1.getCollection().clear();
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ // test setValue to textfield
+ yOptionsGroup1.getCollection().add(bar1);
+ yOptionsGroup1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yOptionsGroup1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yOptionsGroup1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setSelectionType(YSelectionType.MULTI);
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+
+ // add
+ yOptionsGroup1.getCollection().add("Huhu");
+ yOptionsGroup1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+
+ // test set selection by model
+ yOptionsGroup1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ yOptionsGroup1.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(1));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup1.getValue()).size());
+
+ // remove selection
+ yOptionsGroup1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ yOptionsGroup1.getMultiSelection().clear();
+ assertEquals(0, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(0, asList(optionsGroup1.getValue()).size());
+
+ // test set selection by widget
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ optionsGroup1.setValue(selection);
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Huhu");
+ selection.add("Haha");
+ optionsGroup1.setValue(selection);
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Haha");
+ optionsGroup1.setValue(selection);
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ optionsGroup1.setValue(selection);
+ assertEquals(0, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(0, asList(optionsGroup1.getValue()).size());
+
+ }
+
+ private Collection<?> castCollection(Object value) {
+ return (Collection<?>) value;
+ }
+
+ private List<?> asList(Object value) {
+ return new ArrayList<Object>(castCollection(value));
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+
+ // add
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ // test set selection
+ yOptionsGroup1.setSelection("Huhu");
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setSelectionType(YSelectionType.MULTI);
+ yOptionsGroup1.setType(List.class);
+ yLayout.getElements().add(yOptionsGroup1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+
+ // test set selection by model
+ yOptionsGroup1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ yOptionsGroup1.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup1.getValue()).size());
+
+ // remove selection
+ yOptionsGroup1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ yOptionsGroup1.getMultiSelection().clear();
+ assertEquals(0, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(0, asList(optionsGroup1.getValue()).size());
+
+ // test set selection by widget
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ optionsGroup1.setValue(selection);
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Huhu");
+ selection.add("Haha");
+ optionsGroup1.setValue(selection);
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Haha");
+ optionsGroup1.setValue(selection);
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ optionsGroup1.setValue(selection);
+ assertEquals(0, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(0, asList(optionsGroup1.getValue()).size());
+ }
+
+ @Test
+ public void test_SelectionBinding_Single_WithAttributePath()
+ throws ContextException {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(Bar.class);
+ yLayout.getElements().add(yOptionsGroup1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YEmbeddableSelectionEndpoint selectionBindingEndpoint = yOptionsGroup1
+ .createSelectionEndpoint();
+ selectionBindingEndpoint.setAttributePath("myfoo.name");
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ selectionBindingEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yOptionsGroup1.getCollection().add(bar1);
+ yOptionsGroup1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yOptionsGroup1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yOptionsGroup1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yOptionsGroup1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ optionsGroup1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ optionsGroup1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ optionsGroup1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ optionsGroup1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yOptionsGroup1.getCollection().clear();
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+
+ // test setValue to textfield
+ yOptionsGroup1.getCollection().add(bar1);
+ yOptionsGroup1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yOptionsGroup1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yOptionsGroup1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_OptionGroupToOptionGroup()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setSelectionType(YSelectionType.MULTI);
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+ YOptionsGroup yOptionsGroup2 = factory.createOptionsGroup();
+ yOptionsGroup2.setSelectionType(YSelectionType.MULTI);
+ yOptionsGroup2.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IOptionsGroupEditpart optionsGroup2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup2);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> optionsGroup2Presentation = optionsGroup2Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+ OptionGroup optionsGroup2 = (OptionGroup) optionsGroup2Presentation
+ .getWidget();
+
+ optionsGroup1.getContainerDataSource();
+ optionsGroup2.getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yOptionsGroup1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yOptionsGroup2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableMultiSelectionEndpoint endpSel1 = yOptionsGroup1
+ .createMultiSelectionEndpoint();
+ YEmbeddableMultiSelectionEndpoint endpSel2 = yOptionsGroup2
+ .createMultiSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ Container.Indexed container2 = (Indexed) optionsGroup2
+ .getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+ assertTrue(asList(optionsGroup2.getValue()).isEmpty());
+ assertTrue(yOptionsGroup2.getMultiSelection().isEmpty());
+
+ // add
+ yOptionsGroup1.getCollection().add("Huhu");
+ yOptionsGroup2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+ assertTrue(asList(optionsGroup2.getValue()).isEmpty());
+ assertTrue(yOptionsGroup2.getMultiSelection().isEmpty());
+
+ // test set selection
+ yOptionsGroup1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+ assertEquals("Huhu", yOptionsGroup2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup2.getValue()).get(0));
+ assertEquals(1, yOptionsGroup2.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup2.getValue()).size());
+
+ yOptionsGroup2.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup1.getValue()).size());
+ assertEquals("Huhu", yOptionsGroup2.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup2.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup2.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup2.getValue()).size());
+
+ yOptionsGroup1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+ assertEquals("Haha", yOptionsGroup2.getMultiSelection().get(0));
+ assertEquals("Haha", asList(optionsGroup2.getValue()).get(0));
+ assertEquals(1, yOptionsGroup2.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup2.getValue()).size());
+
+ // clear
+ yOptionsGroup2.getMultiSelection().clear();
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+ assertTrue(asList(optionsGroup2.getValue()).isEmpty());
+ assertTrue(yOptionsGroup2.getMultiSelection().isEmpty());
+
+ // test set selection null
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ optionsGroup1.setValue(selection);
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup1.getValue()).get(0));
+ assertEquals(1, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup1.getValue()).size());
+ assertEquals("Huhu", yOptionsGroup2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(optionsGroup2.getValue()).get(0));
+ assertEquals(1, yOptionsGroup2.getMultiSelection().size());
+ assertEquals(1, asList(optionsGroup2.getValue()).size());
+
+ selection.add("Haha");
+ optionsGroup2.setValue(selection);
+ assertEquals("Huhu", yOptionsGroup1.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup1.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup1.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup1.getValue()).size());
+ assertEquals("Huhu", yOptionsGroup2.getMultiSelection().get(0));
+ assertEquals("Haha", yOptionsGroup2.getMultiSelection().get(1));
+ // -> Sort order not defined by vaadin -> Set
+ assertTrue(asList(optionsGroup1.getValue()).contains("Huhu"));
+ assertTrue(asList(optionsGroup1.getValue()).contains("Haha"));
+ assertEquals(2, yOptionsGroup2.getMultiSelection().size());
+ assertEquals(2, asList(optionsGroup2.getValue()).size());
+
+ optionsGroup2.setValue(new ArrayList<String>());
+ assertTrue(asList(optionsGroup2.getValue()).isEmpty());
+ assertTrue(yOptionsGroup2.getMultiSelection().isEmpty());
+ assertTrue(asList(optionsGroup1.getValue()).isEmpty());
+ assertTrue(yOptionsGroup1.getMultiSelection().isEmpty());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_OptionGroupToOptionGroup()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup1 = factory.createOptionsGroup();
+ yOptionsGroup1.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup1);
+ YOptionsGroup yOptionsGroup2 = factory.createOptionsGroup();
+ yOptionsGroup2.setType(String.class);
+ yLayout.getElements().add(yOptionsGroup2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroup1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup1);
+ IOptionsGroupEditpart optionsGroup2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup2);
+ IWidgetPresentation<Component> optionsGroup1Presentation = optionsGroup1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> optionsGroup2Presentation = optionsGroup2Editpart
+ .getPresentation();
+ OptionGroup optionsGroup1 = (OptionGroup) optionsGroup1Presentation
+ .getWidget();
+ OptionGroup optionsGroup2 = (OptionGroup) optionsGroup2Presentation
+ .getWidget();
+
+ optionsGroup1.getContainerDataSource();
+ optionsGroup2.getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yOptionsGroup1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yOptionsGroup2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yOptionsGroup1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yOptionsGroup2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) optionsGroup1
+ .getContainerDataSource();
+ Container.Indexed container2 = (Indexed) optionsGroup2
+ .getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+
+ // add
+ yOptionsGroup1.getCollection().add("Huhu");
+ yOptionsGroup2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup2.getSelection());
+ assertNull(optionsGroup2.getValue());
+
+ // test set selection
+ yOptionsGroup1.setSelection("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getSelection());
+ assertEquals("Huhu", optionsGroup1.getValue());
+ assertEquals("Huhu", yOptionsGroup2.getSelection());
+ assertEquals("Huhu", optionsGroup2.getValue());
+
+ optionsGroup1.setValue("Haha");
+ assertEquals("Haha", yOptionsGroup1.getSelection());
+ assertEquals("Haha", optionsGroup1.getValue());
+ assertEquals("Haha", yOptionsGroup2.getSelection());
+ assertEquals("Haha", optionsGroup2.getValue());
+
+ // test set selection null
+ optionsGroup1.setValue(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup2.getSelection());
+ assertNull(optionsGroup2.getValue());
+
+ optionsGroup1.setValue("Haha");
+ assertEquals("Haha", yOptionsGroup1.getSelection());
+ assertEquals("Haha", optionsGroup1.getValue());
+ assertEquals("Haha", yOptionsGroup2.getSelection());
+ assertEquals("Haha", optionsGroup2.getValue());
+
+ optionsGroup2.setValue(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup2.getSelection());
+ assertNull(optionsGroup2.getValue());
+
+ optionsGroup2.setValue("Haha");
+ assertEquals("Haha", yOptionsGroup1.getSelection());
+ assertEquals("Haha", optionsGroup1.getValue());
+ assertEquals("Haha", yOptionsGroup2.getSelection());
+ assertEquals("Haha", optionsGroup2.getValue());
+
+ yOptionsGroup1.setSelection(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup2.getSelection());
+ assertNull(optionsGroup2.getValue());
+
+ optionsGroup2.setValue("Haha");
+ assertEquals("Haha", yOptionsGroup1.getSelection());
+ assertEquals("Haha", optionsGroup1.getValue());
+ assertEquals("Haha", yOptionsGroup2.getSelection());
+ assertEquals("Haha", optionsGroup2.getValue());
+
+ yOptionsGroup2.setSelection(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup2.getSelection());
+ assertNull(optionsGroup2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yOptionsGroup1.setSelection("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getSelection());
+ assertEquals("Huhu", yOptionsGroup2.getSelection());
+ assertEquals("Huhu", optionsGroup1.getValue());
+ assertEquals("Huhu", optionsGroup2.getValue());
+
+ yOptionsGroup1.getCollection().remove("Huhu");
+ assertNull(optionsGroup1.getValue());
+ assertNull(optionsGroup2.getValue());
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(yOptionsGroup2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yOptionsGroup2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yOptionsGroup1.setSelection("Huhu");
+ assertEquals("Huhu", yOptionsGroup1.getSelection());
+ assertEquals("Huhu", optionsGroup1.getValue());
+ assertEquals("Huhu", yOptionsGroup2.getSelection());
+ assertEquals("Huhu", optionsGroup2.getValue());
+
+ optionsGroup2.setValue(null);
+ assertNull(yOptionsGroup1.getSelection());
+ assertNull(optionsGroup1.getValue());
+ assertNull(yOptionsGroup2.getSelection());
+ assertNull(optionsGroup2.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(String.class);
+ yGridlayout.getElements().add(yOptionsGroup);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart optionsGroupEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ IWidgetPresentation<Component> presentation = optionsGroupEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(6, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(String.class);
+ yGridlayout.getElements().add(yOptionsGroup);
+
+ // set the i18n key
+ yOptionsGroup.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IOptionsGroupEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ OptionsGroupPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(ValueBean.class);
+ yLayout.getElements().add(yOptionsGroup);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ OptionGroup grp = (OptionGroup) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yOptionsGroup.createEditableEndpoint(),
+ yBeanBinding);
+
+ // test binding
+ assertFalse(yOptionsGroup.isEditable());
+ assertFalse(!grp.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yOptionsGroup.isEditable());
+ assertTrue(!grp.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(ValueBean.class);
+ yLayout.getElements().add(yOptionsGroup);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ presentation.getWidget();
+ OptionGroup grp = (OptionGroup) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yOptionsGroup.createVisibleEndpoint(),
+ yBeanBinding);
+
+ // test binding
+ assertFalse(yOptionsGroup.isVisible());
+ assertFalse(grp.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yOptionsGroup.isVisible());
+ assertTrue(grp.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YOptionsGroup yOptionsGroup = factory.createOptionsGroup();
+ yOptionsGroup.setType(ValueBean.class);
+ yLayout.getElements().add(yOptionsGroup);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IOptionsGroupEditpart editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yOptionsGroup);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ presentation.getWidget();
+ OptionGroup grp = (OptionGroup) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yOptionsGroup.createEnabledEndpoint(),
+ yBeanBinding);
+
+ // test binding
+ assertFalse(yOptionsGroup.isEnabled());
+ assertFalse(grp.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yOptionsGroup.isEnabled());
+ assertTrue(grp.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ProgressBarPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ProgressBarPresentationTests.java
new file mode 100644
index 0000000..e2eeaae
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/ProgressBarPresentationTests.java
@@ -0,0 +1,487 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YProgressBar;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IProgressBarEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ProgressBarPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.ProgressBar;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link ProgressBarPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class ProgressBarPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yProgressBar
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yGridlayout.getElements().add(yProgressBar);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart progressBarEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar);
+ IWidgetPresentation<Component> presentation = progressBarEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yProgressBar);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yProgressBar
+ YView yView = factory.createView();
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yView.setContent(yProgressBar);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart progressBarEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar);
+ IWidgetPresentation<Component> presentation = progressBarEditpart
+ .getPresentation();
+
+ ProgressBar text = (ProgressBar) presentation.getWidget();
+ assertNotNull(text);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yProgressBar
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YProgressBar yProgressBar1 = factory.createProgressBar();
+ yProgressBar1.setCssID("ID_0815");
+ yProgressBar1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yProgressBar1);
+ YProgressBar yProgressBar2 = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart progressBar1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar1);
+ IProgressBarEditpart progressBar2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar2);
+ IWidgetPresentation<Component> progressBar1Presentation = progressBar1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> progressBar2Presentation = progressBar2Editpart
+ .getPresentation();
+
+ ProgressBar progressBar1 = (ProgressBar) progressBar1Presentation
+ .getWidget();
+ ProgressBar progressBar2 = (ProgressBar) progressBar2Presentation
+ .getWidget();
+
+ // assert css class
+ assertTrue(progressBar1.getStyleName().contains("anyOtherClass"));
+ assertTrue(progressBar2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", progressBar1.getId());
+ assertEquals(progressBar2Editpart.getId(), progressBar2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yProgressBar
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YProgressBar yProgressBar1 = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar1);
+ YProgressBar yProgressBar2 = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart progressBar1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar1);
+ IProgressBarEditpart progressBar2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar2);
+ IWidgetPresentation<Component> progressBar1Presentation = progressBar1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> progressBar2Presentation = progressBar2Editpart
+ .getPresentation();
+ ProgressBar progressBar1 = (ProgressBar) progressBar1Presentation
+ .getWidget();
+ ProgressBar progressBar2 = (ProgressBar) progressBar2Presentation
+ .getWidget();
+
+ // start tests
+ //
+ yProgressBar1.setValue(0.0f);
+ yProgressBar2.setValue(0.0f);
+
+ assertTrue(progressBar1.isVisible());
+ assertTrue(progressBar1.isEnabled());
+ assertFalse(progressBar1.isReadOnly());
+ assertEquals(0.0f, progressBar1.getValue(), 0);
+
+ assertTrue(progressBar2.isVisible());
+ assertTrue(progressBar2.isEnabled());
+ assertFalse(progressBar2.isReadOnly());
+ assertEquals(0.0f, progressBar2.getValue(), 0);
+
+ yProgressBar1.setVisible(false);
+ assertFalse(progressBar1.isVisible());
+
+ yProgressBar1.setEnabled(false);
+ assertFalse(progressBar1.isEnabled());
+
+ yProgressBar1.setEditable(false);
+ assertTrue(progressBar1.isReadOnly());
+
+ // target to model
+ progressBar1.setReadOnly(false);
+ assertTrue(yProgressBar1.isEditable());
+
+ yProgressBar1.setValue(0.30f);
+ yProgressBar2.setValue(0.60f);
+ assertEquals(0.30f, progressBar1.getValue(), 0);
+ assertEquals(0.60f, progressBar2.getValue(), 0);
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yProgressBar
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YProgressBar yProgressBar1 = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart progressBar1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar1);
+ IWidgetPresentation<Component> progressBar1Presentation = progressBar1Editpart
+ .getPresentation();
+ ProgressBar progressBar1 = (ProgressBar) progressBar1Presentation
+ .getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ yProgressBar1.setValue(0.0f);
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(0.30f);
+ beanBinding.setPropertyPath("floatValue");
+ beanBinding.setBean(bean);
+ yBindingSet
+ .addBinding(yProgressBar1.createValueEndpoint(), beanBinding);
+ assertEquals(0.30f, progressBar1.getValue(), 0);
+ assertEquals(0.30f, yProgressBar1.getValue(), 0);
+
+ bean.setFloatValue(0.60f);
+ assertEquals(0.60f, progressBar1.getValue(), 0);
+ assertEquals(0.60f, yProgressBar1.getValue(), 0);
+
+ progressBar1.setValue(0.70f);
+ assertEquals(0.70f, bean.getFloatValue(), 0);
+ assertEquals(0.70f, yProgressBar1.getValue(), 0);
+
+ yProgressBar1.setValue(0.80f);
+ assertEquals(0.80f, bean.getFloatValue(), 0);
+ assertEquals(0.80f, progressBar1.getValue(), 0);
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yGridlayout.getElements().add(yProgressBar);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart progressBarEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yProgressBar);
+ IWidgetPresentation<Component> presentation = progressBarEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yGridlayout.getElements().add(yProgressBar);
+
+ // set the i18n key
+ yProgressBar.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ IProgressBarEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yProgressBar);
+ ProgressBarPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yProgressBar);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ ProgressBar progressBar1 = (ProgressBar) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yProgressBar.createEditableEndpoint(),
+ yBeanBinding);
+
+ // test binding
+ assertFalse(yProgressBar.isEditable());
+ assertFalse(!progressBar1.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yProgressBar.isEditable());
+ assertTrue(!progressBar1.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yProgressBar);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ ProgressBar progressBar1 = (ProgressBar) presentation.getWidget();
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yProgressBar.createVisibleEndpoint(),
+ yBeanBinding);
+
+ // test binding
+ assertFalse(yProgressBar.isVisible());
+ assertFalse(progressBar1.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yProgressBar.isVisible());
+ assertTrue(progressBar1.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YProgressBar yProgressBar = factory.createProgressBar();
+ yLayout.getElements().add(yProgressBar);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IProgressBarEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yProgressBar);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ ProgressBar progressBar1 = (ProgressBar) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yProgressBar.createEnabledEndpoint(),
+ yBeanBinding);
+
+ // test binding
+ assertFalse(yProgressBar.isEnabled());
+ assertFalse(progressBar1.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yProgressBar.isEnabled());
+ assertTrue(progressBar1.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/SliderPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/SliderPresentationTests.java
new file mode 100644
index 0000000..0709728
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/SliderPresentationTests.java
@@ -0,0 +1,478 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSlider;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISliderEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.SliderPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Slider;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link SliderPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class SliderPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> ySlider
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YSlider ySlider = factory.createSlider();
+ yGridlayout.getElements().add(ySlider);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart sliderEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider);
+ IWidgetPresentation<Component> presentation = sliderEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(ySlider);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> ySlider
+ YView yView = factory.createView();
+ YSlider ySlider = factory.createSlider();
+ yView.setContent(ySlider);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart sliderEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider);
+ IWidgetPresentation<Component> presentation = sliderEditpart
+ .getPresentation();
+
+ Slider slider = (Slider) presentation.getWidget();
+ assertNotNull(slider);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> ySlider
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YSlider ySlider1 = factory.createSlider();
+ ySlider1.setCssID("ID_0815");
+ ySlider1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(ySlider1);
+ YSlider ySlider2 = factory.createSlider();
+ yLayout.getElements().add(ySlider2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart slider1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider1);
+ ISliderEditpart slider2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider2);
+ IWidgetPresentation<Component> slider1Presentation = slider1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> slider2Presentation = slider2Editpart
+ .getPresentation();
+
+ Slider slider1 = (Slider) slider1Presentation.getWidget();
+ Slider slider2 = (Slider) slider2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(slider1.getStyleName().contains("anyOtherClass"));
+ assertTrue(slider2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", slider1.getId());
+ assertEquals(slider2Editpart.getId(), slider2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> ySlider
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YSlider ySlider1 = factory.createSlider();
+ yLayout.getElements().add(ySlider1);
+ YSlider ySlider2 = factory.createSlider();
+ yLayout.getElements().add(ySlider2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart slider1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider1);
+ ISliderEditpart slider2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider2);
+ IWidgetPresentation<Component> slider1Presentation = slider1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> slider2Presentation = slider2Editpart
+ .getPresentation();
+ Slider slider1 = (Slider) slider1Presentation.getWidget();
+ Slider slider2 = (Slider) slider2Presentation.getWidget();
+
+ // start tests
+ //
+ ySlider1.setValue(0d);
+ ySlider2.setValue(0d);
+
+ assertTrue(slider1.isVisible());
+ assertTrue(slider1.isEnabled());
+ assertFalse(slider1.isReadOnly());
+ assertEquals(0d, slider1.getValue(), 0);
+
+ assertTrue(slider2.isVisible());
+ assertTrue(slider2.isEnabled());
+ assertFalse(slider2.isReadOnly());
+ assertEquals(0d, slider2.getValue(), 0);
+
+ ySlider1.setVisible(false);
+ assertFalse(slider1.isVisible());
+
+ ySlider1.setEnabled(false);
+ assertFalse(slider1.isEnabled());
+
+ ySlider1.setEditable(false);
+ assertTrue(slider1.isReadOnly());
+
+ // target to model
+ slider1.setReadOnly(false);
+ assertTrue(ySlider1.isEditable());
+
+ ySlider1.setValue(30d);
+ ySlider2.setValue(60d);
+ assertEquals(30d, slider1.getValue(), 0);
+ assertEquals(60d, slider2.getValue(), 0);
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> ySlider
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YSlider ySlider1 = factory.createSlider();
+ yLayout.getElements().add(ySlider1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart slider1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider1);
+ IWidgetPresentation<Component> slider1Presentation = slider1Editpart
+ .getPresentation();
+ Slider slider1 = (Slider) slider1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ ySlider1.setValue(0d);
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean(30d);
+ beanBinding.setPropertyPath("doubleValue");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(ySlider1.createValueEndpoint(), beanBinding);
+ assertEquals(30d, slider1.getValue(), 0);
+ assertEquals(30d, ySlider1.getValue(), 0);
+
+ bean.setDoubleValue(60d);
+ assertEquals(60d, slider1.getValue(), 0);
+ assertEquals(60d, ySlider1.getValue(), 0);
+
+ slider1.setValue(70d);
+ assertEquals(70d, bean.getDoubleValue(), 0);
+ assertEquals(70d, ySlider1.getValue(), 0);
+
+ ySlider1.setValue(80d);
+ assertEquals(80d, bean.getDoubleValue(), 0);
+ assertEquals(80d, slider1.getValue(), 0);
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YSlider ySlider = factory.createSlider();
+ yGridlayout.getElements().add(ySlider);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart sliderEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,ySlider);
+ IWidgetPresentation<Component> presentation = sliderEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(8, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YSlider ySlider = factory.createSlider();
+ yGridlayout.getElements().add(ySlider);
+
+ // set the i18n key
+ ySlider.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ ISliderEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,ySlider);
+ SliderPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YSlider ySlider = factory.createSlider();
+ yLayout.getElements().add(ySlider);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,ySlider);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Slider slider1 = (Slider) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(ySlider.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(ySlider.isEditable());
+ assertFalse(!slider1.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(ySlider.isEditable());
+ assertTrue(!slider1.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YSlider ySlider = factory.createSlider();
+ yLayout.getElements().add(ySlider);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,ySlider);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Slider slider1 = (Slider) presentation.getWidget();
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(ySlider.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(ySlider.isVisible());
+ assertFalse(slider1.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(ySlider.isVisible());
+ assertTrue(slider1.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YSlider ySlider = factory.createSlider();
+ yLayout.getElements().add(ySlider);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ISliderEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,ySlider);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Slider slider1 = (Slider) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(ySlider.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(ySlider.isEnabled());
+ assertFalse(slider1.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(ySlider.isEnabled());
+ assertTrue(slider1.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TabSheetPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TabSheetPresentationTests.java
new file mode 100644
index 0000000..a1bae88
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TabSheetPresentationTests.java
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import org.junit.Test;
+
+public class TabSheetPresentationTests {
+
+ @Test
+ public void test() {
+ // Assert.fail("Implement");
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TablePresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TablePresentationTests.java
new file mode 100644
index 0000000..45113a0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TablePresentationTests.java
@@ -0,0 +1,1965 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory;
+import org.eclipse.osbp.ecview.core.common.model.core.YDelegateConverter;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.DelegatingConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YColumn;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITableEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TablePresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Bar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Foo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TablePresentation}.
+ */
+@SuppressWarnings("restriction")
+public class TablePresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yTable
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yGridlayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart tableEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> presentation = tableEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yTable);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yTable
+ YView yView = factory.createView();
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yView.setContent(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart tableEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> presentation = tableEditpart
+ .getPresentation();
+
+ Table label = (Table) presentation.getWidget();
+ assertNotNull(label);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yTable
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setCssID("ID_0815");
+ yTable1.setCssClass("anyOtherClass");
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+ YTable yTable2 = factory.createTable();
+ yTable2.setType(String.class);
+ yLayout.getElements().add(yTable2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ ITableEditpart table2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable2);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> table2Presentation = table2Editpart
+ .getPresentation();
+
+ Table label1 = (Table) table1Presentation.getWidget();
+ Table label2 = (Table) table2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(label1.getStyleName().contains("anyOtherClass"));
+ assertTrue(label2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", label1.getId());
+ assertEquals(table2Editpart.getId(), label2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yTable
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+ YTable yTable2 = factory.createTable();
+ yTable2.setType(String.class);
+ yLayout.getElements().add(yTable2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart label1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ ITableEditpart label2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable2);
+ IWidgetPresentation<Component> table1Presentation = label1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> table2Presentation = label2Editpart
+ .getPresentation();
+ Table label1 = (Table) table1Presentation.getWidget();
+ Table label2 = (Table) table2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(label1.isVisible());
+ assertTrue(label1.isEnabled());
+ assertFalse(label1.isReadOnly());
+
+ assertTrue(label2.isVisible());
+ assertTrue(label2.isEnabled());
+ assertFalse(label2.isReadOnly());
+
+ yTable1.setVisible(false);
+ assertFalse(label1.isVisible());
+
+ yTable1.setEnabled(false);
+ assertFalse(label1.isEnabled());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ // start tests
+ //
+
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ // add
+ container.addItem("Blabla");
+ assertEquals(1, yTable1.getCollection().size());
+ assertEquals(1, container.size());
+
+ yTable1.getCollection().add("Huhu");
+ assertEquals(2, yTable1.getCollection().size());
+ assertEquals(2, container.size());
+
+ // add at index
+ yTable1.getCollection().add(0, "First");
+ assertEquals("First", yTable1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ container.addItemAt(0, "Another First");
+ assertEquals("Another First", yTable1.getCollection().get(0));
+ assertEquals("Another First", container.getItemIds(0, 1).get(0));
+
+ // move
+ yTable1.getCollection().move(1, 0);
+ assertEquals("First", yTable1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ // remove all
+ container.removeAllItems();
+ assertEquals(0, yTable1.getCollection().size());
+ assertEquals(0, container.size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Converter() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(Bar.class);
+ yLayout.getElements().add(yTable1);
+
+ YColumn col_name = factory.createColumn();
+ col_name.setPropertyPath("name");
+ yTable1.getColumns().add(col_name);
+
+ YColumn col_Foo = factory.createColumn();
+ col_Foo.setPropertyPath("myfoo");
+ yTable1.getColumns().add(col_Foo);
+
+ // Create the converter here
+ YDelegateConverter converter = CoreModelFactory.eINSTANCE.createYDelegateConverter();
+ converter.setConverterId("myFoo-ToString");
+ col_Foo.setConverter(converter);
+
+ // register the converter factory here
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ assertNull(table1.getConverter("name"));
+ assertTrue(table1.getConverter("myfoo").getClass() == FooToStringConverter.class);
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test set selection
+ yTable1.setSelection(bar1);
+ yTable1.setSelection(bar2);
+
+ // test set selection null
+ yTable1.setSelection(null);
+ table1.setValue(bar1);
+ table1.setValue(bar2);
+
+ // test set selection null
+ table1.setValue(null);
+
+ // test remove element that is selected
+ // add
+ table1.setValue(bar2);
+
+ yTable1.getCollection().clear();
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_TableToTable() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+ YTable yTable2 = factory.createTable();
+ yTable2.setType(String.class);
+ yLayout.getElements().add(yTable2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ ITableEditpart table2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable2);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> table2Presentation = table2Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+ Table table2 = (Table) table2Presentation.getWidget();
+
+ Container.Indexed indexedDs1 = (Indexed) table1
+ .getContainerDataSource();
+ Container.Indexed indexedDs2 = (Indexed) table2
+ .getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTable1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTable2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ assertEquals(0, yTable1.getCollection().size());
+ assertEquals(0, yTable2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+
+ // add to yTable1
+ yTable1.getCollection().add("Huhu");
+ assertEquals(1, yTable2.getCollection().size());
+ assertEquals("Huhu", yTable2.getCollection().get(0));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add to yTable1
+ yTable1.getCollection().add("Huhu2");
+ assertEquals(2, yTable2.getCollection().size());
+ assertEquals("Huhu", yTable2.getCollection().get(0));
+ assertEquals("Huhu2", yTable2.getCollection().get(1));
+ assertEquals("Huhu", yTable1.getCollection().get(0));
+ assertEquals("Huhu2", yTable1.getCollection().get(1));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ // remove from yTable2
+ yTable2.getCollection().remove("Huhu");
+ assertEquals(1, yTable1.getCollection().size());
+ assertEquals(1, yTable2.getCollection().size());
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add another to yTable2
+ yTable2.getCollection().add("Blabla");
+ assertEquals(2, yTable1.getCollection().size());
+ assertEquals(2, yTable2.getCollection().size());
+ assertEquals("Huhu2", yTable1.getCollection().get(0));
+ assertEquals("Blabla", yTable1.getCollection().get(1));
+ assertEquals("Huhu2", yTable2.getCollection().get(0));
+ assertEquals("Blabla", yTable2.getCollection().get(1));
+ assertEquals("Huhu2", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yTable2.getCollection().move(0, 1);
+ assertEquals(2, yTable1.getCollection().size());
+ assertEquals(2, yTable2.getCollection().size());
+ assertEquals("Blabla", yTable1.getCollection().get(0));
+ assertEquals("Huhu2", yTable1.getCollection().get(1));
+ assertEquals("Blabla", yTable2.getCollection().get(0));
+ assertEquals("Huhu2", yTable2.getCollection().get(1));
+ assertEquals("Blabla", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yTable2.getCollection().clear();
+ assertEquals(0, yTable1.getCollection().size());
+ assertEquals(0, yTable2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+
+ // add
+ yTable1.getCollection().add("Huhu");
+ yTable1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test set selection
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+
+ table1.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+
+ // test set selection null
+ table1.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ table1.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+
+ yTable1.setSelection(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test remove element that is selected
+ // add
+ yTable1.getCollection().add("Huhu");
+ yTable1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+
+ yTable1.getCollection().remove("Huhu");
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+
+ // test remove element that is selected
+ // add
+ yTable1.getCollection().add("Huhu");
+ assertEquals(2, container.size());
+
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+
+ table1.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+
+ // add
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test set selection
+ yTable1.setSelection("Huhu");
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_TableToTable() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+ YTable yTable2 = factory.createTable();
+ yTable2.setType(String.class);
+ yLayout.getElements().add(yTable2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ ITableEditpart table2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable2);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> table2Presentation = table2Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+ Table table2 = (Table) table2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTable1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTable2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yTable1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yTable2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) table1
+ .getContainerDataSource();
+ Container.Indexed container2 = (Indexed) table2
+ .getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+
+ // add
+ yTable1.getCollection().add("Huhu");
+ yTable2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ // test set selection
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+ assertEquals("Huhu", yTable2.getSelection());
+ assertEquals("Huhu", table2.getValue());
+
+ table1.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ // test set selection null
+ table1.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ table1.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ table2.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ table2.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ yTable1.setSelection(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ table2.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ yTable2.setSelection(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", yTable2.getSelection());
+ assertEquals("Huhu", table1.getValue());
+ assertEquals("Huhu", table2.getValue());
+
+ yTable1.getCollection().remove("Huhu");
+ assertNull(table1.getValue());
+ assertNull(table2.getValue());
+ assertNull(yTable1.getSelection());
+ assertNull(yTable2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yTable2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+ assertEquals("Huhu", yTable2.getSelection());
+ assertEquals("Huhu", table2.getValue());
+
+ table2.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yGridlayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart tableEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> presentation = tableEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(6, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable = factory.createTable();
+ yTable.setSelectionType(YSelectionType.MULTI);
+ yTable.setType(String.class);
+ yLayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart tableEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> tablePresentation = tableEditpart
+ .getPresentation();
+ Table table1 = (Table) tablePresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertTrue(asList(table1.getValue()).isEmpty());
+ assertTrue(yTable.getMultiSelection().isEmpty());
+
+ // test set selection by model
+ yTable.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yTable.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+
+ yTable.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yTable.getMultiSelection().get(0));
+ assertEquals("Haha", yTable.getMultiSelection().get(1));
+ // no sort order defined by vaadin -> Set
+ assertTrue(asList(table1.getValue()).contains("Huhu"));
+ assertTrue(asList(table1.getValue()).contains("Haha"));
+ assertEquals(2, yTable.getMultiSelection().size());
+ assertEquals(2, asList(table1.getValue()).size());
+
+ // remove selection
+ yTable.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yTable.getMultiSelection().get(0));
+ assertEquals("Haha", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+
+ yTable.getMultiSelection().clear();
+ assertEquals(0, yTable.getMultiSelection().size());
+ assertEquals(0, asList(table1.getValue()).size());
+
+ // test set selection by widget
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ table1.setValue(selection);
+ assertEquals("Huhu", yTable.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Huhu");
+ selection.add("Haha");
+ table1.setValue(selection);
+ assertEquals("Huhu", yTable.getMultiSelection().get(0));
+ assertEquals("Haha", yTable.getMultiSelection().get(1));
+ assertTrue(asList(table1.getValue()).contains("Huhu"));
+ assertTrue(asList(table1.getValue()).contains("Haha"));
+ assertEquals(2, yTable.getMultiSelection().size());
+ assertEquals(2, asList(table1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Haha");
+ table1.setValue(selection);
+ assertEquals("Haha", yTable.getMultiSelection().get(0));
+ assertEquals("Haha", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ table1.setValue(selection);
+ assertEquals(0, yTable.getMultiSelection().size());
+ assertEquals(0, asList(table1.getValue()).size());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setSelectionType(YSelectionType.MULTI);
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+ YTable yTable2 = factory.createTable();
+ yTable2.setSelectionType(YSelectionType.MULTI);
+ yTable2.setType(String.class);
+ yLayout.getElements().add(yTable2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ ITableEditpart table2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable2);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> table2Presentation = table2Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+ Table table2 = (Table) table2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTable1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTable2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableMultiSelectionEndpoint endpSel1 = yTable1
+ .createMultiSelectionEndpoint();
+ YEmbeddableMultiSelectionEndpoint endpSel2 = yTable2
+ .createMultiSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) table1
+ .getContainerDataSource();
+ Container.Indexed container2 = (Indexed) table2
+ .getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertTrue(asList(table1.getValue()).isEmpty());
+ assertTrue(yTable1.getMultiSelection().isEmpty());
+ assertTrue(asList(table2.getValue()).isEmpty());
+ assertTrue(yTable2.getMultiSelection().isEmpty());
+
+ // add
+ yTable1.getCollection().add("Huhu");
+ yTable2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertTrue(asList(table1.getValue()).isEmpty());
+ assertTrue(yTable1.getMultiSelection().isEmpty());
+ assertTrue(asList(table2.getValue()).isEmpty());
+ assertTrue(yTable2.getMultiSelection().isEmpty());
+
+ // test set selection
+ yTable1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yTable1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable1.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+ assertEquals("Huhu", yTable2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(table2.getValue()).get(0));
+ assertEquals(1, yTable2.getMultiSelection().size());
+ assertEquals(1, asList(table2.getValue()).size());
+
+ yTable2.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yTable1.getMultiSelection().get(0));
+ assertEquals("Haha", yTable1.getMultiSelection().get(1));
+ assertTrue(asList(table1.getValue()).contains("Huhu"));
+ assertTrue(asList(table1.getValue()).contains("Haha"));
+ assertEquals(2, yTable1.getMultiSelection().size());
+ assertEquals(2, asList(table1.getValue()).size());
+ assertEquals("Huhu", yTable2.getMultiSelection().get(0));
+ assertEquals("Haha", yTable2.getMultiSelection().get(1));
+ assertTrue(asList(table2.getValue()).contains("Huhu"));
+ assertTrue(asList(table2.getValue()).contains("Haha"));
+ assertEquals(2, yTable2.getMultiSelection().size());
+ assertEquals(2, asList(table2.getValue()).size());
+
+ yTable1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yTable1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable1.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+ assertEquals("Haha", yTable2.getMultiSelection().get(0));
+ assertEquals("Haha", asList(table2.getValue()).get(0));
+ assertEquals(1, yTable2.getMultiSelection().size());
+ assertEquals(1, asList(table2.getValue()).size());
+
+ // clear
+ yTable2.getMultiSelection().clear();
+ assertTrue(asList(table1.getValue()).isEmpty());
+ assertTrue(yTable1.getMultiSelection().isEmpty());
+ assertTrue(asList(table2.getValue()).isEmpty());
+ assertTrue(yTable2.getMultiSelection().isEmpty());
+
+ // test set selection null
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ table1.setValue(selection);
+ assertEquals("Huhu", yTable1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(table1.getValue()).get(0));
+ assertEquals(1, yTable1.getMultiSelection().size());
+ assertEquals(1, asList(table1.getValue()).size());
+ assertEquals("Huhu", yTable2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(table2.getValue()).get(0));
+ assertEquals(1, yTable2.getMultiSelection().size());
+ assertEquals(1, asList(table2.getValue()).size());
+
+ selection.add("Haha");
+ table2.setValue(selection);
+ assertEquals("Huhu", yTable1.getMultiSelection().get(0));
+ assertEquals("Haha", yTable1.getMultiSelection().get(1));
+ assertTrue(asList(table1.getValue()).contains("Huhu"));
+ assertTrue(asList(table1.getValue()).contains("Haha"));
+ assertEquals(2, yTable1.getMultiSelection().size());
+ assertEquals(2, asList(table1.getValue()).size());
+ assertEquals("Huhu", yTable2.getMultiSelection().get(0));
+ assertEquals("Haha", yTable2.getMultiSelection().get(1));
+ assertTrue(asList(table2.getValue()).contains("Huhu"));
+ assertTrue(asList(table2.getValue()).contains("Haha"));
+ assertEquals(2, yTable2.getMultiSelection().size());
+ assertEquals(2, asList(table2.getValue()).size());
+
+ table2.setValue(new ArrayList<String>());
+ assertTrue(asList(table2.getValue()).isEmpty());
+ assertTrue(yTable2.getMultiSelection().isEmpty());
+ assertTrue(asList(table1.getValue()).isEmpty());
+ assertTrue(yTable1.getMultiSelection().isEmpty());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(String.class);
+ yLayout.getElements().add(yTable1);
+ YTable yTable2 = factory.createTable();
+ yTable2.setType(String.class);
+ yLayout.getElements().add(yTable2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ ITableEditpart table2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable2);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> table2Presentation = table2Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+ Table table2 = (Table) table2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTable1
+ .createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTable2
+ .createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yTable1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yTable2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) table1
+ .getContainerDataSource();
+ Container.Indexed container2 = (Indexed) table2
+ .getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+
+ // add
+ yTable1.getCollection().add("Huhu");
+ yTable2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ // test set selection
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+ assertEquals("Huhu", yTable2.getSelection());
+ assertEquals("Huhu", table2.getValue());
+
+ table1.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ // test set selection null
+ table1.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ table1.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ table2.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ table2.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ yTable1.setSelection(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ table2.setValue("Haha");
+ assertEquals("Haha", yTable1.getSelection());
+ assertEquals("Haha", table1.getValue());
+ assertEquals("Haha", yTable2.getSelection());
+ assertEquals("Haha", table2.getValue());
+
+ yTable2.setSelection(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", yTable2.getSelection());
+ assertEquals("Huhu", table1.getValue());
+ assertEquals("Huhu", table2.getValue());
+
+ yTable1.getCollection().remove("Huhu");
+ assertNull(table1.getValue());
+ assertNull(table2.getValue());
+ assertNull(yTable1.getSelection());
+ assertNull(yTable2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yTable2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTable1.setSelection("Huhu");
+ assertEquals("Huhu", yTable1.getSelection());
+ assertEquals("Huhu", table1.getValue());
+ assertEquals("Huhu", yTable2.getSelection());
+ assertEquals("Huhu", table2.getValue());
+
+ table2.setValue(null);
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yTable2.getSelection());
+ assertNull(table2.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToBean()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(Bar.class);
+ yLayout.getElements().add(yTable1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yTable1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setPropertyPath("myfoo.name");
+ yDetailEndpoint.setType(Bar.class);
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yTable1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yTable1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yTable1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ table1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ table1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ table1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ table1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yTable1.getCollection().clear();
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test setValue to textfield
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yTable1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yTable1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ public void test_SelectionBinding_Single_WithAttributePath()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(Bar.class);
+ yLayout.getElements().add(yTable1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YEmbeddableSelectionEndpoint selectionBindingEndpoint = yTable1
+ .createSelectionEndpoint();
+ selectionBindingEndpoint.setAttributePath("myfoo.name");
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ selectionBindingEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yTable1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yTable1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yTable1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ table1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ table1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ table1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ table1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yTable1.getCollection().clear();
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test setValue to textfield
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yTable1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yTable1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToEmf()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable1 = factory.createTable();
+ yTable1.setType(EmfBar.class);
+ yTable1.setEmfNsURI(ModelPackage.eINSTANCE.getNsURI());
+ yLayout.getElements().add(yTable1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yTable1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setType(EmfBar.class);
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfBar_Myfoo());
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfFoo_Name());
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable1);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table1 = (Table) table1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) table1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(table1.getValue());
+ assertNull(yTable1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ EmfBar bar1 = ModelFactory.eINSTANCE.createEmfBar();
+ bar1.setName("Bar1");
+ EmfFoo foo1 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ EmfBar bar2 = ModelFactory.eINSTANCE.createEmfBar();
+ bar2.setName("Bar2");
+ EmfFoo foo2 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yTable1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yTable1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yTable1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ table1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ table1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ table1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ table1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yTable1.getCollection().clear();
+
+ assertNull(yTable1.getSelection());
+ assertNull(table1.getValue());
+
+ // test setValue to textfield
+ yTable1.getCollection().add(bar1);
+ yTable1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yTable1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yTable1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yLayout.getElements().add(yTable);
+
+ // set the i18n key
+ yTable.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ ITableEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ TablePresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yLayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Table table = (Table) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTable.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTable.isEditable());
+ assertFalse(!table.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTable.isEditable());
+ assertTrue(!table.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yLayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Table table = (Table) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTable.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTable.isVisible());
+ assertFalse(table.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTable.isVisible());
+ assertTrue(table.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yLayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Table table = (Table) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTable.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTable.isEnabled());
+ assertFalse(table.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTable.isEnabled());
+ assertTrue(table.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ public void test_type_String() throws ContextException {
+
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTable yTable = factory.createTable();
+ yTable.setType(String.class);
+ yLayout.getElements().add(yTable);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITableEditpart table1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTable);
+ IWidgetPresentation<Component> table1Presentation = table1Editpart
+ .getPresentation();
+ Table table = (Table) table1Presentation.getWidget();
+
+ // start tests
+ //
+ yTable.getCollection().add("Blabla");
+ yTable.getCollection().add("Huhu");
+
+ // For String values NO BeanItemContainer is prepared.
+ Container.Indexed container = (Indexed) table.getContainerDataSource();
+ assertEquals(0, container.getContainerPropertyIds().size());
+
+ String itemCaption = table.getItemCaption(container.getItemIds()
+ .iterator().next());
+ assertEquals("Blabla", itemCaption);
+ assertSame(ItemCaptionMode.ID, table.getItemCaptionMode());
+
+ }
+
+ private Collection<?> castCollection(Object value) {
+ return (Collection<?>) value;
+ }
+
+ private List<?> asList(Object value) {
+ return value != null ? new ArrayList<Object>(castCollection(value))
+ : new ArrayList<Object>();
+ }
+
+ private static class ConverterFactory implements IConverterFactory {
+
+ @Override
+ public boolean isFor(IViewContext uiContext, IConverterEditpart editpart) {
+ return true;
+ }
+
+ @Override
+ public Object createConverter(IViewContext uiContext,
+ IConverterEditpart editpart) throws IllegalArgumentException {
+ return new FooToStringConverter();
+ }
+ }
+
+
+ /**
+ * Converts the object foo to a string value.
+ */
+ @SuppressWarnings("serial")
+ private static class FooToStringConverter implements com.vaadin.data.util.converter.Converter<String, Foo> {
+
+ @Override
+ public Foo convertToModel(String value,
+ Class<? extends Foo> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ return null;
+ }
+
+ @Override
+ public String convertToPresentation(Foo value,
+ Class<? extends String> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ return value != null ? value.toString() : null;
+ }
+
+ @Override
+ public Class<Foo> getModelType() {
+ return Foo.class;
+ }
+
+ @Override
+ public Class<String> getPresentationType() {
+ return String.class;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextAreaPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextAreaPresentationTests.java
new file mode 100644
index 0000000..ba9969a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextAreaPresentationTests.java
@@ -0,0 +1,468 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextArea;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextAreaEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextAreaPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TextAreaPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class TextAreaPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextArea yTextArea = factory.createTextArea();
+ yGridlayout.getElements().add(yTextArea);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart textAreaEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea);
+ IWidgetPresentation<Component> presentation = textAreaEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yTextArea);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YTextArea yTextArea = factory.createTextArea();
+ yView.setContent(yTextArea);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart textAreaEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea);
+ IWidgetPresentation<Component> presentation = textAreaEditpart
+ .getPresentation();
+
+ TextArea textArea = (TextArea) presentation.getWidget();
+ assertNotNull(textArea);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextArea yTextArea1 = factory.createTextArea();
+ yTextArea1.setCssID("ID_0815");
+ yTextArea1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yTextArea1);
+ YTextArea yTextArea2 = factory.createTextArea();
+ yLayout.getElements().add(yTextArea2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart textArea1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea1);
+ ITextAreaEditpart textArea2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea2);
+ IWidgetPresentation<Component> textArea1Presentation = textArea1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> textArea2Presentation = textArea2Editpart
+ .getPresentation();
+
+ TextArea textArea1 = (TextArea) textArea1Presentation.getWidget();
+ TextArea textArea2 = (TextArea) textArea2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(textArea1.getStyleName().contains("anyOtherClass"));
+ assertTrue(textArea2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", textArea1.getId());
+ assertEquals(textArea2Editpart.getId(), textArea2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextArea yTextArea1 = factory.createTextArea();
+ yLayout.getElements().add(yTextArea1);
+ YTextArea yTextArea2 = factory.createTextArea();
+ yLayout.getElements().add(yTextArea2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart textArea1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea1);
+ ITextAreaEditpart textArea2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea2);
+ IWidgetPresentation<Component> textArea1Presentation = textArea1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> textArea2Presentation = textArea2Editpart
+ .getPresentation();
+ TextArea textArea1 = (TextArea) textArea1Presentation.getWidget();
+ TextArea textArea2 = (TextArea) textArea2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(textArea1.isVisible());
+ assertTrue(textArea1.isEnabled());
+ assertFalse(textArea1.isReadOnly());
+
+ assertTrue(textArea2.isVisible());
+ assertTrue(textArea2.isEnabled());
+ assertFalse(textArea2.isReadOnly());
+
+ yTextArea1.setVisible(false);
+ assertFalse(textArea1.isVisible());
+
+ yTextArea1.setEnabled(false);
+ assertFalse(textArea1.isEnabled());
+
+ yTextArea1.setEditable(false);
+ assertTrue(textArea1.isReadOnly());
+
+ // target to model
+ textArea1.setReadOnly(false);
+ assertTrue(yTextArea1.isEditable());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextArea yText1 = factory.createTextArea();
+ yLayout.getElements().add(yText1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ TextArea text1 = (TextArea) text1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ yText1.setValue("");
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean("Huhu");
+ beanBinding.setPropertyPath("value");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yText1.createValueEndpoint(), beanBinding);
+ assertEquals("Huhu", text1.getValue());
+ assertEquals("Huhu", yText1.getValue());
+
+ bean.setValue("Haha");
+ assertEquals("Haha", text1.getValue());
+ assertEquals("Haha", yText1.getValue());
+
+ text1.setValue("Haha1");
+ assertEquals("Haha1", bean.getValue());
+ assertEquals("Haha1", yText1.getValue());
+
+ yText1.setValue("Haha2");
+ assertEquals("Haha2", bean.getValue());
+ assertEquals("Haha2", text1.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextArea yTextArea = factory.createTextArea();
+ yGridlayout.getElements().add(yTextArea);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart textAreaEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yTextArea);
+ IWidgetPresentation<Component> presentation = textAreaEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextArea yTextArea = factory.createTextArea();
+ yGridlayout.getElements().add(yTextArea);
+
+ // set the i18n key
+ yTextArea.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ ITextAreaEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextArea);
+ TextAreaPresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextArea yTextArea = factory.createTextArea();
+ yLayout.getElements().add(yTextArea);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextArea);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ TextArea area = (TextArea) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yTextArea.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTextArea.isEditable());
+ assertFalse(!area.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTextArea.isEditable());
+ assertTrue(!area.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextArea yTextArea = factory.createTextArea();
+ yLayout.getElements().add(yTextArea);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextArea);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ TextArea area = (TextArea) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTextArea.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTextArea.isVisible());
+ assertFalse(area.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTextArea.isVisible());
+ assertTrue(area.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextArea yTextArea = factory.createTextArea();
+ yLayout.getElements().add(yTextArea);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextAreaEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextArea);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ TextArea area = (TextArea) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTextArea.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTextArea.isEnabled());
+ assertFalse(area.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTextArea.isEnabled());
+ assertTrue(area.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextFieldPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextFieldPresentationTests.java
new file mode 100644
index 0000000..c8be0f0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TextFieldPresentationTests.java
@@ -0,0 +1,831 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingUpdateStrategy;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelFactory;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlot;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlotValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YDelegateConverter;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.model.validation.ValidationFactory;
+import org.eclipse.osbp.ecview.core.common.model.validation.YMaxLengthValidator;
+import org.eclipse.osbp.ecview.core.common.model.validation.YMinLengthValidator;
+import org.eclipse.osbp.ecview.core.common.presentation.DelegatingConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IConverterFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.BarHashById;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TextFieldPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class TextFieldPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ @After
+ public void after() {
+ DelegatingConverterFactory.getInstance().clear();
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yText);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YTextField yText = factory.createTextField();
+ yView.setContent(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+
+ TextField text = (TextField) presentation.getWidget();
+ ;
+ assertNotNull(text);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText1 = factory.createTextField();
+ yText1.setCssID("ID_0815");
+ yText1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yText1);
+ YTextField yText2 = factory.createTextField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ ITextFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+
+ TextField text1 = (TextField) text1Presentation.getWidget();
+ TextField text2 = (TextField) text2Presentation.getWidget();
+
+ // assert css class
+
+ assertTrue(text1.getStyleName().contains("anyOtherClass"));
+ assertTrue(text2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", text1.getId());
+ assertEquals(text2Editpart.getId(), text2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText1 = factory.createTextField();
+ yLayout.getElements().add(yText1);
+ YTextField yText2 = factory.createTextField();
+ yLayout.getElements().add(yText2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ ITextFieldEditpart text2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText2);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> text2Presentation = text2Editpart
+ .getPresentation();
+ TextField text1 = (TextField) text1Presentation.getWidget();
+ ;
+ TextField text2 = (TextField) text2Presentation.getWidget();
+ ;
+
+ // start tests
+ //
+ yText1.setValue("");
+ yText2.setValue("");
+
+ assertTrue(text1.isVisible());
+ assertTrue(text1.isEnabled());
+ assertFalse(text1.isReadOnly());
+ assertEquals("", text1.getValue());
+
+ assertTrue(text2.isVisible());
+ assertTrue(text2.isEnabled());
+ assertFalse(text2.isReadOnly());
+ assertEquals("", text2.getValue());
+
+ yText1.setVisible(false);
+ assertFalse(text1.isVisible());
+
+ yText1.setEnabled(false);
+ assertFalse(text1.isEnabled());
+
+ yText1.setEditable(false);
+ assertTrue(text1.isReadOnly());
+
+ // target to model
+ text1.setReadOnly(false);
+ assertTrue(yText1.isEditable());
+
+ yText1.setValue("huhu");
+ yText2.setValue("haha");
+ assertEquals("huhu", text1.getValue());
+ assertEquals("haha", text2.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isEditable());
+ assertFalse(!text.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isEditable());
+ assertTrue(!text.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isVisible());
+ assertFalse(text.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isVisible());
+ assertTrue(text.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yText.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yText.isEnabled());
+ assertFalse(text.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yText.isEnabled());
+ assertTrue(text.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_ValueBinding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText1 = factory.createTextField();
+ yLayout.getElements().add(yText1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart text1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText1);
+ IWidgetPresentation<Component> text1Presentation = text1Editpart
+ .getPresentation();
+ TextField text1 = (TextField) text1Presentation.getWidget();
+
+ // start tests
+ //
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ yText1.setValue("");
+ YBeanValueBindingEndpoint beanBinding = factory
+ .createBeanBindingEndpoint();
+ ValueBean bean = new ValueBean("Huhu");
+ beanBinding.setPropertyPath("value");
+ beanBinding.setBean(bean);
+ yBindingSet.addBinding(yText1.createValueEndpoint(), beanBinding);
+ assertEquals("Huhu", text1.getValue());
+ assertEquals("Huhu", yText1.getValue());
+
+ bean.setValue("Haha");
+ assertEquals("Haha", text1.getValue());
+ assertEquals("Haha", yText1.getValue());
+
+ text1.setValue("Haha1");
+ assertEquals("Haha1", bean.getValue());
+ assertEquals("Haha1", yText1.getValue());
+
+ yText1.setValue("Haha2");
+ assertEquals("Haha2", bean.getValue());
+ assertEquals("Haha2", text1.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(4, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_addRemoveValidatorByModel() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertEquals(0, yText.getValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ ValidationFactory vf = ValidationFactory.eINSTANCE;
+ YMinLengthValidator yValidator = vf.createYMinLengthValidator();
+ yText.getValidators().add(yValidator);
+
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getValidators().size());
+
+ yText.getValidators().remove(yValidator);
+ assertEquals(0, yText.getValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ }
+
+ @Test
+ public void test_addRemoveValidatorByModel_Twice() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertEquals(0, yText.getValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ ValidationFactory vf = ValidationFactory.eINSTANCE;
+ YMinLengthValidator yValidator = vf.createYMinLengthValidator();
+ yText.getValidators().add(yValidator);
+ yText.getValidators().add(yValidator);
+
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getValidators().size());
+
+ yText.getValidators().remove(yValidator);
+ yText.getValidators().remove(yValidator);
+ assertEquals(0, yText.getValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ yGridlayout.getElements().add(yText);
+
+ // set the i18n key
+ yText.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer
+ .render(rootLayout, yView, parameter);
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ public void test_addRemoveInternalValidatorByDatatype()
+ throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ YTextDatatype yTextDt = factory.createTextDatatype();
+ yText.setDatatype(yTextDt);
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertEquals(0, yText.getInternalValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ yTextDt.setMaxLength(10);
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getInternalValidators().size());
+
+ yTextDt.setMaxLength(-1);
+ assertEquals(0, presentation.getValidators().size());
+ assertEquals(0, yText.getInternalValidators().size());
+
+ yTextDt.setMinLength(10);
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getInternalValidators().size());
+
+ yTextDt.setMinLength(-1);
+ assertEquals(0, presentation.getValidators().size());
+ assertEquals(0, yText.getInternalValidators().size());
+
+ yTextDt.setRegExpression("\\.pdf$");
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getInternalValidators().size());
+
+ yTextDt.setRegExpression("");
+ assertEquals(0, presentation.getValidators().size());
+ assertEquals(0, yText.getInternalValidators().size());
+ }
+
+ @Test
+ public void test_changePropertyOfDatatype_ValidatorNeedsToUpdate()
+ throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ YTextDatatype yTextDt = factory.createTextDatatype();
+ yText.setDatatype(yTextDt);
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertEquals(0, yText.getInternalValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ yTextDt.setMaxLength(10);
+ YMaxLengthValidator internalValidator = (YMaxLengthValidator) yText
+ .getInternalValidators().get(0);
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getInternalValidators().size());
+ assertEquals(10, internalValidator.getMaxLength());
+
+ yTextDt.setMaxLength(5);
+
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getInternalValidators().size());
+ assertEquals(5, internalValidator.getMaxLength());
+
+ }
+
+ @Test
+ public void test_setNewDatatype() throws ContextException {
+ // ensure that the old validators are removed and disposed properly
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ YTextDatatype yTextDt = factory.createTextDatatype();
+ yText.setDatatype(yTextDt);
+ yGridlayout.getElements().add(yText);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ AbstractFieldWidgetPresenter<Component> presentation = textEditpart
+ .getPresentation();
+
+ assertEquals(0, yText.getInternalValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+
+ yTextDt.setMaxLength(10);
+
+ assertEquals(1, presentation.getValidators().size());
+ assertEquals(1, yText.getInternalValidators().size());
+
+ yText.setDatatype(null);
+
+ assertEquals(0, yText.getInternalValidators().size());
+ assertEquals(0, presentation.getValidators().size());
+ }
+
+ /**
+ * If a textfield is bound to a beanslot and a new bean with the same
+ * hashcode and values is set to the slot, then the databinding is not
+ * refreshed and the old bean instance is still bound.
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void fix_MP76() throws ContextException {
+ YView yView = factory.createView();
+ YBeanSlot yBeanSlot = factory.createBeanSlot();
+ yBeanSlot.setName("main");
+ yBeanSlot.setValueType(BarHashById.class);
+ yView.getBeanSlots().add(yBeanSlot);
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBeanSlotValueBindingEndpoint slotEP = yBeanSlot
+ .createBindingEndpoint("name");
+ YEmbeddableValueEndpoint textEP = yText.createValueEndpoint();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(textEP, slotEP, YBindingUpdateStrategy.UPDATE,
+ YBindingUpdateStrategy.UPDATE);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ BarHashById bean = new BarHashById("112233");
+ bean.setName("OSBP");
+ viewContext.setBean("main", bean);
+
+ // ensure field is bound to bean
+ assertEquals("OSBP", text.getValue());
+ assertEquals("OSBP", bean.getName());
+
+ BarHashById bean2 = new BarHashById("112233");
+ bean2.setName("OSBP");
+ viewContext.setBean("main", bean2);
+
+ // ensure field is bound to bean2
+ assertEquals("OSBP", bean2.getName());
+ assertEquals("OSBP", text.getValue());
+
+ text.setValue("Huhu");
+ assertEquals("OSBP", bean.getName());
+ assertEquals("Huhu", bean2.getName());
+ assertEquals("Huhu", text.getValue());
+
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Converter() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yText
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTextField yText = factory.createTextField();
+ YDelegateConverter yConverter = CoreModelFactory.eINSTANCE
+ .createYDelegateConverter();
+ yConverter.setConverterId("text.test");
+ yText.setConverter(yConverter);
+ yGridlayout.getElements().add(yText);
+
+ DelegatingConverterFactory.getInstance().addDelegate(
+ new ConverterFactory());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext, yText);
+ IWidgetPresentation<Component> presentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) presentation.getWidget();
+
+ yText.setValue("Huhu");
+ assertEquals("Huhu", yText.getValue());
+ assertEquals("Huhu XX", text.getValue());
+
+ text.setValue("Haha XX");
+ assertEquals("Haha", yText.getValue());
+ assertEquals("Haha XX", text.getValue());
+ }
+
+ private static class ConverterFactory implements IConverterFactory {
+
+ @Override
+ public boolean isFor(IViewContext uiContext, IConverterEditpart editpart) {
+ return true;
+ }
+
+ @Override
+ public Object createConverter(IViewContext uiContext,
+ IConverterEditpart editpart) throws IllegalArgumentException {
+ return new TextToTextConverter();
+ }
+ }
+
+ /**
+ * Converters "Test" to "Test $" and "Test $" to "Test"
+ */
+ @SuppressWarnings("serial")
+ private static class TextToTextConverter implements
+ Converter<String, String> {
+
+ @Override
+ public String convertToModel(String value,
+ Class<? extends String> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ return value == null ? "" : value.replaceAll(" XX", "");
+ }
+
+ @Override
+ public String convertToPresentation(String value,
+ Class<? extends String> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ return value == null ? " XX" : value + " XX";
+ }
+
+ @Override
+ public Class<String> getModelType() {
+ return String.class;
+ }
+
+ @Override
+ public Class<String> getPresentationType() {
+ return String.class;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TreePresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TreePresentationTests.java
new file mode 100644
index 0000000..0be566f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/TreePresentationTests.java
@@ -0,0 +1,1762 @@
+/**
+ * Copyright (c) 2012, 2015 - Lunifera GmbH (Austria), Loetz GmbH&Co.KG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YDetailValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTree;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITreeEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TreePresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfBar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.EmfFoo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.emf.model.ModelPackage;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Bar;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.Foo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.UI;
+
+/**
+ * Tests the {@link TreePresentation}.
+ */
+@SuppressWarnings("restriction")
+public class TreePresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yGridLayout
+ // .........> yTree
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTree yTree = factory.createTree();
+ yGridlayout.getElements().add(yTree);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart treeEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree);
+ IWidgetPresentation<Component> presentation = treeEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+
+ yGridlayout.getElements().remove(yTree);
+ assertFalse(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yTree
+ YView yView = factory.createView();
+ YTree yTree = factory.createTree();
+ yView.setContent(yTree);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart treeEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree);
+ IWidgetPresentation<Component> presentation = treeEditpart
+ .getPresentation();
+
+ Tree label = (Tree) presentation.getWidget();
+ assertNotNull(label);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yTree
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yTree1.setCssID("ID_0815");
+ yTree1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yTree1);
+ YTree yTree2 = factory.createTree();
+ yTree2.setType(String.class);
+ yLayout.getElements().add(yTree2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ ITreeEditpart tree2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree2);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> tree2Presentation = tree2Editpart
+ .getPresentation();
+
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+ Tree tree2 = (Tree) tree2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(tree1.getStyleName().contains("anyOtherClass"));
+ assertTrue(tree2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", tree1.getId());
+ assertEquals(tree2Editpart.getId(), tree2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yTree
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+ YTree yTree2 = factory.createTree();
+ yTree2.setType(String.class);
+ yLayout.getElements().add(yTree2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ ITreeEditpart tree2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree2);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> tree2Presentation = tree2Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+ Tree tree2 = (Tree) tree2Presentation.getWidget();
+
+ // start tests
+ //
+ assertTrue(tree1.isVisible());
+ assertTrue(tree1.isEnabled());
+ assertFalse(tree1.isReadOnly());
+
+ assertTrue(tree2.isVisible());
+ assertTrue(tree2.isEnabled());
+ assertFalse(tree2.isReadOnly());
+
+ yTree1.setVisible(false);
+ assertFalse(tree1.isVisible());
+
+ yTree1.setEnabled(false);
+ assertFalse(tree1.isEnabled());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ // start tests
+ //
+
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ // add
+ container.addItem("Blabla");
+ assertEquals(1, yTree1.getCollection().size());
+ assertEquals(1, container.size());
+
+ yTree1.getCollection().add("Huhu");
+ assertEquals(2, yTree1.getCollection().size());
+ assertEquals(2, container.size());
+
+ // add at index
+ yTree1.getCollection().add(0, "First");
+ assertEquals("First", yTree1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ container.addItemAt(0, "Another First");
+ assertEquals("Another First", yTree1.getCollection().get(0));
+ assertEquals("Another First", container.getItemIds(0, 1).get(0));
+
+ // move
+ yTree1.getCollection().move(1, 0);
+ assertEquals("First", yTree1.getCollection().get(0));
+ assertEquals("First", container.getItemIds(0, 1).get(0));
+
+ // remove all
+ container.removeAllItems();
+ assertEquals(0, yTree1.getCollection().size());
+ assertEquals(0, container.size());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_CollectionBinding_TreeToTree() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+ YTree yTree2 = factory.createTree();
+ yTree2.setType(String.class);
+ yLayout.getElements().add(yTree2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ ITreeEditpart tree2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree2);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> tree2Presentation = tree2Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+ Tree tree2 = (Tree) tree2Presentation.getWidget();
+
+ Container.Indexed indexedDs1 = (Indexed) tree1.getContainerDataSource();
+ Container.Indexed indexedDs2 = (Indexed) tree2.getContainerDataSource();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTree1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTree2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ assertEquals(0, yTree1.getCollection().size());
+ assertEquals(0, yTree2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+
+ // add to yTree1
+ yTree1.getCollection().add("Huhu");
+ assertEquals(1, yTree2.getCollection().size());
+ assertEquals("Huhu", yTree2.getCollection().get(0));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add to yTree1
+ yTree1.getCollection().add("Huhu2");
+ assertEquals(2, yTree2.getCollection().size());
+ assertEquals("Huhu", yTree2.getCollection().get(0));
+ assertEquals("Huhu2", yTree2.getCollection().get(1));
+ assertEquals("Huhu", yTree1.getCollection().get(0));
+ assertEquals("Huhu2", yTree1.getCollection().get(1));
+ assertEquals("Huhu", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ // remove from yTree2
+ yTree2.getCollection().remove("Huhu");
+ assertEquals(1, yTree1.getCollection().size());
+ assertEquals(1, yTree2.getCollection().size());
+ assertEquals(1, indexedDs1.size());
+ assertEquals(1, indexedDs2.size());
+
+ // add another to yTree2
+ yTree2.getCollection().add("Blabla");
+ assertEquals(2, yTree1.getCollection().size());
+ assertEquals(2, yTree2.getCollection().size());
+ assertEquals("Huhu2", yTree1.getCollection().get(0));
+ assertEquals("Blabla", yTree1.getCollection().get(1));
+ assertEquals("Huhu2", yTree2.getCollection().get(0));
+ assertEquals("Blabla", yTree2.getCollection().get(1));
+ assertEquals("Huhu2", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yTree2.getCollection().move(0, 1);
+ assertEquals(2, yTree1.getCollection().size());
+ assertEquals(2, yTree2.getCollection().size());
+ assertEquals("Blabla", yTree1.getCollection().get(0));
+ assertEquals("Huhu2", yTree1.getCollection().get(1));
+ assertEquals("Blabla", yTree2.getCollection().get(0));
+ assertEquals("Huhu2", yTree2.getCollection().get(1));
+ assertEquals("Blabla", indexedDs1.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs1.getItemIds(1, 1).get(0));
+ assertEquals("Blabla", indexedDs2.getItemIds(0, 1).get(0));
+ assertEquals("Huhu2", indexedDs2.getItemIds(1, 1).get(0));
+ assertEquals(2, indexedDs1.size());
+ assertEquals(2, indexedDs2.size());
+
+ yTree2.getCollection().clear();
+ assertEquals(0, yTree1.getCollection().size());
+ assertEquals(0, yTree2.getCollection().size());
+ assertEquals(0, indexedDs1.size());
+ assertEquals(0, indexedDs2.size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_Native() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+
+ // add
+ yTree1.getCollection().add("Huhu");
+ yTree1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ // test set selection
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+
+ tree1.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+
+ // test set selection null
+ tree1.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ tree1.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+
+ yTree1.setSelection(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ // test remove element that is selected
+ // add
+ yTree1.getCollection().add("Huhu");
+ yTree1.getCollection().add("Haha");
+ assertEquals(2, container.size());
+
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+
+ yTree1.getCollection().remove("Huhu");
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+
+ // test remove element that is selected
+ // add
+ yTree1.getCollection().add("Huhu");
+ assertEquals(2, container.size());
+
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+
+ tree1.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+
+ // add
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ // test set selection
+ yTree1.setSelection("Huhu");
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_TreeToTree() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+ YTree yTree2 = factory.createTree();
+ yTree2.setType(String.class);
+ yLayout.getElements().add(yTree2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ ITreeEditpart tree2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree2);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> tree2Presentation = tree2Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+ Tree tree2 = (Tree) tree2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTree1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTree2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yTree1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yTree2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) tree1.getContainerDataSource();
+ Container.Indexed container2 = (Indexed) tree2.getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+
+ // add
+ yTree1.getCollection().add("Huhu");
+ yTree2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ // test set selection
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+ assertEquals("Huhu", yTree2.getSelection());
+ assertEquals("Huhu", tree2.getValue());
+
+ tree1.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ // test set selection null
+ tree1.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ tree1.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ tree2.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ tree2.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ yTree1.setSelection(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ tree2.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ yTree2.setSelection(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", yTree2.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+ assertEquals("Huhu", tree2.getValue());
+
+ yTree1.getCollection().remove("Huhu");
+ assertNull(tree1.getValue());
+ assertNull(tree2.getValue());
+ assertNull(yTree1.getSelection());
+ assertNull(yTree2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yTree2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+ assertEquals("Huhu", yTree2.getSelection());
+ assertEquals("Huhu", tree2.getValue());
+
+ tree2.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTree yTree = factory.createTree();
+ yTree.setType(String.class);
+ yGridlayout.getElements().add(yTree);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart treeEditpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree);
+ IWidgetPresentation<Component> presentation = treeEditpart
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(6, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_EmptyCollection() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yTree1.setSelectionType(YSelectionType.MULTI);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertTrue(asList(tree1.getValue()).isEmpty());
+ assertTrue(yTree1.getMultiSelection().isEmpty());
+
+ // test set selection by model
+ yTree1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+
+ yTree1.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", yTree1.getMultiSelection().get(1));
+ // no sort order by vaadin -> Set
+ assertTrue(asList(tree1.getValue()).contains("Huhu"));
+ assertTrue(asList(tree1.getValue()).contains("Haha"));
+ assertEquals(2, yTree1.getMultiSelection().size());
+ assertEquals(2, asList(tree1.getValue()).size());
+
+ // remove selection
+ yTree1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+
+ yTree1.getMultiSelection().clear();
+ assertEquals(0, yTree1.getMultiSelection().size());
+ assertEquals(0, asList(tree1.getValue()).size());
+
+ // test set selection by widget
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ tree1.setValue(selection);
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Huhu");
+ selection.add("Haha");
+ tree1.setValue(selection);
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", yTree1.getMultiSelection().get(1));
+ // no sort order by vaadin -> Set
+ assertTrue(asList(tree1.getValue()).contains("Huhu"));
+ assertTrue(asList(tree1.getValue()).contains("Haha"));
+ assertEquals(2, yTree1.getMultiSelection().size());
+ assertEquals(2, asList(tree1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ selection.add("Haha");
+ tree1.setValue(selection);
+ assertEquals("Haha", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+
+ selection = new ArrayList<String>();
+ tree1.setValue(selection);
+ assertEquals(0, yTree1.getMultiSelection().size());
+ assertEquals(0, asList(tree1.getValue()).size());
+ }
+
+ @Test
+ public void test_SelectionBinding_Single_WithAttributePath()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(Bar.class);
+ yLayout.getElements().add(yTree1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YEmbeddableSelectionEndpoint selectionBindingEndpoint = yTree1
+ .createSelectionEndpoint();
+ selectionBindingEndpoint.setAttributePath("myfoo.name");
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ selectionBindingEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTree1.getCollection().add(bar1);
+ yTree1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yTree1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yTree1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yTree1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ tree1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ tree1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ tree1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ tree1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yTree1.getCollection().clear();
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ // test setValue to textfield
+ yTree1.getCollection().add(bar1);
+ yTree1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yTree1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yTree1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Multi_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yTree1.setSelectionType(YSelectionType.MULTI);
+ yLayout.getElements().add(yTree1);
+ YTree yTree2 = factory.createTree();
+ yTree2.setType(String.class);
+ yTree2.setSelectionType(YSelectionType.MULTI);
+ yLayout.getElements().add(yTree2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ ITreeEditpart tree2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree2);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> tree2Presentation = tree2Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+ Tree tree2 = (Tree) tree2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTree1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTree2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableMultiSelectionEndpoint endpSel1 = yTree1
+ .createMultiSelectionEndpoint();
+ YEmbeddableMultiSelectionEndpoint endpSel2 = yTree2
+ .createMultiSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) tree1.getContainerDataSource();
+ Container.Indexed container2 = (Indexed) tree2.getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertTrue(asList(tree1.getValue()).isEmpty());
+ assertTrue(yTree1.getMultiSelection().isEmpty());
+ assertTrue(asList(tree2.getValue()).isEmpty());
+ assertTrue(yTree2.getMultiSelection().isEmpty());
+
+ // add
+ yTree1.getCollection().add("Huhu");
+ yTree2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertTrue(asList(tree1.getValue()).isEmpty());
+ assertTrue(yTree1.getMultiSelection().isEmpty());
+ assertTrue(asList(tree2.getValue()).isEmpty());
+ assertTrue(yTree2.getMultiSelection().isEmpty());
+
+ // test set selection
+ yTree1.getMultiSelection().add("Huhu");
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+ assertEquals("Huhu", yTree2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(tree2.getValue()).get(0));
+ assertEquals(1, yTree2.getMultiSelection().size());
+ assertEquals(1, asList(tree2.getValue()).size());
+
+ yTree2.getMultiSelection().add("Haha");
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", yTree1.getMultiSelection().get(1));
+ // no sort order by vaadin -> Set
+ assertTrue(asList(tree1.getValue()).contains("Huhu"));
+ assertTrue(asList(tree1.getValue()).contains("Haha"));
+ assertEquals(2, yTree1.getMultiSelection().size());
+ assertEquals(2, asList(tree1.getValue()).size());
+ assertEquals("Huhu", yTree2.getMultiSelection().get(0));
+ assertEquals("Haha", yTree2.getMultiSelection().get(1));
+ // no sort order by vaadin -> Set
+ assertTrue(asList(tree2.getValue()).contains("Huhu"));
+ assertTrue(asList(tree2.getValue()).contains("Haha"));
+ assertEquals(2, yTree2.getMultiSelection().size());
+ assertEquals(2, asList(tree2.getValue()).size());
+
+ yTree1.getMultiSelection().remove("Huhu");
+ assertEquals("Haha", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+ assertEquals("Haha", yTree2.getMultiSelection().get(0));
+ assertEquals("Haha", asList(tree2.getValue()).get(0));
+ assertEquals(1, yTree2.getMultiSelection().size());
+ assertEquals(1, asList(tree2.getValue()).size());
+
+ // clear
+ yTree2.getMultiSelection().clear();
+ assertTrue(asList(tree1.getValue()).isEmpty());
+ assertTrue(yTree1.getMultiSelection().isEmpty());
+ assertTrue(asList(tree2.getValue()).isEmpty());
+ assertTrue(yTree2.getMultiSelection().isEmpty());
+
+ // test set selection null
+ List<String> selection = new ArrayList<String>();
+ selection.add("Huhu");
+ tree1.setValue(selection);
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(tree1.getValue()).get(0));
+ assertEquals(1, yTree1.getMultiSelection().size());
+ assertEquals(1, asList(tree1.getValue()).size());
+ assertEquals("Huhu", yTree2.getMultiSelection().get(0));
+ assertEquals("Huhu", asList(tree2.getValue()).get(0));
+ assertEquals(1, yTree2.getMultiSelection().size());
+ assertEquals(1, asList(tree2.getValue()).size());
+
+ selection.add("Haha");
+ tree2.setValue(selection);
+ assertEquals("Huhu", yTree1.getMultiSelection().get(0));
+ assertEquals("Haha", yTree1.getMultiSelection().get(1));
+ // no sort order by vaadin -> Set
+ assertTrue(asList(tree1.getValue()).contains("Huhu"));
+ assertTrue(asList(tree1.getValue()).contains("Haha"));
+ assertEquals(2, yTree1.getMultiSelection().size());
+ assertEquals(2, asList(tree1.getValue()).size());
+ assertEquals("Huhu", yTree2.getMultiSelection().get(0));
+ assertEquals("Haha", yTree2.getMultiSelection().get(1));
+ // no sort order by vaadin -> Set
+ assertTrue(asList(tree2.getValue()).contains("Huhu"));
+ assertTrue(asList(tree2.getValue()).contains("Haha"));
+ assertEquals(2, yTree2.getMultiSelection().size());
+ assertEquals(2, asList(tree2.getValue()).size());
+
+ tree2.setValue(new ArrayList<String>());
+ assertTrue(asList(tree2.getValue()).isEmpty());
+ assertTrue(yTree2.getMultiSelection().isEmpty());
+ assertTrue(asList(tree1.getValue()).isEmpty());
+ assertTrue(yTree1.getMultiSelection().isEmpty());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_ListToList() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+ YTree yTree2 = factory.createTree();
+ yTree2.setType(String.class);
+ yLayout.getElements().add(yTree2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ ITreeEditpart tree2Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree2);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> tree2Presentation = tree2Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+ Tree tree2 = (Tree) tree2Presentation.getWidget();
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+
+ // start tests
+ //
+
+ YEmbeddableCollectionEndpoint endp1 = yTree1.createCollectionEndpoint();
+ YEmbeddableCollectionEndpoint endp2 = yTree2.createCollectionEndpoint();
+ yBindingSet.addBinding(endp1, endp2);
+
+ YEmbeddableSelectionEndpoint endpSel1 = yTree1
+ .createSelectionEndpoint();
+ YEmbeddableSelectionEndpoint endpSel2 = yTree2
+ .createSelectionEndpoint();
+ yBindingSet.addBinding(endpSel1, endpSel2);
+
+ Container.Indexed container1 = (Indexed) tree1.getContainerDataSource();
+ Container.Indexed container2 = (Indexed) tree2.getContainerDataSource();
+ assertEquals(0, container1.size());
+ assertEquals(0, container2.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+
+ // add
+ yTree1.getCollection().add("Huhu");
+ yTree2.getCollection().add("Haha");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ // test set selection
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+ assertEquals("Huhu", yTree2.getSelection());
+ assertEquals("Huhu", tree2.getValue());
+
+ tree1.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ // test set selection null
+ tree1.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ tree1.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ tree2.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ tree2.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ yTree1.setSelection(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ tree2.setValue("Haha");
+ assertEquals("Haha", yTree1.getSelection());
+ assertEquals("Haha", tree1.getValue());
+ assertEquals("Haha", yTree2.getSelection());
+ assertEquals("Haha", tree2.getValue());
+
+ yTree2.setSelection(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+
+ // test remove element that is selected
+ // add
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", yTree2.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+ assertEquals("Huhu", tree2.getValue());
+
+ yTree1.getCollection().remove("Huhu");
+ assertNull(tree1.getValue());
+ assertNull(tree2.getValue());
+ assertNull(yTree1.getSelection());
+ assertNull(yTree2.getSelection());
+
+ // test remove element that is selected
+ // add
+ yTree2.getCollection().add("Huhu");
+ assertEquals(2, container1.size());
+ assertEquals(2, container2.size());
+
+ yTree1.setSelection("Huhu");
+ assertEquals("Huhu", yTree1.getSelection());
+ assertEquals("Huhu", tree1.getValue());
+ assertEquals("Huhu", yTree2.getSelection());
+ assertEquals("Huhu", tree2.getValue());
+
+ tree2.setValue(null);
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yTree2.getSelection());
+ assertNull(tree2.getValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToBean()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(Bar.class);
+ yLayout.getElements().add(yTree1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yTree1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setPropertyPath("myfoo.name");
+ yDetailEndpoint.setType(Bar.class);
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ Bar bar1 = new Bar();
+ bar1.setName("Bar1");
+ Foo foo1 = new Foo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ Bar bar2 = new Bar();
+ bar2.setName("Bar2");
+ Foo foo2 = new Foo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTree1.getCollection().add(bar1);
+ yTree1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yTree1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yTree1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yTree1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ tree1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ tree1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ tree1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ tree1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yTree1.getCollection().clear();
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ // test setValue to textfield
+ yTree1.getCollection().add(bar1);
+ yTree1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yTree1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yTree1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_SelectionBinding_Single_DetailBinding_ToEmf()
+ throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(EmfBar.class);
+ yTree1.setEmfNsURI(ModelPackage.eINSTANCE.getNsURI());
+ yLayout.getElements().add(yTree1);
+ YTextField yText = factory.createTextField();
+ yLayout.getElements().add(yText);
+
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ YDetailValueBindingEndpoint yDetailEndpoint = yTree1
+ .createSelectionEndpoint().createDetailValueEndpoint();
+ yDetailEndpoint.setType(EmfBar.class);
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfBar_Myfoo());
+ yDetailEndpoint.getFeatures().add(
+ ModelPackage.eINSTANCE.getEmfFoo_Name());
+ yBindingSet.addBinding(yText.createValueEndpoint(), yDetailEndpoint);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart tree1Editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> tree1Presentation = tree1Editpart
+ .getPresentation();
+ Tree tree1 = (Tree) tree1Presentation.getWidget();
+
+ ITextFieldEditpart textEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yText);
+ IWidgetPresentation<Component> textPresentation = textEditpart
+ .getPresentation();
+ TextField text = (TextField) textPresentation.getWidget();
+
+ // start tests
+ //
+ Container.Indexed container = (Indexed) tree1.getContainerDataSource();
+ assertEquals(0, container.size());
+
+ assertNull(tree1.getValue());
+ assertNull(yTree1.getSelection());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // add
+ EmfBar bar1 = ModelFactory.eINSTANCE.createEmfBar();
+ bar1.setName("Bar1");
+ EmfFoo foo1 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo1.setName("Foo1");
+ bar1.setMyfoo(foo1);
+
+ EmfBar bar2 = ModelFactory.eINSTANCE.createEmfBar();
+ bar2.setName("Bar2");
+ EmfFoo foo2 = ModelFactory.eINSTANCE.createEmfFoo();
+ foo2.setName("Foo2");
+ bar2.setMyfoo(foo2);
+
+ yTree1.getCollection().add(bar1);
+ yTree1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test set selection
+ yTree1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yTree1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ yTree1.setSelection(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ tree1.setValue(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ tree1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ // test set selection null
+ tree1.setValue(null);
+ assertNull(yText.getValue());
+ assertNull(text.getValue());
+
+ // test remove element that is selected
+ // add
+ tree1.setValue(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yTree1.getCollection().clear();
+
+ assertNull(yTree1.getSelection());
+ assertNull(tree1.getValue());
+
+ // test setValue to textfield
+ yTree1.getCollection().add(bar1);
+ yTree1.getCollection().add(bar2);
+ assertEquals(2, container.size());
+
+ yTree1.setSelection(bar2);
+ assertEquals("Foo2", yText.getValue());
+ assertEquals("Foo2", text.getValue());
+
+ yText.setValue("Foo2_1");
+ assertEquals("Foo2_1", foo2.getName());
+ assertEquals("Foo2_1", text.getValue());
+
+ text.setValue("Foo2_2");
+ assertEquals("Foo2_2", foo2.getName());
+ assertEquals("Foo2_2", yText.getValue());
+
+ yTree1.setSelection(bar1);
+ assertEquals("Foo1", yText.getValue());
+ assertEquals("Foo1", text.getValue());
+
+ yText.setValue("Foo1_1");
+ assertEquals("Foo1_1", foo1.getName());
+ assertEquals("Foo1_1", text.getValue());
+
+ text.setValue("Foo1_2");
+ assertEquals("Foo1_2", foo1.getName());
+ assertEquals("Foo1_2", yText.getValue());
+
+ }
+
+ @Test
+ public void test_i18n() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YGridLayout yGridlayout = factory.createGridLayout();
+ yView.setContent(yGridlayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yGridlayout.getElements().add(yTree1);
+
+ // set the i18n key
+ yTree1.setLabelI18nKey(I18nServiceForTests.KEY__AGE);
+
+ // prepare the I18nService and pass it to the renderer
+ Map<String, Object> parameter = new HashMap<String, Object>();
+ Map<String, Object> services = new HashMap<String, Object>();
+ parameter.put(IViewContext.PARAM_SERVICES, services);
+ services.put(II18nService.ID, new I18nServiceForTests());
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, parameter);
+ ITreeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ TreePresentation presentation = editpart.getPresentation();
+
+ assertEquals("Alter", presentation.getWidget().getCaption());
+
+ viewContext.setLocale(Locale.ENGLISH);
+ assertEquals("Age", presentation.getWidget().getCaption());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Tree tree1 = (Tree) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTree1.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTree1.isEditable());
+ assertFalse(!tree1.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTree1.isEditable());
+ assertTrue(!tree1.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Visible_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Tree tree1 = (Tree) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTree1.createVisibleEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTree1.isVisible());
+ assertFalse(tree1.isVisible());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTree1.isVisible());
+ assertTrue(tree1.isVisible());
+ assertTrue(bean.isBoolValue());
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Enabled_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YGridLayout yLayout = factory.createGridLayout();
+ yView.setContent(yLayout);
+ YTree yTree1 = factory.createTree();
+ yTree1.setType(String.class);
+ yLayout.getElements().add(yTree1);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ITreeEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTree1);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ Tree tree1 = (Tree) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet.addBinding(yTree1.createEnabledEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yTree1.isEnabled());
+ assertFalse(tree1.isEnabled());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yTree1.isEnabled());
+ assertTrue(tree1.isEnabled());
+ assertTrue(bean.isBoolValue());
+ }
+
+ private Collection<?> castCollection(Object value) {
+ return (Collection<?>) value;
+ }
+
+ private List<?> asList(Object value) {
+ return value != null ? new ArrayList<Object>(castCollection(value))
+ : new ArrayList<Object>();
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/VerticallLayoutPresentationTests.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/VerticallLayoutPresentationTests.java
new file mode 100644
index 0000000..c9b57ec
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/tests/presentation/VerticallLayoutPresentationTests.java
@@ -0,0 +1,583 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.presentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Locale;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBeanValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IVerticalLayoutEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.CheckBoxPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.TextFieldPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.VerticalLayoutPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ViewPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests.model.ValueBean;
+import org.osgi.framework.BundleException;
+import org.osgi.service.cm.ConfigurationException;
+
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Tests the {@link VerticalLayoutPresentation}.
+ */
+@SuppressWarnings("restriction")
+public class VerticallLayoutPresentationTests {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+ private CssLayout rootLayout = new CssLayout();
+
+ /**
+ * Setup tests.
+ *
+ * @throws ConfigurationException
+ * @throws BundleException
+ */
+ @Before
+ public void setup() throws ConfigurationException, BundleException {
+ UI.setCurrent(new DefaultUI());
+ UI.getCurrent().setContent(rootLayout);
+ }
+
+ /**
+ * Tests rendering issues.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_isRendered_unrender_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ VerticalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ yView.setContent(null);
+ assertTrue(layoutEP.isDisposed());
+ assertTrue(checkBoxEP.isDisposed());
+ assertTrue(textEP.isDisposed());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ yView.setContent(yLayout);
+
+ layoutEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext,yLayout);
+ checkBoxEP = DelegatingEditPartManager.getInstance().getEditpart(viewContext,
+ yCheckBox);
+ textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ assertTrue(layoutEP.isRendered());
+ assertTrue(textEP.isRendered());
+ assertTrue(checkBoxEP.isRendered());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_removeField_AddAndInsert_byModel() throws Exception {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ VerticalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ VerticalLayout layout = (VerticalLayout) layoutPres.getWidget();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertTrue(textPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.removeElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ yLayout.addElement(yCheckBox);
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ yLayout.moveElement(0, yCheckBox);
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ Assert.assertSame(checkBoxPres.getWidget(), layout.getComponent(0));
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(1));
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ /**
+ * Tests the internal structure.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yView.setContent(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBoxEditpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yCheckBox);
+ IWidgetPresentation<Component> presentation = checkBoxEditpart
+ .getPresentation();
+
+ CheckBox checkBox = (CheckBox) presentation.getWidget();
+ assertNotNull(checkBox);
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_InternalStructure__CSS() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox1 = factory.createCheckBox();
+ yCheckBox1.setCssID("ID_0815");
+ yCheckBox1.setCssClass("anyOtherClass");
+ yLayout.getElements().add(yCheckBox1);
+ YCheckBox yCheckBox2 = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox2);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart checkBox1Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yCheckBox1);
+ ICheckboxEditpart checkBox2Editpart = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yCheckBox2);
+ IWidgetPresentation<Component> checkBox1Presentation = checkBox1Editpart
+ .getPresentation();
+ IWidgetPresentation<Component> checkBox2Presentation = checkBox2Editpart
+ .getPresentation();
+
+ CheckBox checkBox1 = (CheckBox) checkBox1Presentation.getWidget();
+ CheckBox checkBox2 = (CheckBox) checkBox2Presentation.getWidget();
+
+ // assert css class
+ assertTrue(checkBox1.getStyleName().contains("anyOtherClass"));
+ assertTrue(checkBox2.getStyleName().contains(
+ AbstractVaadinWidgetPresenter.CSS_CLASS_CONTROL));
+
+ // assert css id
+ assertEquals("ID_0815", checkBox1.getId());
+ assertEquals(checkBox2Editpart.getId(), checkBox2.getId());
+ }
+
+ /**
+ * Test the internal structure based on CSS.
+ *
+ * @throws Exception
+ */
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Bindings() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ // ...> yView
+ // ......> yText
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ VerticalLayout layout = (VerticalLayout) layoutEP.getPresentation()
+ .getWidget();
+
+ // start tests
+ //
+ assertTrue(layout.isVisible());
+ assertTrue(layout.isEnabled());
+ assertFalse(layout.isReadOnly());
+
+ yLayout.setVisible(false);
+ assertFalse(layout.isVisible());
+
+ }
+
+ @Test
+ public void test_Dispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ VerticalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ @Test
+ public void test_ContextDispose() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IViewEditpart viewEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yView);
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ ViewPresentation viewPres = viewEP.getPresentation();
+ VerticalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ viewContext.dispose();
+ assertFalse(viewPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(viewEP.isDisposed());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+
+ Assert.assertNotNull(yView.getContent());
+ assertEquals(2, yLayout.getElements().size());
+ }
+
+ /**
+ * Test the automatic disposal of bindings
+ *
+ * @throws ContextException
+ */
+ @Test
+ public void testBindingIsDisposed() throws ContextException {
+ // test that the binding is disposed if field is disposed
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ IWidgetPresentation<Component> presentation = layoutEP
+ .getPresentation();
+ assertTrue(presentation.isRendered());
+ assertFalse(presentation.isDisposed());
+ assertEquals(3, presentation.getUIBindings().size());
+
+ presentation.dispose();
+ assertFalse(presentation.isRendered());
+ assertTrue(presentation.isDisposed());
+ assertEquals(0, presentation.getUIBindings().size());
+ }
+
+ @Test
+ public void test_isRendered_unrender_byEditpart() throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ VerticalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ ComponentContainer widget = layoutPres.getWidget();
+ Assert.assertNotNull(widget.getParent());
+ layoutEP.requestUnrender();
+ Assert.assertNull(widget.getParent());
+
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertFalse(layoutPres.isDisposed());
+ assertFalse(textPres.isDisposed());
+ assertFalse(checkBoxPres.isDisposed());
+
+ layoutEP.requestDispose();
+ assertFalse(layoutPres.isRendered());
+ assertFalse(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+ assertTrue(layoutPres.isDisposed());
+ assertTrue(textPres.isDisposed());
+ assertTrue(checkBoxPres.isDisposed());
+ }
+
+ @Test
+ public void test_isRendered_unrender_Child_byEditpart()
+ throws ContextException {
+
+ // switch the global locale to german
+ Locale.setDefault(Locale.GERMAN);
+
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+ YTextField yTextField = factory.createTextField();
+ yLayout.getElements().add(yTextField);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+ IVerticalLayoutEditpart layoutEP = DelegatingEditPartManager
+ .getInstance().getEditpart(viewContext,yLayout);
+ ICheckboxEditpart checkBoxEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ ITextFieldEditpart textEP = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yTextField);
+ VerticalLayoutPresentation layoutPres = layoutEP.getPresentation();
+ CheckBoxPresentation checkBoxPres = checkBoxEP.getPresentation();
+ TextFieldPresentation textPres = textEP.getPresentation();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+
+ checkBoxEP.requestUnrender();
+
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertFalse(checkBoxPres.isRendered());
+
+ VerticalLayout layout = (VerticalLayout) layoutPres.getWidget();
+ Assert.assertSame(textPres.getWidget(), layout.getComponent(0));
+ assertEquals(1, layout.getComponentCount());
+
+ checkBoxEP.requestRender();
+ assertTrue(layoutPres.isRendered());
+ assertTrue(textPres.isRendered());
+ assertTrue(checkBoxPres.isRendered());
+ assertEquals(2, layout.getComponentCount());
+
+ }
+
+ @Test
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void test_Readonly_Binding() throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ // build the view model
+ YView yView = factory.createView();
+ YVerticalLayout yLayout = factory.createVerticalLayout();
+ yView.setContent(yLayout);
+ YCheckBox yCheckBox = factory.createCheckBox();
+ yLayout.getElements().add(yCheckBox);
+
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext viewContext = renderer.render(rootLayout, yView, null);
+
+ ICheckboxEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext,yCheckBox);
+ IWidgetPresentation<Component> presentation = editpart
+ .getPresentation();
+ CheckBox box = (CheckBox) presentation.getWidget();
+
+ ValueBean bean = new ValueBean(false);
+ YBeanValueBindingEndpoint yBeanBinding = factory
+ .createBeanBindingEndpoint();
+ yBeanBinding.setBean(bean);
+ yBeanBinding.setPropertyPath("boolValue");
+ YBindingSet yBindingSet = yView.getOrCreateBindingSet();
+ yBindingSet
+ .addBinding(yCheckBox.createEditableEndpoint(), yBeanBinding);
+
+ // test binding
+ assertFalse(yCheckBox.isEditable());
+ assertFalse(!box.isReadOnly());
+ assertFalse(bean.isBoolValue());
+
+ bean.setBoolValue(true);
+ assertTrue(yCheckBox.isEditable());
+ assertTrue(!box.isReadOnly());
+ assertTrue(bean.isBoolValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project
new file mode 100644
index 0000000..a635bf8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/LICENSE.txt b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..877cb86
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/META-INF/MANIFEST.MF
@@ -0,0 +1,59 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin
+Bundle-Vendor: Eclipse OSBP
+Bundle-Version: 0.9.0.qualifier
+Require-Bundle: org.eclipse.osbp.ecview.core.extension.editparts;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ org.eclipse.osbp.ecview.core.extension.model;bundle-version="[0.9.0,0.10.0)";visibility:=reexport,
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)";visibility:=reexport,
+ com.vaadin.client;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.core.databinding;bundle-version="[1.4.2,1.5.0)",
+ org.eclipse.core.databinding.property;bundle-version="[1.4.200,1.5.0)",
+ org.eclipse.core.databinding.beans;bundle-version="[1.2.200,1.5.0)",
+ org.eclipse.emf.databinding;bundle-version="[1.3.0,1.4.0)",
+ org.eclipse.osbp.runtime.web.vaadin.components;bundle-version="[0.9.0,0.10.0)",
+ com.ibm.icu;bundle-version="50.1.1",
+ org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)",
+ com.google.guava;bundle-version="[10.0.0,19.0.0)",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.emf.api;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)",
+ org.jsoup;bundle-version="1.7.2",
+ org.eclipse.osbp.vaadin.addons.absolutelayout;bundle-version="0.9.0",
+ dragdroplayouts.osgi;bundle-version="1.1.3",
+ org.eclipse.osbp.vaadin.addons.suggesttext;bundle-version="0.9.0",
+ org.eclipse.osbp.runtime.designer.api;bundle-version="[0.9.0,0.10.0)",
+ org.apache.commons.lang3;bundle-version="3.4.0",
+ org.eclipse.osbp.ui.api
+Import-Package: org.osgi.framework;version="1.7.0",
+ org.slf4j;version="1.6.4"
+Export-Package: org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;
+ uses:="com.vaadin.data,
+ org.eclipse.osbp.ecview.core.common.presentation,
+ org.eclipse.core.databinding,
+ org.eclipse.osbp.ecview.core.common.binding,
+ org.eclipse.osbp.ecview.core.common.editpart,
+ org.eclipse.osbp.ecview.core.common.context,
+ org.osgi.framework,
+ org.eclipse.osbp.ecview.core.common.model.core,
+ com.vaadin.ui";version="0.9.0",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;version="0.9.0",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;x-internal:=true;version="0.9.0",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding;x-internal:=true;version="0.9.0",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util;
+ uses:="org.eclipse.osbp.ecview.core.common.model.visibility,
+ org.eclipse.osbp.ecview.core.common.context,
+ org.eclipse.osbp.ecview.core.common.visibility,
+ com.vaadin.ui";version="0.9.0"
+Service-Component: OSGI-INF/*.xml
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+OSBP-ECView-I18nProvider:
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml
new file mode 100644
index 0000000..60f1463
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/presentationFactory.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.factory">
+ <implementation class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.PresenterFactory"/>
+ <service>
+ <provide interface="org.eclipse.osbp.ecview.core.common.presentation.IPresentationFactory"/>
+ </service>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml
new file mode 100644
index 0000000..0b681e9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/OSGI-INF/serviceProvider.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.service.provider">
+ <implementation class="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding.BindingManagerProvider"/>
+ <service>
+ <provide interface="org.eclipse.osbp.ecview.core.common.services.IServiceProvider"/>
+ </service>
+ <property name="ecview.serviceprovider.level" type="String" value="view"/>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.html b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.ini b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.mappings b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.properties
new file mode 100644
index 0000000..f30ea95
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.ecview.presentation.vaadin
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/build.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/build.properties
new file mode 100644
index 0000000..5a6147d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/build.properties
@@ -0,0 +1,11 @@
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ OSGI-INF/,\
+ i18n/,\
+ .project,\
+ .classpath,\
+ .settings/,\
+ LICENSE.txt
+output.. = target/classes
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/i18n/translations.properties b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/i18n/translations.properties
new file mode 100644
index 0000000..dbeeb02
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/i18n/translations.properties
@@ -0,0 +1,17 @@
+org.eclipse.osbp.ecview.core.common.i18n.TextSearchFieldTooltip=Following wildcards are supported: <br>\
+ <ul>\
+ <li>Any: <b><i>"*ABC*"</i></b> </li>\
+ <li>Greater then: <b><i>"> ABC"</i></b></li>\
+ <li>Lower then: <b><i>"< ABC"</i></b></li>\
+ <li>Greater equals: <b><i>">= ABC"</i></b></li>\
+ <li>Lower equals: <b><i>"<= ABC"</i></b></li>\
+ <li>Not equals: <b><i>"!= ABC"</i></b></li>\
+ </ul>
+org.eclipse.osbp.ecview.core.common.i18n.NumberSearchFieldTooltip=Following wildcards are supported: <br>\
+ <ul>\
+ <li>Greater then: <b><i>"> 10"</i></b></li>\
+ <li>Lower then: <b><i>"< 10"</i></b></li>\
+ <li>Greater equals: <b><i>">= 10"</i></b></li>\
+ <li>Lower equals: <b><i>"<= 10"</i></b></li>\
+ <li>Not equals: <b><i>"!= 10"</i></b></li>\
+ </ul>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/pom.xml b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/pom.xml
new file mode 100644
index 0000000..8b667d1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <description>A presentation layer for the ECView model based UI.</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/Activator.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/Activator.java
new file mode 100644
index 0000000..9fbbdaf
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/Activator.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Activator of the bundle.
+ */
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ /**
+ * Returns the context.
+ *
+ * @return context
+ */
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void start(BundleContext bundleContext) throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ Activator.context = bundleContext;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ public void stop(BundleContext bundleContext) throws Exception {
+ // END SUPRESS CATCH EXCEPTION
+ Activator.context = null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IBindingManager.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IBindingManager.java
new file mode 100644
index 0000000..a2f44dc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IBindingManager.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.osbp.ecview.core.common.model.core.YEditable;
+import org.eclipse.osbp.ecview.core.common.model.core.YEnable;
+import org.eclipse.osbp.ecview.core.common.model.core.YVisibleable;
+
+import com.vaadin.data.Property;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A manager that is responsible for binding data for one view instance. Each
+ * binding manager has to be connected to exactly one view. All the bindings
+ * contained are bindings related to the associated view.
+ */
+public interface IBindingManager extends
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager {
+
+ /**
+ * Binds the visible option.
+ *
+ * @param yVisibleAble
+ * the y visible able
+ * @param abstractComponent
+ * the abstract component
+ * @return Binding - the created binding
+ */
+ public abstract Binding bindVisible(YVisibleable yVisibleAble,
+ AbstractComponent abstractComponent);
+
+ /**
+ * Binds the visible option.
+ *
+ * @param yEnable
+ * the y enable
+ * @param abstractComponent
+ * the abstract component
+ * @return Binding - the created binding
+ */
+ public abstract Binding bindEnabled(YEnable yEnable,
+ AbstractComponent abstractComponent);
+
+ /**
+ * Binds the readonly option.
+ *
+ * @param yEditable
+ * the y editable
+ * @param field
+ * the field
+ * @return Binding - the created binding
+ */
+ public abstract Binding bindReadonly(YEditable yEditable,
+ Property.ReadOnlyStatusChangeNotifier field);
+
+ /**
+ * Binds the readonly option. No notification for readonly state will be
+ * send from the ui element. To receive noticiations use
+ * {@link IBindingManager#bindReadonly(YEditable, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier)}
+ *
+ * @param yEditable
+ * the y editable
+ * @param field
+ * the field
+ * @return Binding - the created binding
+ */
+ public abstract Binding bindReadonlyOneway(YEditable yEditable,
+ Component field);
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IConstants.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IConstants.java
new file mode 100644
index 0000000..ee991af
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/IConstants.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;
+
+/**
+ * Constants about the swt simple presentation.
+ */
+// BEGIN SUPRESS CATCH EXCEPTION
+public interface IConstants {
+ // END SUPRESS CATCH EXCEPTION
+
+ /**
+ * This CSS class is applied to the most top layout of any YView model
+ * element. There is an UI-Kit specific way to access the underlying YView.
+ */
+ String CSS_CLASS_YVIEW_PROVIDER = "l-yview-provider";
+
+ /**
+ * This CSS class is applied to the base composite of presentations. The
+ * base composite is used to enable margins on a control and to allow a
+ * control to rebuild its SWT controls at the "base composite parent".
+ */
+ String CSS_CLASS_CONTROL_BASE = "l-controlbase";
+
+ /**
+ * This CSS class is applied to the control of a presentation as far as the
+ * model element does not specify its own CSS class.
+ */
+ public static final String CSS_CLASS_CONTROL = "l-control";
+
+ /**
+ * This CSS class is applied to searchfields of a presentation as far as the
+ * model element does not specify its own CSS class.
+ */
+ public static final String CSS_CLASS_SEARCHFIELD = "l-searchfield";
+
+ /**
+ * This CSS class marks the widget to show a margin.
+ */
+ public static final String CSS_CLASS_MARGIN = "margin";
+
+ /**
+ * This CSS class marks the widget to show a spacing.
+ */
+ public static final String CSS_CLASS_SPACING = "spacing";
+
+ /**
+ * This CSS class for master-detail master-base component.
+ */
+ String CSS_CLASS_MASTER_BASE = "l-masterbase";
+
+ /**
+ * This CSS class for master-detail detail-base component.
+ */
+ String CSS_CLASS_DETAIL_BASE = "l-detailbase";
+
+ /**
+ * This CSS class is used to mark the compressor element. Compressor
+ * elements are used to avoid elements from grapping access space during
+ * window size changes.
+ */
+ String CSS_CLASS_COMPRESSOR = "l-layout-compressor";
+
+ // css classes for the different layouts
+ String CSS_CLASS_FORMLAYOUT = "l-formlayout";
+ String CSS_CLASS_GRIDLAYOUT = "l-gridlayout";
+ String CSS_CLASS_CSSLAYOUT = "l-csslayout";
+ String CSS_CLASS_VERTICALLAYOUT = "l-verticallayout";
+ String CSS_CLASS_HORIZONTALLAYOUT = "l-horizontallayout";
+
+ String I18N_TOOLTIP_TEXTSEARCHFIELD = "org.eclipse.osbp.ecview.core.common.i18n.TextSearchFieldTooltip";
+ String I18N_TOOLTIP_BOOLEANSEARCHFIELD = "org.eclipse.osbp.ecview.core.common.i18n.BooleanSearchFieldTooltip";
+ String I18N_TOOLTIP_NUMBERSEARCHFIELD = "org.eclipse.osbp.ecview.core.common.i18n.NumberSearchFieldTooltip";
+ String I18N_TOOLTIP_REFERENCESEARCHFIELD = "org.eclipse.osbp.ecview.core.common.i18n.ReferenceSearchFieldTooltip";
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/VaadinRenderer.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/VaadinRenderer.java
new file mode 100644
index 0000000..a2b2130
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/VaadinRenderer.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;
+
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.context.ViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.DelegatingEditPartManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IRenderer;
+
+import com.vaadin.ui.Component;
+
+/**
+ * A special implementation for ECP that offers convenience methods.
+ */
+public class VaadinRenderer implements IRenderer {
+
+ /**
+ * URI specifying the simple SWT presentation.
+ */
+ public static final String UI_KIT_URI = "http://osbp.eclipse.org/ecview/v1/presentation/vaadin";
+
+ /**
+ * Renders the UI for the given componentContainer and UI model.
+ *
+ * @param componentContainer
+ * The componentContainer the should be the parent for the
+ * rendered UI
+ * @param yView
+ * The view model.
+ * @param options
+ * rendering options
+ * @return viewContext - the rendered view context
+ * @throws ContextException
+ * e
+ */
+ public IViewContext render(Object componentContainer, YView yView,
+ Map<String, Object> options) throws ContextException {
+
+ if (!(componentContainer instanceof Component)) {
+ throw new ContextException("componentContainer is not a Component");
+ }
+
+ ViewContext viewContext = new ViewContext();
+
+ IViewEditpart editpart = DelegatingEditPartManager.getInstance()
+ .getEditpart(viewContext, yView);
+ viewContext.setViewEditpart(editpart);
+ render(viewContext, componentContainer, options);
+ return viewContext;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void render(IViewContext viewContext, Object componentContainer,
+ Map<String, Object> options) throws ContextException {
+ viewContext.render(UI_KIT_URI, componentContainer, options);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractEmbeddedWidgetPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractEmbeddedWidgetPresenter.java
new file mode 100644
index 0000000..2337a23
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractEmbeddedWidgetPresenter.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.runtime.common.validation.IStatus;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Embedded;
+
+/**
+ * An abstract implementation of the {@link IWidgetPresentation}. Special for
+ * {@link Embedded} vaadin elements.
+ */
+public abstract class AbstractEmbeddedWidgetPresenter<A extends Component>
+ extends AbstractVaadinWidgetPresenter<A> implements
+ IWidgetPresentation<A> {
+
+ public AbstractEmbeddedWidgetPresenter(IEmbeddableEditpart editpart) {
+ super(editpart);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java
new file mode 100644
index 0000000..60cafd5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractFieldWidgetPresenter.java
@@ -0,0 +1,371 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YField;
+import org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation;
+import org.eclipse.osbp.ecview.core.common.validation.IFieldValidationManager;
+import org.eclipse.osbp.ecview.core.common.validation.IValidator;
+import org.eclipse.osbp.runtime.common.validation.IStatus;
+import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.ValidatorAdapter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.validator.ExternalStatusAwareValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Validator;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An abstract implementation of the {@link IFieldPresentation}.
+ *
+ * @param <A>
+ * the generic type
+ */
+public abstract class AbstractFieldWidgetPresenter<A extends Component> extends
+ AbstractVaadinWidgetPresenter<A> implements IFieldPresentation<A>,
+ IDesignListener {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(AbstractFieldWidgetPresenter.class);
+
+ /** The validators. */
+ private Map<IValidator, ValidatorAdapter> validators;
+
+ /** The external status validator. */
+ private ExternalStatusAwareValidator externalStatusValidator;
+
+ /** The converter. */
+ private Converter<?, ?> converter;
+
+ /**
+ * Instantiates a new abstract field widget presenter.
+ *
+ * @param editpart
+ * the editpart
+ */
+ public AbstractFieldWidgetPresenter(IEmbeddableEditpart editpart) {
+ super(editpart);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation#addValidator(org.eclipse.osbp.ecview.core.common.validation.IValidator)
+ */
+ @Override
+ public void addValidator(IValidator validator) {
+ if (validators == null) {
+ validators = new HashMap<IValidator, ValidatorAdapter>(2);
+ }
+
+ if (!validators.containsKey(validator)) {
+ validators.put(validator, new ValidatorAdapter(validator));
+ }
+
+ doUpdateValidator(new Event(Event.ADD, validators.get(validator)));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation#removeValidator(org.eclipse.osbp.ecview.core.common.validation.IValidator)
+ */
+ @Override
+ public void removeValidator(IValidator validator) {
+ if (validators == null) {
+ return;
+ }
+
+ ValidatorAdapter adapter = validators.remove(validator);
+ if (adapter != null) {
+ doUpdateValidator(new Event(Event.REMOVE, adapter));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation#setConverter(java.lang.Object)
+ */
+ @Override
+ public void setConverter(Object object) {
+ if (object instanceof Converter) {
+ converter = (Converter<?, ?>) object;
+ doUpdateConverter(converter);
+ } else if (object == null) {
+ converter = getDefaultConverter();
+ doUpdateConverter(converter);
+ } else {
+ LOGGER.error("Converter is not a valid Vaadin converter! " + object);
+ }
+ }
+
+ /**
+ * Gets the converter.
+ *
+ * @return the converter
+ */
+ @SuppressWarnings("rawtypes")
+ protected Converter getConverter() {
+ if (converter == null) {
+ // fallback if converter could not be initialized eager
+ converter = getDefaultConverter();
+ }
+ return converter;
+ }
+
+ /**
+ * Returns a proper default converter that is used instead of
+ * <code>null</code>.
+ *
+ * @return the default converter
+ */
+ protected Converter<?, ?> getDefaultConverter() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#getCastedModel()
+ */
+ protected YField getCastedModel() {
+ return (YField) getModel();
+ }
+
+ /**
+ * Needs to set the converter to the field.
+ *
+ * @param converter
+ * the converter
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected void doUpdateConverter(Converter converter) {
+ if (doGetField() != null) {
+ AbstractField<?> field = (AbstractField<?>) doGetField();
+ field.setConverter(converter);
+ }
+ }
+
+ /**
+ * Gets the validators.
+ *
+ * @return the validators
+ */
+ public Map<IValidator, ValidatorAdapter> getValidators() {
+ return validators != null ? java.util.Collections
+ .unmodifiableMap(validators) : Collections
+ .<IValidator, ValidatorAdapter> emptyMap();
+ }
+
+ /**
+ * Should be implemented by subclasses to update their validator.
+ *
+ * @param event
+ * - the event
+ */
+ protected void doUpdateValidator(Event event) {
+ Field<?> field = doGetField();
+ if (field != null) {
+ switch (event.getType()) {
+ case Event.ADD:
+ field.addValidator((Validator) event.getValidator());
+ break;
+ case Event.REMOVE:
+ field.removeValidator((Validator) event.getValidator());
+ break;
+ }
+ }
+ }
+
+ /**
+ * Is called by subclasses to attach all available validators at the given
+ * field.
+ *
+ * @param field
+ * - the field all validators should be added to
+ */
+ protected void attachValidators(Field<?> field) {
+ if (validators == null) {
+ return;
+ }
+
+ for (Validator validator : validators.values()) {
+ field.addValidator(validator);
+ }
+ }
+
+ /**
+ * Is called by subclasses to detach all validators that are registered at
+ * this instance.
+ *
+ * @param field
+ * - the field all validators should be added to
+ */
+ protected void detachValidators(Field<?> field) {
+ if (validators == null) {
+ return;
+ }
+
+ for (Validator validator : validators.values()) {
+ field.removeValidator(validator);
+ }
+ }
+
+ /**
+ * Returns the field of the current presentation. May return
+ * <code>null</code>. Should be implemented by sub classes.
+ *
+ * @return the field
+ */
+ protected abstract Field<?> doGetField();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#notify(org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent)
+ */
+ @Override
+ public void notify(DesignEvent event) {
+ super.notify(event);
+
+ IWidgetDesignConfigurator service = getViewContext().getService(
+ IWidgetDesignConfigurator.class.getName());
+ if (service != null) {
+ if (event.getType() == EventType.ENABLED) {
+ service.configure(getWidget(), getCastedModel(), true);
+ } else {
+ service.configure(getWidget(), getCastedModel(), false);
+ }
+ }
+ }
+
+ /**
+ * Called by subclasses to initialize the field with validators, tabindex
+ * and more general stuff.
+ *
+ * @param field
+ * - the field to be initialized.
+ */
+ @SuppressWarnings("unchecked")
+ protected void initializeField(Field<?> field) {
+ attachValidators(field);
+
+ // initialize the converter if not set before
+ if (field instanceof AbstractField) {
+ AbstractField<?> casted = (AbstractField<?>) field;
+ if (casted.getConverter() == null) {
+ casted.setConverter(getConverter());
+ }
+ }
+
+ super.initialize(field, getCastedModel());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation#addExternalStatus(org.eclipse.osbp.runtime.common.validation.IStatus)
+ */
+ @Override
+ public void addExternalStatus(IStatus status) {
+ if (externalStatusValidator == null) {
+ externalStatusValidator = new ExternalStatusAwareValidator();
+ addValidator(externalStatusValidator);
+ }
+
+ externalStatusValidator.addStatus(status);
+
+ if (doGetField() != null) {
+ doGetField().markAsDirty();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation#removeExternalStatus(org.eclipse.osbp.runtime.common.validation.IStatus)
+ */
+ @Override
+ public void removeExternalStatus(IStatus status) {
+ if (externalStatusValidator != null) {
+ externalStatusValidator.removeStatus(status);
+
+ if (doGetField() != null) {
+ doGetField().markAsDirty();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IFieldPresentation#resetExternalStatus()
+ */
+ @Override
+ public void resetExternalStatus() {
+ if (externalStatusValidator != null) {
+ externalStatusValidator.reset();
+
+ if (doGetField() != null) {
+ doGetField().markAsDirty();
+ }
+ }
+ }
+
+ /**
+ * Reports the validation error to the IFieldValidationManager.
+ *
+ * @param message
+ * the message
+ */
+ protected void reportValidationError(ErrorMessage message) {
+ // error message is only used as a fallback for later
+
+ IFieldValidationManager service = getViewContext().getService(
+ IFieldValidationManager.class.getName());
+ if (service != null) {
+ // reset all status
+ service.registerResult(getModel(),
+ Collections.<IStatus> emptyList());
+
+ if (validators != null) {
+ List<IStatus> statuses = new ArrayList<IStatus>();
+ for (IValidator validator : validators.keySet()) {
+ // do not pass status from the externalStatusValidator to
+ // the listeners.
+ // they have been added from there. So there is no need.
+ if (validator != externalStatusValidator) {
+ statuses.addAll(validator.getCurrentStatus());
+ }
+ }
+ service.registerResult(getModel(), statuses);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ if (externalStatusValidator != null) {
+ externalStatusValidator.dispose();
+ externalStatusValidator = null;
+ }
+
+ converter = null;
+
+ super.internalDispose();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java
new file mode 100644
index 0000000..f426453
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractLayoutPresenter.java
@@ -0,0 +1,371 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.osbp.ecview.core.common.dnd.IDropTargetStrategy;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.core.YLayout;
+import org.eclipse.osbp.ecview.core.common.model.core.YMarginable;
+import org.eclipse.osbp.ecview.core.common.model.core.YSpacingable;
+import org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation;
+import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Layout.MarginHandler;
+import com.vaadin.ui.Layout.SpacingHandler;
+
+import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode;
+import fi.jasoft.dragdroplayouts.interfaces.DragFilter;
+import fi.jasoft.dragdroplayouts.interfaces.LayoutDragSource;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An abstract base class implementing {@link ILayoutPresentation}.
+ *
+ * @param <A>
+ * the generic type
+ */
+public abstract class AbstractLayoutPresenter<A extends Component> extends
+ AbstractVaadinWidgetPresenter<A> implements ILayoutPresentation<A>,
+ IDesignListener {
+
+ /** The children. */
+ private List<IEmbeddableEditpart> children;
+
+ /** The render lock. */
+ private boolean renderLock;
+
+ /**
+ * Instantiates a new abstract layout presenter.
+ *
+ * @param editpart
+ * the editpart
+ */
+ public AbstractLayoutPresenter(ILayoutEditpart editpart) {
+ super(editpart);
+ }
+
+ /**
+ * Returns the editpart the presenter will render for.
+ *
+ * @return the editpart
+ */
+ protected ILayoutEditpart getEditpart() {
+ return (ILayoutEditpart) super.getEditpart();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#getModel()
+ */
+ @Override
+ public YLayout getModel() {
+ return (YLayout) getEditpart().getModel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#getChildren()
+ */
+ @Override
+ public List<IEmbeddableEditpart> getChildren() {
+ return children != null ? Collections.unmodifiableList(children)
+ : Collections.<IEmbeddableEditpart> emptyList();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#contains(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public boolean contains(IEmbeddableEditpart presentation) {
+ return children != null && children.contains(presentation);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#add(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void add(IEmbeddableEditpart editPart) {
+ ensureChildren();
+
+ if (!children.contains(editPart)) {
+ children.add(editPart);
+
+ if (!renderLock) {
+ internalAdd(editPart);
+ }
+ }
+ }
+
+ /**
+ * This method is called after the editpart was successfully added to the
+ * children collection.<br>
+ * Subclasses should handle the add of the UI element in that method.
+ *
+ * @param presentation
+ * the presentation
+ */
+ protected void internalAdd(IEmbeddableEditpart presentation) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#remove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void remove(IEmbeddableEditpart editPart) {
+ if (children == null) {
+ return;
+ }
+
+ if (children.remove(editPart) && !renderLock) {
+ internalRemove(editPart);
+ }
+ }
+
+ /**
+ * This method is called after the editpart was successfully removed from
+ * the children collection.<br>
+ * Subclasses should handle the removal of the UI element in that method.
+ *
+ * @param presentation
+ * The presentation to be removed
+ */
+ protected void internalRemove(IEmbeddableEditpart presentation) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#insert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ public void insert(IEmbeddableEditpart editPart, int index) {
+ ensureChildren();
+
+ int currentIndex = children.indexOf(editPart);
+ if (currentIndex > -1 && currentIndex != index) {
+ throw new RuntimeException(
+ String.format(
+ "Insert at index %d not possible since presentation already contained at index %d",
+ index, currentIndex));
+ }
+
+ children.add(index, editPart);
+
+ if (!renderLock) {
+ internalInsert(editPart, index);
+ }
+ }
+
+ /**
+ * This method is called after the editpart was successfully inserted to the
+ * children collection.<br>
+ * Subclasses should handle the insert of the UI element in that method.
+ *
+ * @param editpart
+ * The editpart to be inserted
+ * @param index
+ * The index where the editpart should be inserted
+ */
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#move(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ public void move(IEmbeddableEditpart editpart, int index) {
+ if (children == null) {
+ throw new RuntimeException(
+ "Move not possible. No children present.");
+ }
+
+ if (!children.contains(editpart)) {
+ throw new RuntimeException(
+ String.format(
+ "Move to index %d not possible since presentation not added yet!",
+ index));
+ }
+
+ int currentIndex = children.indexOf(editpart);
+ children.remove(editpart);
+ children.add(index, editpart);
+
+ if (!renderLock) {
+ internalMove(editpart, currentIndex, index);
+ }
+ }
+
+ /**
+ * This method is called after the presentation was successfully moved
+ * inside the children collection.<br>
+ * Subclasses should handle the move of the UI element in that method.
+ *
+ * @param presentation
+ * The presentation to be moved.
+ * @param oldIndex
+ * The old index where the control was located.
+ * @param newIndex
+ * The new index where the control should be located after the
+ * move operation.
+ */
+ protected void internalMove(IEmbeddableEditpart presentation, int oldIndex,
+ int newIndex) {
+
+ }
+
+ /**
+ * Returns true, if rendering should not be done.
+ *
+ * @return true, if is render lock
+ */
+ public boolean isRenderLock() {
+ return renderLock;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#updateCellStyle(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable)
+ */
+ @Override
+ public void updateCellStyle(YEmbeddable child) {
+ // can be overridden by sub classes
+ }
+
+ /**
+ * True, if rendering should not be done.
+ *
+ * @param renderLock
+ * the new render lock
+ */
+ public void setRenderLock(boolean renderLock) {
+ this.renderLock = renderLock;
+ }
+
+ /**
+ * Ensures, that the children collection exists.
+ */
+ protected void ensureChildren() {
+ if (children == null) {
+ children = new ArrayList<IEmbeddableEditpart>();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#notify(org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent)
+ */
+ @Override
+ public void notify(DesignEvent event) {
+ super.notify(event);
+
+ if (getWidget() != null && getWidget() instanceof LayoutDragSource) {
+ LayoutDragSource dragSource = (LayoutDragSource) getWidget();
+ if (event.getType() == EventType.ENABLED) {
+ dragSource.setDragMode(getDragMode());
+ dragSource.setDragFilter(DragFilter.ALL);
+ } else {
+ dragSource.setDragMode(LayoutDragMode.NONE);
+ dragSource.setDragFilter(DragFilter.NONE);
+ }
+ }
+
+ IWidgetDesignConfigurator service = getViewContext().getService(
+ IWidgetDesignConfigurator.class.getName());
+ if (service != null) {
+ if (event.getType() == EventType.ENABLED) {
+ service.configure(getWidget(), (YEmbeddable) getCastedModel(),
+ true);
+ } else {
+ service.configure(getWidget(), (YEmbeddable) getCastedModel(),
+ false);
+ }
+ }
+ }
+
+ /**
+ * Is called to initialize the newly created component.
+ *
+ * @param component
+ * the component
+ * @param model
+ * the model
+ */
+ protected void setupComponent(Component component, YElement model) {
+ super.setupComponent(component, model);
+
+ if (component instanceof LayoutDragSource) {
+ LayoutDragSource source = (LayoutDragSource) component;
+ LayoutDragMode mode = getDragMode();
+ source.setDragMode(getDragMode());
+ if (mode == LayoutDragMode.NONE) {
+ source.setDragFilter(DragFilter.NONE);
+ } else {
+ source.setDragFilter(DragFilter.ALL);
+ }
+ }
+
+ setupDropTarget(component, (YLayout) model);
+ }
+
+ /**
+ * Creates a UI-Kit specific drop handler for the component.
+ *
+ * @param component
+ * the component
+ * @param yLayout
+ * the y layout
+ */
+ protected void setupDropTarget(Component component, YLayout yLayout) {
+ IDropTargetStrategy strategy = getViewContext().getService(
+ IDropTargetStrategy.class.getName());
+ if (strategy != null) {
+ strategy.setupDropTarget(getViewContext(), component, yLayout);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#updateSpacings()
+ */
+ @Override
+ public void updateSpacings() {
+ if (getModel() instanceof YSpacingable) {
+ ((SpacingHandler) getWidget())
+ .setSpacing(((YSpacingable) getModel()).isSpacing());
+ }
+ if (getModel() instanceof YMarginable) {
+ ((MarginHandler) getWidget()).setMargin(((YMarginable) getModel())
+ .isMargin());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ if (children != null) {
+ children.clear();
+ children = null;
+ }
+ } finally {
+ super.internalDispose();
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabPresenter.java
new file mode 100644
index 0000000..d883f5f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabPresenter.java
@@ -0,0 +1,310 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.util.CoreModelUtil;
+import org.eclipse.osbp.ecview.core.common.notification.ILifecycleEvent;
+import org.eclipse.osbp.ecview.core.common.notification.ILifecycleService;
+import org.eclipse.osbp.ecview.core.common.notification.LifecycleEvent;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabEditpart;
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An abstract implementation of the {@link IWidgetPresentation}.
+ *
+ * @param <A>
+ * the generic type
+ */
+public abstract class AbstractTabPresenter<A extends Component> extends
+ AbstractDisposable implements IWidgetPresentation<A>,
+ ILocaleChangedService.LocaleListener {
+
+ /**
+ * See {@link IConstants#CSS_CLASS_CONTROL_BASE}.
+ */
+ public static final String CSS_CLASS_CONTROL_BASE = IConstants.CSS_CLASS_CONTROL_BASE;
+
+ /**
+ * See {@link IConstants#CSS_CLASS_CONTROL}.
+ */
+ public static final String CSS_CLASS_CONTROL = IConstants.CSS_CLASS_CONTROL;
+
+ // a reference to viewContext is required for disposal. Otherwise the view
+ /** The view context. */
+ // may not become accessed
+ private IViewContext viewContext;
+
+ /** The editpart. */
+ private final ITabEditpart editpart;
+
+ /** The bindings. */
+ private Set<Binding> bindings = new HashSet<Binding>();
+
+ /**
+ * Instantiates a new abstract tab presenter.
+ *
+ * @param editpart
+ * the editpart
+ */
+ public AbstractTabPresenter(ITabEditpart editpart) {
+ this.editpart = editpart;
+ viewContext = editpart.getView().getContext();
+ }
+
+ /**
+ * Returns the editpart the presenter will render for.
+ *
+ * @return the editpart
+ */
+ protected ITabEditpart getEditpart() {
+ return editpart;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getModel()
+ */
+ @Override
+ public Object getModel() {
+ return getEditpart().getModel();
+ }
+
+ /**
+ * Returns the view context.
+ *
+ * @return viewContext
+ */
+ public IViewContext getViewContext() {
+ return viewContext;
+ }
+
+ /**
+ * Returns the active locale for the view.
+ *
+ * @return the locale
+ */
+ protected Locale getLocale() {
+ return viewContext.getLocale();
+ }
+
+ /**
+ * Returns the i18n service or <code>null</code> if no service is available.
+ *
+ * @return the i18n service
+ */
+ protected II18nService getI18nService() {
+ return viewContext.getService(II18nService.ID);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService.LocaleListener#localeChanged(java.util.Locale)
+ */
+ @Override
+ public void localeChanged(Locale locale) {
+ doUpdateLocale(locale);
+ }
+
+ /**
+ * Needs to be overridden by subclasses to update the locale.
+ *
+ * @param locale
+ * the locale
+ */
+ protected abstract void doUpdateLocale(Locale locale);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.IVisibilityProcessable#apply(org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler)
+ */
+ @Override
+ public void apply(IVisibilityHandler handler) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.IVisibilityProcessable#resetVisibilityProperties()
+ */
+ @Override
+ public void resetVisibilityProperties() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#notifyDatatypeChanged(org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent)
+ */
+ @Override
+ public void notifyDatatypeChanged(DatatypeChangeEvent event) {
+
+ }
+
+ /**
+ * Applies the defaults to the ecview model. Transient values will be
+ * configured properly.
+ *
+ * @param yEmbeddable
+ * the y embeddable
+ */
+ protected void applyDefaults(YEmbeddable yEmbeddable) {
+ // initialize the transient values
+ //
+ CoreModelUtil.initTransientValues(yEmbeddable);
+ }
+
+ /**
+ * Registers the given binding to be managed by the presenter. If the widget
+ * becomes disposed or unrendered, all the bindings will become disposed.
+ *
+ * @param binding
+ * the binding
+ */
+ protected void registerBinding(Binding binding) {
+ bindings.add(binding);
+ }
+
+ /**
+ * Unbinds all currently active bindings.
+ */
+ protected void unbind() {
+ for (Binding binding : bindings) {
+ binding.dispose();
+ }
+ bindings.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getObservableValue(java.lang.Object)
+ */
+ @Override
+ public IObservable getObservableValue(Object model) {
+ return internalGetObservableEndpoint((YEmbeddableBindingEndpoint) model);
+ }
+
+ /**
+ * Has to provide an instance of IObservable for the given bindableValue.
+ *
+ * @param bindableValue
+ * the bindable value
+ * @return the i observable
+ */
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ throw new UnsupportedOperationException("Must be overridden!");
+ }
+
+ /**
+ * Cast e object.
+ *
+ * @param model
+ * the model
+ * @return the e object
+ */
+ protected EObject castEObject(Object model) {
+ return (EObject) model;
+ }
+
+ /**
+ * Locale change events are catched by that class.
+ */
+ protected void registerAtLocaleChangedService() {
+ ILocaleChangedService service = getViewContext().getService(
+ ILocaleChangedService.ID);
+ service.addLocaleListener(this);
+ }
+
+ /**
+ * Locale change events are not catched by that class.
+ */
+ protected void unregisterFromLocaleChangedService() {
+ ILocaleChangedService service = getViewContext().getService(
+ ILocaleChangedService.ID);
+ service.removeLocaleListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.common.dispose.AbstractDisposable#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.common.dispose.AbstractDisposable#notifyDisposeListeners()
+ */
+ @Override
+ protected void notifyDisposeListeners() {
+ super.notifyDisposeListeners();
+ sendDisposedLifecycleEvent();
+ }
+
+ /**
+ * Send a dispose lifecycle event to all registered listeners.
+ */
+ protected void sendDisposedLifecycleEvent() {
+ ILifecycleService service = getViewContext().getService(
+ ILifecycleService.class.getName());
+ if (service != null) {
+ service.notifyLifecycle(new LifecycleEvent(getEditpart(),
+ ILifecycleEvent.TYPE_DISPOSED));
+ }
+ }
+
+ /**
+ * Send a rendered lifecycle event to all registered listeners.
+ */
+ protected void sendRenderedLifecycleEvent() {
+ ILifecycleService service = getViewContext().getService(
+ ILifecycleService.class.getName());
+ if (service != null) {
+ service.notifyLifecycle(new LifecycleEvent(getEditpart(),
+ ILifecycleEvent.TYPE_RENDERED));
+ }
+ }
+
+ /**
+ * Send a rendered lifecycle event to all registered listeners.
+ */
+ protected void sendUnrenderedLifecycleEvent() {
+ ILifecycleService service = getViewContext().getService(
+ ILifecycleService.class.getName());
+ if (service != null) {
+ service.notifyLifecycle(new LifecycleEvent(getEditpart(),
+ ILifecycleEvent.TYPE_UNRENDERED));
+ }
+ }
+
+ /**
+ * For testing purposes.
+ *
+ * @return the UI bindings
+ */
+ public Set<Binding> getUIBindings() {
+ return bindings;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabSheetPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabSheetPresenter.java
new file mode 100644
index 0000000..3e6efe3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractTabSheetPresenter.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTabSheet;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabSheetEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.ITabSheetPresentation;
+
+import com.vaadin.ui.ComponentContainer;
+
+/**
+ * An abstract base class implementing {@link ILayoutPresentation}.
+ */
+public abstract class AbstractTabSheetPresenter<A extends ComponentContainer>
+ extends AbstractVaadinWidgetPresenter<A> implements
+ ITabSheetPresentation<A> {
+
+ public AbstractTabSheetPresenter(ITabSheetEditpart editpart) {
+ super(editpart);
+ }
+
+ /**
+ * Returns the editpart the presenter will render for.
+ *
+ * @return the editpart
+ */
+ protected ITabSheetEditpart getEditpart() {
+ return (ITabSheetEditpart) super.getEditpart();
+ }
+
+ @Override
+ public YTabSheet getModel() {
+ return (YTabSheet) getEditpart().getModel();
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java
new file mode 100644
index 0000000..b20ade6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/common/AbstractVaadinWidgetPresenter.java
@@ -0,0 +1,1571 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateListStrategy;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.internal.databinding.BindingStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
+import org.eclipse.osbp.ecview.core.common.model.core.YEditable;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEnable;
+import org.eclipse.osbp.ecview.core.common.model.core.YFocusable;
+import org.eclipse.osbp.ecview.core.common.model.core.YVisibleable;
+import org.eclipse.osbp.ecview.core.common.model.core.util.CoreModelUtil;
+import org.eclipse.osbp.ecview.core.common.model.datatypes.YDatatype;
+import org.eclipse.osbp.ecview.core.common.model.visibility.YColor;
+import org.eclipse.osbp.ecview.core.common.model.visibility.YVisibilityProperties;
+import org.eclipse.osbp.ecview.core.common.notification.ILifecycleEvent;
+import org.eclipse.osbp.ecview.core.common.notification.ILifecycleService;
+import org.eclipse.osbp.ecview.core.common.notification.LifecycleEvent;
+import org.eclipse.osbp.ecview.core.common.presentation.IInitializerService;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.common.services.IWidgetAssocationsService;
+import org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler;
+import org.eclipse.osbp.ecview.core.databinding.emf.common.ECViewUpdateValueStrategy;
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener;
+import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinProperties;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeNotifier;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.data.util.converter.Converter.ConversionException;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Component.Focusable;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Slider;
+
+import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An abstract implementation of the {@link IWidgetPresentation}.
+ *
+ * @param <A>
+ * the generic type
+ */
+@SuppressWarnings("restriction")
+public abstract class AbstractVaadinWidgetPresenter<A extends Component>
+ extends AbstractDisposable implements IWidgetPresentation<A>,
+ ILocaleChangedService.LocaleListener {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(AbstractVaadinWidgetPresenter.class);
+
+ /**
+ * See {@link IConstants#CSS_CLASS_CONTROL_BASE}.
+ */
+ public static final String CSS_CLASS_CONTROL_BASE = IConstants.CSS_CLASS_CONTROL_BASE;
+
+ /**
+ * See {@link IConstants#CSS_CLASS_CONTROL}.
+ */
+ public static final String CSS_CLASS_CONTROL = IConstants.CSS_CLASS_CONTROL;
+
+ /**
+ * See {@link IConstants#CSS_CLASS_COMPRESSOR}.
+ */
+ public static final String CSS_CLASS_COMPRESSOR = IConstants.CSS_CLASS_COMPRESSOR;
+
+ /** The view context. */
+ private IViewContext viewContext;
+
+ /** The editpart. */
+ private final IEmbeddableEditpart editpart;
+
+ /** The binding manger. */
+ private IBindingManager bindingManger;
+
+ /** The bindings. */
+ private Set<Binding> bindings = new HashSet<Binding>();
+
+ /** The visibility options applier. */
+ private VisibilityOptionsApplier visibilityOptionsApplier;
+
+ private ILocaleChangedService localeChangedService;
+
+ private AbstractVaadinWidgetPresenter<A>.LabelAdapter labelAdapter;
+
+ /**
+ * Instantiates a new abstract vaadin widget presenter.
+ *
+ * @param editpart
+ * the editpart
+ */
+ public AbstractVaadinWidgetPresenter(IEmbeddableEditpart editpart) {
+ this.editpart = editpart;
+ viewContext = editpart.getView().getContext();
+ }
+
+ /**
+ * Returns the editpart the presenter will render for.
+ *
+ * @return the editpart
+ */
+ protected IEmbeddableEditpart getEditpart() {
+ return editpart;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getModel()
+ */
+ @Override
+ public Object getModel() {
+ return getEditpart().getModel();
+ }
+
+ /**
+ * Gets the casted model.
+ *
+ * @return the casted model
+ */
+ protected YElement getCastedModel() {
+ return (YElement) getModel();
+ }
+
+ /**
+ * Returns the view context.
+ *
+ * @return viewContext
+ */
+ public IViewContext getViewContext() {
+ return viewContext;
+ }
+
+ /**
+ * Returns the active locale for the view.
+ *
+ * @return the locale
+ */
+ protected Locale getLocale() {
+ return viewContext.getLocale();
+ }
+
+ /**
+ * Returns the i18n service or <code>null</code> if no service is available.
+ *
+ * @return the i18n service
+ */
+ protected II18nService getI18nService() {
+ return viewContext.getService(II18nService.ID);
+ }
+
+ /**
+ * Returns the IResourceProvider or <code>null</code> if no service is
+ * available.
+ *
+ * @return the resource provider
+ */
+ protected IResourceProvider getResourceProvider() {
+ return viewContext.getService(IResourceProvider.class.getName());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService.
+ * LocaleListener#localeChanged(java.util.Locale)
+ */
+ @Override
+ public void localeChanged(Locale locale) {
+ doUpdateLocale(locale);
+ }
+
+ /**
+ * Needs to be overridden by subclasses to update the locale.
+ *
+ * @param locale
+ * the locale
+ */
+ protected abstract void doUpdateLocale(Locale locale);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.
+ * IVisibilityProcessable
+ * #apply(org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler)
+ */
+ @Override
+ public void apply(IVisibilityHandler handler) {
+ if (visibilityOptionsApplier == null) {
+ visibilityOptionsApplier = createVisibilityOptionsApplier();
+ }
+
+ visibilityOptionsApplier.apply(Util.mapYProperties(handler));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * notifyDatatypeChanged
+ * (org.eclipse.osbp.ecview.core.common.editpart.datatypes
+ * .IDatatypeEditpart.DatatypeChangeEvent)
+ */
+ @Override
+ public void notifyDatatypeChanged(DatatypeChangeEvent event) {
+ if (event.isUnsetEvent()) {
+ doApplyDatatype(null);
+ } else {
+ doApplyDatatype((YDatatype) event.getEditpart().getModel());
+ }
+ }
+
+ /**
+ * Do apply datatype.
+ *
+ * @param yDt
+ * the y dt
+ */
+ protected void doApplyDatatype(YDatatype yDt) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.
+ * IVisibilityProcessable#resetVisibilityProperties()
+ */
+ @Override
+ public void resetVisibilityProperties() {
+ visibilityOptionsApplier.apply(null);
+ }
+
+ /**
+ * Creates a new instance of the visibility options applier.
+ *
+ * @return the visibility options applier
+ */
+ protected VisibilityOptionsApplier createVisibilityOptionsApplier() {
+ return new VisibilityOptionsApplier(getWidget());
+ }
+
+ /**
+ * Is called to initialize the newly created component.
+ *
+ * @param component
+ * the component
+ * @param model
+ * the model
+ */
+ protected void setupComponent(Component component, YElement model) {
+ IInitializerService service = getViewContext().getService(
+ IInitializerService.class.getName());
+ if (service != null) {
+ service.initialize(component, model);
+ }
+
+ if (this instanceof IDesignListener) {
+ IDesignerService designService = getDesignService();
+ if (designService != null) {
+ designService.addListener((IDesignListener) this);
+
+ IWidgetDesignConfigurator cService = getViewContext()
+ .getService(IWidgetDesignConfigurator.class.getName());
+ if (cService != null && getWidget() != null) {
+ cService.configure(getWidget(), (YEmbeddable) getModel(),
+ designService.isDesignMode());
+ }
+ }
+ }
+
+ labelAdapter = new LabelAdapter();
+ model.eAdapters().add(labelAdapter);
+ }
+
+ /**
+ * Must be called by subclasses.
+ *
+ * @param event
+ * the event
+ */
+ public void notify(DesignEvent event) {
+ configureForDesignMode(event);
+ }
+
+ /**
+ * Configure / deconfigure the widget for the design mode.
+ *
+ * @param event
+ * the event
+ */
+ protected void configureForDesignMode(DesignEvent event) {
+ IWidgetDesignConfigurator service = getViewContext().getService(
+ IWidgetDesignConfigurator.class.getName());
+ if (service != null && getWidget() != null) {
+ service.configure(getWidget(), (YEmbeddable) getModel(),
+ event.getType() == EventType.ENABLED);
+ }
+ }
+
+ /**
+ * Creates the bindings from the ECView EMF model to the given UI element.
+ *
+ * @param yEmbeddable
+ * the y embeddable
+ * @param widget
+ * the widget
+ * @param container
+ * the container
+ */
+ protected void createBindings(YEmbeddable yEmbeddable,
+ AbstractComponent widget, AbstractComponent container) {
+ ensureBindingManager();
+ applyDefaults(yEmbeddable);
+
+ if (container != null) {
+ registerBinding(createBindingsVisiblility(yEmbeddable, container));
+ } else {
+ registerBinding(createBindingsVisiblility(yEmbeddable, widget));
+ }
+
+ if (yEmbeddable instanceof YEnable) {
+ registerBinding(createBindingsEnabled((YEnable) yEmbeddable, widget));
+ }
+
+ if (yEmbeddable instanceof YEditable) {
+ registerBinding(createBindingsEditable((YEditable) yEmbeddable,
+ widget));
+ }
+
+ // createBindingsCaption(yEmbeddable, widget);
+
+ }
+
+ /**
+ * Creates the binding.
+ *
+ * @param target
+ * the target
+ * @param model
+ * the model
+ * @return Binding - the created binding
+ */
+ protected Binding createBindings(IObservableValue target,
+ IObservableValue model) {
+ ensureBindingManager();
+
+ return bindingManger.bindValue(target, model);
+ }
+
+ /**
+ * Creates the binding.
+ *
+ * @param target
+ * the target
+ * @param model
+ * the model
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return Binding - the created binding
+ */
+ protected Binding createBindings(IObservableValue target,
+ IObservableValue model, UpdateValueStrategy targetToModel,
+ UpdateValueStrategy modelToTarget) {
+ ensureBindingManager();
+ return bindingManger.bindValue(target, model, targetToModel,
+ modelToTarget);
+ }
+
+ /**
+ * Creates the binding.
+ *
+ * @param target
+ * the target
+ * @param model
+ * the model
+ * @return Binding - the created binding
+ */
+ protected Binding createBindings(IObservableList target,
+ IObservableList model) {
+ ensureBindingManager();
+
+ return bindingManger.bindList(target, model);
+ }
+
+ /**
+ * Ensure binding manager.
+ */
+ protected void ensureBindingManager() {
+ if (bindingManger == null) {
+ bindingManger = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ }
+ }
+
+ /**
+ * Binds the editable flag from the ecview model to the ui element.
+ *
+ * @param yEditable
+ * the y editable
+ * @param abstractComponent
+ * the abstract component
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsEditable(YEditable yEditable,
+ AbstractComponent abstractComponent) {
+ ensureBindingManager();
+ if (abstractComponent instanceof Property.ReadOnlyStatusChangeNotifier) {
+ return bindingManger.bindReadonly(yEditable,
+ (Property.ReadOnlyStatusChangeNotifier) abstractComponent);
+ } else {
+ return bindingManger.bindReadonlyOneway(yEditable,
+ abstractComponent);
+ }
+ }
+
+ /**
+ * Applies the defaults to the ecview model. Transient values will be
+ * configured properly.
+ *
+ * @param yEmbeddable
+ * the y embeddable
+ */
+ protected void applyDefaults(YEmbeddable yEmbeddable) {
+ // initialize the transient values
+ //
+ CoreModelUtil.initTransientValues(yEmbeddable);
+ }
+
+ /**
+ * Binds the visible flag from the ecview model to the ui element.
+ *
+ * @param yVisibleable
+ * the y visibleable
+ * @param abstractComponent
+ * the abstract component
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsVisiblility(YVisibleable yVisibleable,
+ AbstractComponent abstractComponent) {
+ ensureBindingManager();
+ return bindingManger.bindVisible(yVisibleable, abstractComponent);
+ }
+
+ /**
+ * Binds the enabled flag from the ecview model to the ui element.
+ *
+ * @param yEnable
+ * the y enable
+ * @param abstractComponent
+ * the abstract component
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsEnabled(YEnable yEnable,
+ AbstractComponent abstractComponent) {
+ IBindingManager bindingManger = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+
+ // bind enabled
+ return bindingManger.bindEnabled(yEnable, abstractComponent);
+ }
+
+ /**
+ * Creates a binding for the value attribute from the ECView-UI-model to the
+ * UI element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @return Binding - the created binding
+ */
+ protected Binding createBindings_Value(EObject model,
+ EStructuralFeature modelFeature, Field<?> field) {
+ return createBindingsValue(model, modelFeature, field, null, null);
+ }
+
+ /**
+ * Binds the value attribute from the ecview model to the ui element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsValue(EObject model,
+ EStructuralFeature modelFeature, Field<?> field,
+ UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeValue(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ targetToModel, modelToTarget);
+ }
+ return null;
+ }
+
+ /**
+ * Binds the image attribute from the ecview model to the ui element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsButtonImage(EObject model,
+ EStructuralFeature modelFeature, Button field) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeIcon(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ }
+ return null;
+ }
+
+ /**
+ * Creates the bindings by accessor.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param property
+ * the property
+ * @return the binding
+ */
+ protected Binding createBindingsByAccessor(EObject model,
+ EStructuralFeature modelFeature, Field<?> field, String property) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinProperties.accessor(
+ Slider.class, property).observe(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ }
+ return null;
+ }
+
+ /**
+ * Creates a binding for the value attribute from the ECView-UI-model to the
+ * UI element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsButtonClick(EObject model,
+ EStructuralFeature modelFeature, Button field) {
+ return createBindingsButtonClick(model, modelFeature, field, null, null);
+ }
+
+ /**
+ * Binds the value attribute from the ecview model to the ui element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsButtonClick(EObject model,
+ EStructuralFeature modelFeature, Button field,
+ UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeButtonClick(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ targetToModel, modelToTarget);
+ }
+ return null;
+ }
+
+ /**
+ * Creates a binding for the value attribute from the ECView-UI-model to the
+ * UI element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @return Binding - the created binding
+ */
+ protected Binding createBindings_Value(EObject model,
+ EStructuralFeature modelFeature, ValueChangeNotifier field) {
+ return createBindingsValue(model, modelFeature, field, null, null);
+ }
+
+ /**
+ * Binds the value attribute from the ecview model to the ui element.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsValue(EObject model,
+ EStructuralFeature modelFeature, ValueChangeNotifier field,
+ UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeValue(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ targetToModel, modelToTarget);
+ }
+ return null;
+ }
+
+ /**
+ * Binds the selection of the selectable to the ECView model. It uses an
+ * validator to detect problems setting a not allowed selection. In that
+ * case, the current selection of the UI-model is passed to the ECView model
+ * again.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param type
+ * the type of selected object
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsSelection(EObject model,
+ EStructuralFeature modelFeature, final AbstractSelect field,
+ Class<?> type) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeSingleSelection(field, type);
+
+ // create a modelToTarget update strategy with a validator
+ //
+ ECViewUpdateValueStrategy modelToTarget = new ECViewUpdateValueStrategy(
+ ECViewUpdateValueStrategy.POLICY_UPDATE);
+ modelToTarget.setBeforeSetValidator(new IValidator() {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public IStatus validate(Object value) {
+ if (value == null) {
+ return Status.OK_STATUS;
+ }
+ Object convertedValue = value;
+ if (!("".equals(value))) {
+ Converter converter = field.getConverter();
+ if (converter != null) {
+ try {
+ convertedValue = converter.convertToPresentation(
+ value, converter.getPresentationType(),
+ getLocale());
+ } catch (ConversionException e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ }
+ if (!field.containsId(convertedValue)) {
+ return Status.CANCEL_STATUS;
+ }
+
+ return Status.OK_STATUS;
+ }
+ });
+
+ final Binding binding = bindingManager.bindValue(uiObservable,
+ modelObservable, null, modelToTarget);
+ registerBinding(binding);
+
+ // now bind the validation state to an observable value. If the
+ // doSetValue is called, we check whether the set operation was
+ // successfully. Otherwise we send the target value back to the
+ // model.
+ Binding validationBinding = bindingManager.bindValue(
+ binding.getValidationStatus(),
+ new AbstractObservableValue() {
+
+ @Override
+ public Object getValueType() {
+ return null;
+ }
+
+ @Override
+ protected Object doGetValue() {
+ return null;
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ BindingStatus status = (BindingStatus) value;
+ if (status.getSeverity() == BindingStatus.CANCEL) {
+ binding.updateTargetToModel();
+ }
+ }
+ });
+ registerBinding(validationBinding);
+
+ return binding;
+ }
+ return null;
+ }
+
+ /**
+ * Binds the multi selection of the selectable to the ECView model. It uses
+ * an validator to detect problems setting a not allowed selection. In that
+ * case, the current selection of the UI-model is passed to the ECView model
+ * again.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param collectionType
+ * the type contained in the selection result
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsMultiSelection(EObject model,
+ EStructuralFeature modelFeature, final AbstractSelect field,
+ Class<?> collectionType) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableList modelObservable = EMFProperties.list(modelFeature)
+ .observe(getModel());
+ IVaadinObservableList uiObservable = VaadinObservables
+ .observeMultiSelectionAsList(field, collectionType);
+
+ final Binding binding = bindingManager.bindList(uiObservable,
+ modelObservable, null, null);
+ registerBinding(binding);
+
+ return binding;
+ }
+ return null;
+ }
+
+ /**
+ * Creates a binding for the contents of the vaadin container from the
+ * ECView-UI-model to the UI element.
+ *
+ * @param model
+ * the ECView model
+ * @param modelFeature
+ * the eFeature of the model
+ * @param field
+ * the ui field
+ * @param collectionType
+ * the type of the collection contents
+ * @return Binding - the created binding
+ */
+ protected Binding createBindings_ContainerContents(EObject model,
+ EStructuralFeature modelFeature,
+ Container.ItemSetChangeNotifier field, Class<?> collectionType) {
+ return createBindingsContainerContents(model, modelFeature, field,
+ collectionType, null, null);
+ }
+
+ /**
+ * Creates a binding for the contents of the vaadin container from the
+ * ECView-UI-model to the UI element.
+ *
+ * @param model
+ * the ECView model
+ * @param modelFeature
+ * the eFeature of the model
+ * @param field
+ * the ui field
+ * @param collectionType
+ * the type of the collection contents
+ * @param targetToModel
+ * the update strategy
+ * @param modelToTarget
+ * the update strategy
+ * @return Binding - the created binding
+ */
+ protected Binding createBindingsContainerContents(EObject model,
+ EStructuralFeature modelFeature,
+ Container.ItemSetChangeNotifier field, Class<?> collectionType,
+ UpdateListStrategy targetToModel, UpdateListStrategy modelToTarget) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableList modelObservable = EMFProperties.list(modelFeature)
+ .observe(getModel());
+ IObservableList uiObservable = VaadinObservables
+ .observeContainerItemSetContents(field, collectionType);
+ return bindingManager.bindList(uiObservable, modelObservable,
+ targetToModel, modelToTarget);
+ }
+ return null;
+ }
+
+ protected Binding createBindingsContainerContents(EObject model,
+ EStructuralFeature modelFeature,
+ Container.ItemSetChangeNotifier field, Class<?> collectionType,
+ boolean containerReadonly) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableList modelObservable = EMFProperties.list(modelFeature)
+ .observe(getModel());
+ IObservableList uiObservable = VaadinObservables
+ .observeContainerItemSetContents(field, collectionType);
+
+ if (containerReadonly) {
+ return bindingManager
+ .bindList(uiObservable, modelObservable,
+ new UpdateListStrategy(
+ UpdateListStrategy.POLICY_UPDATE),
+ new UpdateListStrategy(
+ UpdateListStrategy.POLICY_NEVER));
+ } else {
+ return bindingManager
+ .bindList(uiObservable, modelObservable,
+ new UpdateListStrategy(
+ UpdateListStrategy.POLICY_UPDATE),
+ new UpdateListStrategy(
+ UpdateListStrategy.POLICY_UPDATE));
+ }
+ }
+ return null;
+ }
+
+ // /**
+ // * Binds the caption attribute from the ecview model to the ui element.
+ // *
+ // * @param model
+ // * the model
+ // * @param comp
+ // * the component
+ // * @param targetToModel
+ // * the target to model
+ // * @param modelToTarget
+ // * the model to target
+ // * @return Binding - the created binding
+ // */
+ // protected Binding createBindingsCaption(EObject model, Component comp) {
+ // IBindingManager bindingManager = getViewContext()
+ // .getService(
+ // org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ // .getName());
+ // if (bindingManager != null) {
+ // // bind the caption
+ // IObservableValue modelObservable = EMFObservables.observeValue(
+ // model, CoreModelPackage.Literals.YEMBEDDABLE__LABEL);
+ // IObservableValue uiObservable = VaadinObservables
+ // .observeCaption(comp);
+ // return bindingManager.bindValue(uiObservable, modelObservable);
+ // }
+ // return null;
+ // }
+
+ /**
+ * Registers the given binding to be managed by the presenter. If the widget
+ * becomes disposed or unrendered, all the bindings will become disposed.
+ *
+ * @param binding
+ * the binding
+ */
+ protected void registerBinding(Binding binding) {
+ bindings.add(binding);
+ }
+
+ /**
+ * Disposes the given binding and removes it from the bindings collection.
+ *
+ * @param binding
+ * the binding
+ */
+ protected void unregisterBinding(Binding binding) {
+ bindings.remove(binding);
+ if (!binding.isDisposed()) {
+ binding.dispose();
+ }
+ }
+
+ /**
+ * Unbinds all currently active bindings.
+ */
+ protected void unbind() {
+ for (Binding binding : bindings) {
+ binding.dispose();
+ }
+ bindings.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getObservableValue(java.lang.Object)
+ */
+ @Override
+ public IObservable getObservableValue(Object model) {
+ return internalGetObservableEndpoint((YEmbeddableBindingEndpoint) model);
+ }
+
+ /**
+ * Has to provide an instance of IObservable for the given bindableValue.
+ *
+ * @param bindableValue
+ * the bindable value
+ * @return the i observable
+ */
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ throw new UnsupportedOperationException("Must be overridden!");
+ }
+
+ /**
+ * Cast e object.
+ *
+ * @param model
+ * the model
+ * @return the e object
+ */
+ protected EObject castEObject(Object model) {
+ return (EObject) model;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.common.dispose.AbstractDisposable#internalDispose
+ * ()
+ */
+ @Override
+ protected void internalDispose() {
+ unregisterFromLocaleChangedService();
+ }
+
+ /**
+ * Does general initialization of the widget.
+ *
+ * @param component
+ * the component
+ * @param model
+ * the model
+ */
+ protected void initialize(Component component, YElement model) {
+
+ // initialize the tab index
+ if (component instanceof Focusable && model instanceof YFocusable) {
+ YFocusable yFocusable = (YFocusable) model;
+ Focusable focusable = (Focusable) component;
+ if (yFocusable.getTabIndex() >= 0) {
+ focusable.setTabIndex(yFocusable.getTabIndex());
+ }
+ }
+ }
+
+ /**
+ * Uses the {@link IWidgetAssocationsService} to register the widget.
+ *
+ * @param component
+ * the component
+ * @param yElement
+ * the y element
+ */
+ protected void associateWidget(Component component, EObject yElement) {
+ IWidgetAssocationsService<Component, EObject> service = getViewContext()
+ .getService(IWidgetAssocationsService.ID);
+ service.associate(component, yElement);
+ }
+
+ /**
+ * Uses the {@link IWidgetAssocationsService} to unregister the widget.
+ *
+ * @param component
+ * the component
+ */
+ protected void unassociateWidget(Component component) {
+ IWidgetAssocationsService<Component, EObject> service = getViewContext()
+ .getService(IWidgetAssocationsService.ID);
+ service.remove(component);
+ }
+
+ /**
+ * Locale change events are catched by that class.
+ */
+ protected void registerAtLocaleChangedService() {
+ localeChangedService = getViewContext().getService(
+ ILocaleChangedService.ID);
+ localeChangedService.addLocaleListener(this);
+ }
+
+ /**
+ * Locale change events are not catched by that class.
+ */
+ protected void unregisterFromLocaleChangedService() {
+ if (localeChangedService != null) {
+ localeChangedService.removeLocaleListener(this);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.common.dispose.AbstractDisposable#
+ * notifyDisposeListeners()
+ */
+ @Override
+ protected void notifyDisposeListeners() {
+ super.notifyDisposeListeners();
+ sendDisposedLifecycleEvent();
+ }
+
+ /**
+ * Send a dispose lifecycle event to all registered listeners.
+ */
+ protected void sendDisposedLifecycleEvent() {
+ ILifecycleService service = getViewContext().getService(
+ ILifecycleService.class.getName());
+ if (service != null) {
+ service.notifyLifecycle(new LifecycleEvent(getEditpart(),
+ ILifecycleEvent.TYPE_DISPOSED));
+ }
+ }
+
+ /**
+ * Send a rendered lifecycle event to all registered listeners.
+ */
+ protected void sendRenderedLifecycleEvent() {
+ ILifecycleService service = getViewContext().getService(
+ ILifecycleService.class.getName());
+ if (service != null) {
+ service.notifyLifecycle(new LifecycleEvent(getEditpart(),
+ ILifecycleEvent.TYPE_RENDERED));
+ }
+ }
+
+ /**
+ * Send a rendered lifecycle event to all registered listeners.
+ */
+ protected void sendUnrenderedLifecycleEvent() {
+ ILifecycleService service = getViewContext().getService(
+ ILifecycleService.class.getName());
+ if (service != null) {
+ service.notifyLifecycle(new LifecycleEvent(getEditpart(),
+ ILifecycleEvent.TYPE_UNRENDERED));
+ }
+ }
+
+ // /**
+ // * Reports the validation error to the IFieldValidationManager.
+ // *
+ // * @param message
+ // */
+ // protected void reportValidationError(ErrorMessage message) {
+ // IFieldValidationManager service = getViewContext().getService(
+ // IFieldValidationManager.class.getName());
+ // if (service != null) {
+ // service.registerResult(getModel(),
+ // Util.createStatus((YEmbeddable) getModel(), message));
+ // }
+ // }
+
+ /**
+ * For testing purposes.
+ *
+ * @return the UI bindings
+ */
+ @Override
+ public Set<Binding> getUIBindings() {
+ return bindings;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * createWidget(java.lang.Object)
+ */
+ @Override
+ public A createWidget(Object parent) {
+ A result = doCreateWidget(parent);
+
+ registerAtLocaleChangedService();
+
+ return result;
+ }
+
+ /**
+ * Returns the design service or <code>null</code> if no design service is
+ * available.
+ *
+ * @return the design service
+ */
+ protected IDesignerService getDesignService() {
+ return viewContext.getService(IDesignerService.class.getName());
+ }
+
+ /**
+ * Returns the design service or <code>null</code> if no design service is
+ * available.
+ *
+ * @return the drag mode
+ */
+ protected LayoutDragMode getDragMode() {
+ IDesignerService service = getDesignService();
+ if (service == null) {
+ return LayoutDragMode.NONE;
+ }
+
+ return service.isDesignMode() ? LayoutDragMode.CLONE
+ : LayoutDragMode.NONE;
+ }
+
+ /**
+ * Needs to be implemented by subclasses to render the widget.
+ *
+ * @param parent
+ * - The parent ui component
+ * @return the a
+ */
+ protected abstract A doCreateWidget(Object parent);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * unrender()
+ */
+ @Override
+ public void unrender() {
+ unregisterFromLocaleChangedService();
+
+ if (this instanceof IDesignListener) {
+ IDesignerService designService = getDesignService();
+ if (designService != null) {
+ designService.removeListener((IDesignListener) this);
+ }
+
+ IWidgetDesignConfigurator service = getViewContext().getService(
+ IWidgetDesignConfigurator.class.getName());
+ if (service != null && getWidget() != null) {
+ service.configure(getWidget(), (YEmbeddable) getModel(), false);
+ }
+ }
+
+ if (labelAdapter != null) {
+ getCastedModel().eAdapters().remove(labelAdapter);
+ labelAdapter = null;
+ }
+
+ doUnrender();
+ }
+
+ /**
+ * Needs to be implemented by subclasses to unrender the widget.
+ */
+ protected abstract void doUnrender();
+
+ /**
+ * Applies the visibility options to the component.
+ */
+ protected class VisibilityOptionsApplier {
+
+ /** The component. */
+ protected final Component component;
+
+ /**
+ * Instantiates a new visibility options applier.
+ *
+ * @param component
+ * the component
+ */
+ public VisibilityOptionsApplier(Component component) {
+ this.component = component;
+ }
+
+ /**
+ * Reset stylenames.
+ */
+ public void resetStylenames() {
+ component.removeStyleName("l-strikethrough");
+ component.removeStyleName("l-border");
+ component.removeStyleName("l-bold");
+ component.removeStyleName("l-italic");
+ component.removeStyleName("l-underline");
+ component.removeStyleName("l-foreground-red");
+ component.removeStyleName("l-foreground-white");
+ component.removeStyleName("l-foreground-blue");
+ component.removeStyleName("l-foreground-green");
+ component.removeStyleName("l-foreground-black");
+ component.removeStyleName("l-foreground-yellow");
+ component.removeStyleName("l-foreground-gray");
+ component.removeStyleName("l-foreground-light-gray");
+ component.removeStyleName("l-foreground-dark-gray");
+ component.removeStyleName("l-background-red");
+ component.removeStyleName("l-background-white");
+ component.removeStyleName("l-background-blue");
+ component.removeStyleName("l-background-green");
+ component.removeStyleName("l-background-black");
+ component.removeStyleName("l-background-yellow");
+ component.removeStyleName("l-background-gray");
+ component.removeStyleName("l-background-light-gray");
+ component.removeStyleName("l-background-dark-gray");
+
+ }
+
+ /**
+ * Applies the visibility options to the component. Passing
+ * <code>null</code> as argument means a reset to default values.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void apply(YVisibilityProperties yProps) {
+
+ resetStylenames();
+
+ applyVisible(yProps);
+ applyEnabled(yProps);
+ applyReadOnly(yProps);
+
+ applyStrikeThrough(yProps);
+
+ applyBorder(yProps);
+
+ applyItalic(yProps);
+
+ applyUnderline(yProps);
+
+ applyForegroundColor(yProps);
+
+ applyBackgroundColor(yProps);
+ }
+
+ /**
+ * Apply css class.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyCssClass(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ String yCssClass = yProps.getCssClass();
+ if (yCssClass != null) {
+ component.addStyleName(yCssClass);
+ }
+ }
+
+ /**
+ * Apply css id.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyCssId(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ String yCssId = yProps.getCssId();
+ if (yCssId != null) {
+ component.setId(yCssId);
+ }
+ }
+
+ /**
+ * Apply underline.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyUnderline(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ if (yProps.isUnderline()) {
+ component.addStyleName("l-underline");
+ }
+ }
+
+ /**
+ * Apply italic.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyItalic(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ if (yProps.isItalic()) {
+ component.addStyleName("l-italic");
+ }
+ }
+
+ /**
+ * Apply border.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyBorder(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ if (yProps.isBorder()) {
+ component.addStyleName("l-border");
+ }
+ }
+
+ /**
+ * Apply strike through.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyStrikeThrough(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ if (yProps.isStrikethrough()) {
+ component.addStyleName("l-strikethrough");
+ }
+ }
+
+ /**
+ * Apply read only.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyReadOnly(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+
+ YElement model = getCastedModel();
+ if (model instanceof YEditable) {
+ YEditable yEditable = (YEditable) model;
+ yEditable.setEditable(yProps.isEditable());
+ }
+ }
+
+ /**
+ * Apply enabled.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyEnabled(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+
+ YElement model = getCastedModel();
+ if (model instanceof YEnable) {
+ YEnable yEnable = (YEnable) model;
+ yEnable.setEnabled(yProps.isEnabled());
+ }
+ }
+
+ /**
+ * Apply visible.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyVisible(YVisibilityProperties yProps) {
+ if (yProps == null) {
+ return;
+ }
+ YElement model = getCastedModel();
+ if (model instanceof YVisibleable) {
+ YVisibleable yVisibleable = (YVisibleable) model;
+ yVisibleable.setVisible(yProps.isVisible());
+ }
+ }
+
+ /**
+ * Apply foreground color.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyForegroundColor(YVisibilityProperties yProps) {
+ YColor yColor = yProps.getForegroundColor();
+ if (yColor != null) {
+ component.addStyleName("l-foreground-"
+ + yColor.getName().toLowerCase());
+ }
+ }
+
+ /**
+ * Apply background color.
+ *
+ * @param yProps
+ * the y props
+ */
+ public void applyBackgroundColor(YVisibilityProperties yProps) {
+ YColor yColor = yProps.getBackgroundColor();
+ if (yColor != null) {
+ component.addStyleName("l-background-"
+ + yColor.getName().toLowerCase());
+ }
+ }
+ }
+
+ private class LabelAdapter extends AdapterImpl {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if (msg.getFeature() == CoreModelPackage.Literals.YEMBEDDABLE__LABEL_I1_8N_KEY
+ || msg.getFeature() == CoreModelPackage.Literals.YEMBEDDABLE__LABEL) {
+ doUpdateLocale(getLocale());
+ }
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/AbsoluteLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/AbsoluteLayoutPresentation.java
new file mode 100644
index 0000000..6dc208d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/AbsoluteLayoutPresentation.java
@@ -0,0 +1,421 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YAbsoluteLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YAbsoluteLayoutCellStyle;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.eclipse.osbp.vaadin.addons.absolutelayout.AbsoluteLayout;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class AbsoluteLayoutPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(AbsoluteLayoutPresentation.class);
+
+ /** The layout. */
+ private AbsoluteLayout layout;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public AbsoluteLayoutPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YAbsoluteLayout) editpart.getModel());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ layout.removeAllComponents();
+
+ for (IEmbeddableEditpart childPresentation : getChildren()) {
+ YEmbeddable yChild = (YEmbeddable) childPresentation.getModel();
+ addChildComponent(childPresentation,
+ modelAccess.getCellStyle(yChild));
+ }
+ }
+
+ /**
+ * Is called to create the child component and apply layouting defaults to
+ * it.
+ *
+ * @param editpart
+ * the editpart
+ * @param yStyle
+ * the y style
+ */
+ protected void addChildComponent(IEmbeddableEditpart editpart,
+ YAbsoluteLayoutCellStyle yStyle) {
+
+ Component child = (Component) editpart.render(layout);
+ layout.addComponent(child, toCssString(yStyle));
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#updateCellStyle(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable)
+ */
+ public void updateCellStyle(YEmbeddable child) {
+ // refresh the whole ui
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#notify(org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent)
+ */
+ @Override
+ public void notify(DesignEvent event) {
+ super.notify(event);
+
+ if (getWidget() != null) {
+ if (event.getType() == EventType.ENABLED) {
+ layout.setResizable(true);
+ layout.setUseAlignments(true);
+ } else {
+ layout.setResizable(false);
+ layout.setUseAlignments(false);
+ }
+ }
+ }
+
+ /**
+ * To css string.
+ *
+ * @param yStyle
+ * the y style
+ * @return the string
+ */
+ private String toCssString(YAbsoluteLayoutCellStyle yStyle) {
+ AbsoluteLayout.ComponentPosition pos = this.layout.new ComponentPosition();
+ if (yStyle != null) {
+ pos.setTop(toPositionFloat(yStyle.getTop()), Unit.PIXELS);
+ pos.setBottom(toPositionFloat(yStyle.getBottom()), Unit.PIXELS);
+ pos.setLeft(toPositionFloat(yStyle.getLeft()), Unit.PIXELS);
+ pos.setRight(toPositionFloat(yStyle.getRight()), Unit.PIXELS);
+ pos.setZIndex(yStyle.getZIndex());
+ }
+ return pos.getCSSString();
+ }
+
+ /**
+ * To position float.
+ *
+ * @param value
+ * the value
+ * @return the float
+ */
+ private Float toPositionFloat(int value) {
+ return value == -1 ? null : Float.valueOf(value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (layout == null) {
+ layout = new AbsoluteLayout();
+ setupComponent(layout, getCastedModel());
+ layout.setResizable(modelAccess.yLayout.isChildResizeEnabled());
+ layout.setUseAlignments(isUseAlignments());
+
+ associateWidget(layout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ layout.setId(modelAccess.getCssID());
+ } else {
+ layout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ layout.addStyleName(modelAccess.getCssClass());
+ } else {
+ layout.addStyleName(CSS_CLASS_CONTROL);
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, layout, null);
+
+ // initialize all children
+ initializeChildren();
+
+ // and now render children
+ renderChildren(false);
+ }
+
+ return layout;
+ }
+
+ /**
+ * Checks if is use alignments.
+ *
+ * @return true, if is use alignments
+ */
+ private boolean isUseAlignments() {
+ return modelAccess.yLayout.isChildResizeEnabled()
+ || modelAccess.yLayout.isChildMoveEnabled();
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return layout;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return layout != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ for (IEmbeddableEditpart child : new ArrayList<IEmbeddableEditpart>(
+ getChildren())) {
+ child.dispose();
+ }
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (layout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(layout);
+
+ // unrender the children
+ unrenderChildren();
+
+ layout = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalAdd(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ YEmbeddable yChild = (YEmbeddable) editpart.getModel();
+ addChildComponent(editpart, modelAccess.getCellStyle(yChild));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalRemove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (layout != null && child.isRendered()) {
+ layout.removeComponent((Component) child.getWidget());
+ }
+
+ child.unrender();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalInsert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalMove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int, int)
+ */
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#renderChildren(boolean)
+ */
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YAbsoluteLayout yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YAbsoluteLayout yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Gets the cell styles.
+ *
+ * @return the cell styles
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YAbsoluteLayout#getCellStyles()
+ */
+ public EList<YAbsoluteLayoutCellStyle> getCellStyles() {
+ return yLayout.getCellStyles();
+ }
+
+ /**
+ * Gets the cell style.
+ *
+ * @param element
+ * the element
+ * @return the cell style
+ */
+ public YAbsoluteLayoutCellStyle getCellStyle(YEmbeddable element) {
+ return yLayout.getCellStyle(element);
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java
new file mode 100644
index 0000000..3868196
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BeanReferenceFieldPresentation.java
@@ -0,0 +1,461 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.beans.InMemoryBeanProvider;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YBeanReferenceField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBeanReferenceFieldEditpart;
+import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraints;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulInMemoryBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.common.services.filter.AnnotationToVaadinFilterConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanReferenceField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class BeanReferenceFieldPresentation extends AbstractFieldWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(BeanReferenceFieldPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The field. */
+ private CustomField<?> field;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public BeanReferenceFieldPresentation(IElementEditpart editpart) {
+ super((IBeanReferenceFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess((YBeanReferenceField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (field == null) {
+ IBeanSearchServiceFactory searchServiceFactory = getViewContext().getService(IBeanSearchServiceFactory.class.getName());
+
+ IBeanSearchService<?> service = getSearchService(searchServiceFactory);
+ ISharedStateContext sharedState = getViewContext().getService(ISharedStateContext.class.getName());
+ field = new CustomField(getEditpart().getId(), "", modelAccess.yField.getType(), service, createFilter(), sharedState);
+
+ field.addStyleName(CSS_CLASS_CONTROL);
+ field.setNullRepresentation("");
+ field.setImmediate(true);
+ setupComponent(field, getCastedModel());
+ String captionPropertyPath = modelAccess.yField.getCaptionPropertyPath();
+ if (captionPropertyPath == null || captionPropertyPath.isEmpty()) {
+ captionPropertyPath = modelAccess.yField.getDescriptionProperty();
+ }
+ field.setItemCaptionPropertyId(captionPropertyPath);
+ field.setItemIconPropertyId(modelAccess.yField.getImagePropertyPath());
+
+ associateWidget(field, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ field.setId(modelAccess.getCssID());
+ } else {
+ field.setId(getEditpart().getId());
+ }
+
+ field.setNullSelectionAllowed(!modelAccess.yField.isRequired());
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, field);
+
+ if (modelAccess.isCssClassValid()) {
+ field.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(field);
+ }
+ return field;
+ }
+
+ /**
+ * Creates a vaadin filter for the field annotations.
+ *
+ * @return the filter
+ */
+ protected Filter createFilter() {
+ Class<?> sourceType = modelAccess.yField.getReferenceSourceType();
+ String sourceProperty = modelAccess.yField.getReferenceSourceTypeProperty();
+ if (sourceType == null || sourceProperty == null || sourceProperty.equals("")) {
+ return null;
+ }
+
+ try {
+ java.lang.reflect.Field sourceField = sourceType.getDeclaredField(sourceProperty);
+
+ TargetEnumConstraints annotation = sourceField.getAnnotation(TargetEnumConstraints.class);
+ if (annotation != null) {
+ return AnnotationToVaadinFilterConverter.createFilter(annotation);
+ }
+
+ } catch (Exception e) {
+ LOGGER.warn("{}", e);
+ return null;
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the bean search service.
+ *
+ * @param searchServiceFactory
+ * the search service factory
+ * @return the search service
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected IBeanSearchService<?> getSearchService(IBeanSearchServiceFactory searchServiceFactory) {
+ IBeanSearchService<?> service = null;
+ Class<? extends InMemoryBeanProvider> inMemoryProviderClass = (Class<? extends InMemoryBeanProvider>) modelAccess.yField
+ .getInMemoryBeanProvider();
+ if (inMemoryProviderClass != null) {
+ try {
+ InMemoryBeanProvider provider = inMemoryProviderClass.newInstance();
+ StatefulInMemoryBeanSearchService tempService = new StatefulInMemoryBeanSearchService(modelAccess.yField.getType());
+ tempService.addBeans(provider.getBeans());
+ service = tempService;
+ } catch (InstantiationException e) {
+ LOGGER.error("{}", e);
+ } catch (IllegalAccessException e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ if (service == null) {
+ service = searchServiceFactory.createService(modelAccess.yField.getType());
+ }
+ return service;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), field);
+ Util.applyCaptionIcons(getI18nService(), getResourceProvider(), modelAccess.getLabelI18nKey(), getLocale(),
+ new Util.ResourceCallback() {
+ @Override
+ public void setIcon(Resource resource) {
+ field.setSearchButtonIcon(resource);
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return field;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter
+ * #internalGetObservableEndpoint(org.eclipse.osbp
+ * .ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException("BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: " + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()), ExtensionModelPackage.Literals.YBEAN_REFERENCE_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YBeanReferenceField yField, BeanReferenceField<?> field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()), ExtensionModelPackage.Literals.YBEAN_REFERENCE_FIELD__VALUE, field));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return field;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return field != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (field != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) field.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(field);
+ }
+
+ // remove assocations
+ unassociateWidget(field);
+
+ if (field.getInternalComboBox() != null) {
+ unassociateWidget(field.getInternalComboBox());
+ }
+
+ field = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YBeanReferenceField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YBeanReferenceField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ *
+ * @param <M>
+ * the generic type
+ */
+ @SuppressWarnings("serial")
+ private class CustomField<M> extends BeanReferenceField<M> {
+
+ /**
+ * Instantiates a new custom field.
+ *
+ * @param id
+ * the id
+ * @param propertyId
+ * the property id
+ * @param type
+ * the type
+ * @param searchService
+ * the search service
+ * @param filter
+ * the filter
+ * @param sharedState
+ * the shared state
+ */
+ public CustomField(String id, Object propertyId, Class<M> type, IBeanSearchService<M> searchService, Filter filter,
+ ISharedStateContext sharedState) {
+ super(id, propertyId, type, searchService, filter, sharedState);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanReferenceField
+ * #initContent()
+ */
+ @Override
+ protected Component initContent() {
+ Component result = super.initContent();
+
+ associateWidget(field.getInternalComboBox(), getCastedModel());
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BooleanSearchFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BooleanSearchFieldPresentation.java
new file mode 100644
index 0000000..2a8260f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BooleanSearchFieldPresentation.java
@@ -0,0 +1,324 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YBooleanSearchField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBooleanSearchFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.BooleanSearchField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class BooleanSearchFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> implements IFilterProvidingPresentation {
+
+ /** The Constant LOGGER. */
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(BooleanSearchFieldPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The field. */
+ private BooleanSearchField field;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public BooleanSearchFieldPresentation(IElementEditpart editpart) {
+ super((IBooleanSearchFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YBooleanSearchField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (field == null) {
+ IECViewBindingManager bm = getViewContext().getService(
+ IECViewBindingManager.class.getName());
+ field = new BooleanSearchField(getEditpart().getId(),
+ modelAccess.yField.getPropertyPath(), bm.getDatabindingContext());
+ field.addStyleName(CSS_CLASS_CONTROL);
+ field.addStyleName(IConstants.CSS_CLASS_SEARCHFIELD);
+
+ field.setImmediate(true);
+ setupComponent(field, getCastedModel());
+
+ if (modelAccess.isCssIdValid()) {
+ field.setId(modelAccess.getCssID());
+ } else {
+ field.setId(getEditpart().getId());
+ }
+
+ associateWidget(field, modelAccess.yField);
+
+ property = new ObjectProperty<String>(null, String.class);
+ field.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, field);
+
+ if (modelAccess.isCssClassValid()) {
+ field.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(field);
+ }
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation#getFilter()
+ */
+ @Override
+ public Object getFilter() {
+ return field != null ? field.getFilter() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ II18nService service = getI18nService();
+ Util.applyCaptions(service, modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), field);
+
+ field.setDescription(service.getValue(IConstants.I18N_TOOLTIP_BOOLEANSEARCHFIELD, getLocale()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_SEARCH_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YBooleanSearchField yField,
+ BooleanSearchField field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_SEARCH_FIELD__VALUE, field));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return field != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (field != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) field.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(field);
+ }
+
+ // remove assocations
+ unassociateWidget(field);
+
+ field.dispose();
+ field = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YBooleanSearchField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YBooleanSearchField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BrowserPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BrowserPresentation.java
new file mode 100644
index 0000000..bde9b3c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/BrowserPresentation.java
@@ -0,0 +1,368 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YBrowser;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YBrowserStreamInput;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBrowserEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractEmbeddedWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.server.ExternalResource;
+import com.vaadin.server.Resource;
+import com.vaadin.server.StreamResource;
+import com.vaadin.ui.AbstractComponentContainer;
+import com.vaadin.ui.AbstractEmbedded;
+import com.vaadin.ui.BrowserFrame;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text area on the given layout.
+ */
+public class BrowserPresentation extends
+ AbstractEmbeddedWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(BrowserPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The source converter. */
+ private SourceConverter sourceConverter;
+
+ /** The browser. */
+ private BrowserFrame browser;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public BrowserPresentation(IElementEditpart editpart) {
+ super((IBrowserEditpart) editpart);
+ this.modelAccess = new ModelAccess((YBrowser) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (browser == null) {
+
+ browser = new BrowserFrame();
+ browser.addStyleName(CSS_CLASS_CONTROL);
+ browser.setImmediate(true);
+ setupComponent(browser, getCastedModel());
+
+ associateWidget(browser, modelAccess.yField);
+
+ if (modelAccess.isCssIdValid()) {
+ browser.setId(modelAccess.getCssID());
+ } else {
+ browser.setId(getEditpart().getId());
+ }
+
+ initialize(browser, getCastedModel());
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, browser, null);
+
+ if (modelAccess.isCssClassValid()) {
+ browser.addStyleName(modelAccess.getCssClass());
+ }
+
+ // set the captions
+ applyCaptions();
+ }
+ return browser;
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ * @param parent
+ * the parent
+ */
+ protected void createBindings(YBrowser yField, BrowserFrame field,
+ AbstractComponentContainer parent) {
+
+ // bind the model to the source converter
+ registerBinding(createBindingsSource(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YBROWSER__VALUE, field));
+
+ super.createBindings(yField, field, parent);
+ }
+
+ /**
+ * Creates the bindings source.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @return the binding
+ */
+ protected Binding createBindingsSource(EObject model,
+ EStructuralFeature modelFeature, AbstractEmbedded field) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+
+ sourceConverter = new SourceConverter();
+
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = PojoObservables.observeValue(
+ sourceConverter, "source");
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), browser);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return browser;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return browser != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (browser != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(browser);
+
+ Component parent = ((Component) browser.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(browser);
+ }
+ browser = null;
+ sourceConverter = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YBrowser yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YBrowser yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class SourceConverter.
+ */
+ @SuppressWarnings("serial")
+ private class SourceConverter {
+
+ /** The source. */
+ private Object source;
+
+ /**
+ * Gets the source.
+ *
+ * @return the source
+ */
+ @SuppressWarnings("unused")
+ public Object getSource() {
+ return source;
+ }
+
+ /**
+ * Sets the source.
+ *
+ * @param source
+ * the new source
+ * @throws MalformedURLException
+ * the malformed url exception
+ */
+ @SuppressWarnings("unused")
+ public void setSource(Object source) throws MalformedURLException {
+ this.source = source;
+
+ if (browser == null) {
+ LOGGER.error("Browser instance is null, but binding still active!");
+ return;
+ }
+
+ Resource resource = null;
+ if (source instanceof String) {
+ resource = new ExternalResource(new URL((String) source));
+ } else if (source instanceof YBrowserStreamInput) {
+ YBrowserStreamInput input = (YBrowserStreamInput) source;
+ final InputStream stream = input.getInputStream();
+ StreamResource tempResource = new StreamResource(
+ new StreamResource.StreamSource() {
+ @Override
+ public InputStream getStream() {
+ return stream;
+ }
+ }, input.getFilename());
+ tempResource.setMIMEType(input.getMimeType());
+ resource = tempResource;
+ }
+
+ browser.setSource(resource);
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java
new file mode 100644
index 0000000..fcddbdf
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ButtonPresentation.java
@@ -0,0 +1,272 @@
+/**
+ * Copyright (c) 2013 Loetz GmbH&Co.KG(Heidelberg). All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YButton;
+import org.eclipse.osbp.ecview.core.extension.model.extension.listener.YButtonClickListener;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IButtonEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class ButtonPresentation extends
+ AbstractVaadinWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The button. */
+ private Button button;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public ButtonPresentation(IElementEditpart editpart) {
+ super((IButtonEditpart) editpart);
+ this.modelAccess = new ModelAccess((YButton) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (button == null) {
+
+ button = new Button();
+ button.addStyleName(CSS_CLASS_CONTROL);
+ button.setImmediate(true);
+ setupComponent(button, getCastedModel());
+
+ associateWidget(button, modelAccess.yField);
+
+ if (modelAccess.isCssIdValid()) {
+ button.setId(modelAccess.getCssID());
+ } else {
+ button.setId(getEditpart().getId());
+ }
+
+ initialize(button, getCastedModel());
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, button);
+
+ if (modelAccess.isCssClassValid()) {
+ button.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ }
+ return button;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), button);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param button
+ * the button
+ */
+ @SuppressWarnings("serial")
+ protected void createBindings(final YButton yField, Button button) {
+ registerBinding(createBindingsButtonClick(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YBUTTON__LAST_CLICK_TIME, button));
+ registerBinding(createBindingsButtonImage(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YBUTTON__IMAGE, button));
+
+ super.createBindings(yField, button, null);
+
+ button.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ for (YButtonClickListener listener : new ArrayList<YButtonClickListener>(
+ yField.getClickListeners())) {
+ listener.clicked(yField);
+ }
+ }
+ });
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return button;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return button != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (button != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) button.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(button);
+ }
+
+ // remove assocations
+ unassociateWidget(button);
+
+ button = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YButton yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YButton yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CheckBoxPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CheckBoxPresentation.java
new file mode 100644
index 0000000..7f530dd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CheckBoxPresentation.java
@@ -0,0 +1,318 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a checkBox on the given layout.
+ */
+public class CheckBoxPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The check box. */
+ private CustomField checkBox;
+
+ /** The property. */
+ private ObjectProperty<Boolean> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public CheckBoxPresentation(IElementEditpart editpart) {
+ super((ICheckboxEditpart) editpart);
+ this.modelAccess = new ModelAccess((YCheckBox) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (checkBox == null) {
+
+ checkBox = new CustomField();
+ checkBox.addStyleName(CSS_CLASS_CONTROL);
+ checkBox.setImmediate(true);
+ setupComponent(checkBox, getCastedModel());
+
+ associateWidget(checkBox, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ checkBox.setId(modelAccess.getCssID());
+ } else {
+ checkBox.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<Boolean>(false, Boolean.class);
+ checkBox.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, checkBox);
+
+ if (modelAccess.isCssClassValid()) {
+ checkBox.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(checkBox);
+ }
+ return checkBox;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), checkBox);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return checkBox;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YCHECK_BOX__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YCheckBox yField, CheckBox field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YCHECK_BOX__VALUE, field));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return checkBox;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return checkBox != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (checkBox != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) checkBox.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(checkBox);
+ }
+
+ // remove assocations
+ unassociateWidget(checkBox);
+
+ checkBox = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YCheckBox yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YCheckBox yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomField extends CheckBox {
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java
new file mode 100644
index 0000000..47b7a52
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ComboBoxPresentation.java
@@ -0,0 +1,464 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IComboBoxEditpart;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItemContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+import org.eclipse.osbp.runtime.web.vaadin.components.widget.LazyLoadingComboBox;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Sortable;
+import com.vaadin.data.Property;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a combo box on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class ComboBoxPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(ComboBoxPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The combo. */
+ private LazyLoadingComboBox combo;
+
+ /** The property. */
+ @SuppressWarnings("rawtypes")
+ private ObjectProperty property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public ComboBoxPresentation(IElementEditpart editpart) {
+ super((IComboBoxEditpart) editpart);
+ this.modelAccess = new ModelAccess((YComboBox) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (combo == null) {
+
+ combo = new CustomComboBox();
+ combo.addStyleName(CSS_CLASS_CONTROL);
+ combo.setImmediate(true);
+ setupComponent(combo, getCastedModel());
+
+ associateWidget(combo, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ combo.setId(modelAccess.getCssID());
+ } else {
+ combo.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ combo.addStyleName(modelAccess.getCssClass());
+ }
+
+ try {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ combo.setPropertyDataSource(property);
+
+ if (modelAccess.yField.getType() != null) {
+ if (!modelAccess.yField.isUseBeanService()) {
+ DeepResolvingBeanItemContainer datasource = new DeepResolvingBeanItemContainer(
+ modelAccess.yField.getType());
+ combo.setContainerDataSource(datasource);
+ } else {
+ IBeanSearchServiceFactory factory = getViewContext()
+ .getService(
+ IBeanSearchServiceFactory.class
+ .getName());
+ if (factory != null) {
+ ISharedStateContext sharedState = getViewContext()
+ .getService(
+ ISharedStateContext.class.getName());
+ BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer(
+ factory.createService(modelAccess.yField
+ .getType()),
+ modelAccess.yField.getType(), sharedState);
+ combo.setContainerDataSource(datasource);
+ }
+ }
+ }
+
+ String itemCaptionProperty = modelAccess.yField
+ .getCaptionProperty();
+ if (itemCaptionProperty != null
+ && !itemCaptionProperty.equals("")) {
+ combo.setItemCaptionPropertyId(itemCaptionProperty);
+ combo.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+
+ Container container = combo.getContainerDataSource();
+ if (container instanceof Container.Sortable) {
+ Container.Sortable sortable = (Sortable) container;
+ sortable.sort(new Object[] { itemCaptionProperty },
+ new boolean[] { true });
+ }
+ } else {
+ combo.setItemCaptionMode(ItemCaptionMode.ID);
+ }
+
+ String itemImageProperty = modelAccess.yField
+ .getImageProperty();
+ if (itemImageProperty != null && !itemImageProperty.equals("")) {
+ combo.setItemIconPropertyId(itemImageProperty);
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, combo);
+
+ if (modelAccess.isCssClassValid()) {
+ combo.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(combo);
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ return combo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), combo);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return combo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YCOMBO_BOX__COLLECTION).observe(
+ getModel());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YComboBox yField, LazyLoadingComboBox field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_ContainerContents(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YCOMBO_BOX__COLLECTION, field,
+ yField.getType()));
+
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, field,
+ yField.getType()));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return combo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return combo != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (combo != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) combo.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(combo);
+ }
+
+ // remove assocations
+ unassociateWidget(combo);
+
+ combo = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YComboBox yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YComboBox yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to
+ * {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private static class CustomComboBox extends LazyLoadingComboBox {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ try {
+ if (icon instanceof String) {
+ return new ThemeResource((String) icon);
+ }
+ } catch (Exception e) {
+ // nothing to do
+ }
+ }
+ return null;
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CssLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CssLayoutPresentation.java
new file mode 100644
index 0000000..095b94b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/CssLayoutPresentation.java
@@ -0,0 +1,476 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YAlignment;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCssLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCssLayoutCellStyle;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.server.Responsive;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+import fi.jasoft.dragdroplayouts.DDCssLayout;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class CssLayoutPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ /** The Constant LOGGER. */
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(CssLayoutPresentation.class);
+
+ /** The css layout. */
+ private DDCssLayout cssLayout;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public CssLayoutPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess((YCssLayout) editpart.getModel());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#add(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void add(IEmbeddableEditpart editpart) {
+ super.add(editpart);
+
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#remove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void remove(IEmbeddableEditpart editpart) {
+ super.remove(editpart);
+
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#insert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ public void insert(IEmbeddableEditpart editpart, int index) {
+ super.insert(editpart, index);
+
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#updateCellStyle(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable)
+ */
+ public void updateCellStyle(YEmbeddable child) {
+ // refresh the whole ui
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#move(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ public void move(IEmbeddableEditpart editpart, int index) {
+ super.move(editpart, index);
+
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ if (!isRendered()) {
+ return;
+ }
+ cssLayout.removeAllComponents();
+
+ // iterate all elements and build the child element
+ //
+ List<Cell> cells = new ArrayList<Cell>();
+ for (IEmbeddableEditpart child : getEditpart().getElements()) {
+ Cell cell = addChild(child);
+ cells.add(cell);
+ }
+
+ cssLayout.setSizeUndefined();
+ }
+
+ /**
+ * Is called to create the child component and apply layouting defaults to
+ * it.
+ *
+ * @param editpart
+ * the editpart
+ * @return the cell
+ */
+ protected Cell addChild(IEmbeddableEditpart editpart) {
+
+ Component child = (Component) editpart.render(cssLayout);
+
+ child.setSizeUndefined();
+ cssLayout.addComponent(child);
+
+ return new Cell(child);
+ }
+
+ /**
+ * Maps the vertical part of the alignment to FILL.
+ *
+ * @param yAlignment
+ * the alignment
+ * @return alignment the mapped alignment
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ protected YAlignment mapToVerticalFill(YAlignment yAlignment) {
+ // END SUPRESS CATCH EXCEPTION
+ if (yAlignment != null) {
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ case MIDDLE_CENTER:
+ case TOP_CENTER:
+ return YAlignment.FILL_CENTER;
+ case BOTTOM_FILL:
+ case MIDDLE_FILL:
+ case TOP_FILL:
+ return YAlignment.FILL_FILL;
+ case BOTTOM_LEFT:
+ case MIDDLE_LEFT:
+ case TOP_LEFT:
+ return YAlignment.FILL_LEFT;
+ case BOTTOM_RIGHT:
+ case MIDDLE_RIGHT:
+ case TOP_RIGHT:
+ return YAlignment.FILL_RIGHT;
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ case FILL_CENTER:
+ return YAlignment.FILL_FILL;
+ default:
+ break;
+ }
+ }
+ return YAlignment.FILL_FILL;
+ }
+
+ /**
+ * Maps the horizontal part of the alignment to FILL.
+ *
+ * @param yAlignment
+ * the alignment
+ * @return alignment the mapped alignment
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ protected YAlignment mapToHorizontalFill(YAlignment yAlignment) {
+ // END SUPRESS CATCH EXCEPTION
+ if (yAlignment != null) {
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ case BOTTOM_FILL:
+ case BOTTOM_LEFT:
+ case BOTTOM_RIGHT:
+ return YAlignment.BOTTOM_FILL;
+ case MIDDLE_CENTER:
+ case MIDDLE_FILL:
+ case MIDDLE_LEFT:
+ case MIDDLE_RIGHT:
+ return YAlignment.MIDDLE_FILL;
+ case TOP_CENTER:
+ case TOP_FILL:
+ case TOP_LEFT:
+ case TOP_RIGHT:
+ return YAlignment.TOP_FILL;
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ case FILL_CENTER:
+ return YAlignment.FILL_FILL;
+ default:
+ break;
+ }
+ }
+ return YAlignment.FILL_FILL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (cssLayout == null) {
+
+ cssLayout = new DDCssLayout();
+ cssLayout.setImmediate(true);
+
+ setupComponent(cssLayout, getCastedModel());
+
+ associateWidget(cssLayout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ cssLayout.setId(modelAccess.getCssID());
+ } else {
+ cssLayout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ cssLayout.addStyleName(modelAccess.getCssClass());
+ } else {
+ cssLayout.addStyleName(CSS_CLASS_CONTROL);
+ }
+ cssLayout.addStyleName(IConstants.CSS_CLASS_CSSLAYOUT);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, cssLayout, null);
+
+ Responsive.makeResponsive(cssLayout);
+ initializeChildren();
+
+ // and now render children
+ renderChildren(false);
+ }
+
+ return cssLayout;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return cssLayout;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return cssLayout != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (cssLayout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(cssLayout);
+
+ // unrender the children
+ unrenderChildren();
+
+ cssLayout.removeAllComponents();
+ cssLayout = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#renderChildren(boolean)
+ */
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YCssLayout yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YCssLayout yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Gets the cell styles.
+ *
+ * @return the cell styles
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YGridLayout#getCellStyles()
+ */
+ @SuppressWarnings("unused")
+ public EList<YCssLayoutCellStyle> getCellStyles() {
+ return yLayout.getCellStyles();
+ }
+
+ }
+
+ /**
+ * The Class Cell.
+ */
+ public static class Cell {
+
+ /** The component. */
+ private final Component component;
+
+ /**
+ * Instantiates a new cell.
+ *
+ * @param component
+ * the component
+ */
+ public Cell(Component component) {
+ super();
+ this.component = component;
+ }
+
+ /**
+ * Gets the component.
+ *
+ * @return the component
+ */
+ protected Component getComponent() {
+ return component;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java
new file mode 100644
index 0000000..371d1c3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DateTimePresentation.java
@@ -0,0 +1,598 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.datatypes.YDatatype;
+import org.eclipse.osbp.ecview.core.emf.api.IDateFormatProvider;
+import org.eclipse.osbp.ecview.core.emf.api.IDateFormatProvider.Info;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeResolution;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IDateTimeEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.UI;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text area on the given layout.
+ */
+public class DateTimePresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The date field. */
+ private CustomField dateField;
+
+ /** The binding_value to ui. */
+ private Binding binding_valueToUI;
+
+ /** The property. */
+ private ObjectProperty<Date> property;
+
+ /** The format info. */
+ private Info formatInfo;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public DateTimePresentation(IElementEditpart editpart) {
+ super((IDateTimeEditpart) editpart);
+ this.modelAccess = new ModelAccess((YDateTime) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (dateField == null) {
+
+ dateField = new CustomField();
+ dateField.addStyleName(CSS_CLASS_CONTROL);
+ dateField.setImmediate(true);
+ setupComponent(dateField, getCastedModel());
+
+ associateWidget(dateField, modelAccess.yField);
+
+ if (modelAccess.isCssIdValid()) {
+ dateField.setId(modelAccess.getCssID());
+ } else {
+ dateField.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<Date>(null, Date.class);
+ dateField.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, dateField);
+
+ if (modelAccess.isCssClassValid()) {
+ dateField.addStyleName(modelAccess.getCssClass());
+ }
+
+ doApplyDatatype(modelAccess.yField.getDatatype());
+
+ applyCaptions();
+
+ initializeField(dateField);
+ }
+ return dateField;
+ }
+
+ /**
+ * Applies the datatype options to the field.
+ *
+ * @param yDt
+ * the y dt
+ */
+ protected void doApplyDatatype(YDatatype yDt) {
+ if (dateField == null) {
+ return;
+ }
+
+ IDateFormatProvider service = getViewContext().getService(
+ IDateFormatProvider.class.getName());
+ YDateTimeDatatype yDatatype = (YDateTimeDatatype) yDt;
+ if (service != null) {
+ formatInfo = service
+ .getInfo(yDatatype, UI.getCurrent().getLocale());
+ } else {
+ formatInfo = new DefaultDateFormatProvider().getInfo(yDatatype, UI
+ .getCurrent().getLocale());
+ }
+
+ dateField.setDateFormat(formatInfo.getDateFormat());
+ dateField.setResolution(mapToVaadin(formatInfo.getResolution()));
+ }
+
+ /**
+ * Map to vaadin.
+ *
+ * @param resolution
+ * the resolution
+ * @return the resolution
+ */
+ private Resolution mapToVaadin(YDateTimeResolution resolution) {
+ switch (resolution) {
+ case YEAR:
+ return Resolution.YEAR;
+ case MONTH:
+ return Resolution.MONTH;
+ case DAY:
+ return Resolution.DAY;
+ case HOUR:
+ return Resolution.HOUR;
+ case MINUTE:
+ return Resolution.MINUTE;
+ case SECOND:
+ return Resolution.SECOND;
+ case UNDEFINED:
+ return Resolution.DAY;
+ }
+
+ return Resolution.DAY;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // need to refresh the locale datetime pattern
+ doApplyDatatype(modelAccess.yField.getDatatype());
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), dateField);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return dateField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YDATE_TIME__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YDateTime yField, DateField field) {
+ // create the model binding from widget to ECView-model
+ binding_valueToUI = createBindingsValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YDATE_TIME__VALUE, field, null,
+ null);
+ registerBinding(binding_valueToUI);
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return dateField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return dateField != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (dateField != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) dateField.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(dateField);
+ }
+
+ // remove assocations
+ unassociateWidget(dateField);
+
+ dateField = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+
+ if (binding_valueToUI != null) {
+ binding_valueToUI.dispose();
+ binding_valueToUI = null;
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YDateTime yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YDateTime yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+
+ /**
+ * Returns true, if the date format is valid.
+ *
+ * @return true, if is dateformat valid
+ */
+ @SuppressWarnings("unused")
+ public boolean isDateformatValid() {
+ return yField.getDatadescription() != null
+ && yField.getDatatype().getFormat() != null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomField extends DateField {
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+
+ /**
+ * The Class DefaultDateFormatProvider.
+ */
+ private static class DefaultDateFormatProvider implements
+ IDateFormatProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.emf.api.IDateFormatProvider#getInfo(org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype, java.util.Locale)
+ */
+ @Override
+ public Info getInfo(YDateTimeDatatype yDt, Locale locale) {
+
+ if (yDt == null) {
+ DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT, locale);
+ return new IDateFormatProvider.Info(((SimpleDateFormat)formatter).toPattern(),
+ YDateTimeResolution.MINUTE);
+ }
+
+ DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale);
+ String pattern = ((SimpleDateFormat)formatter).toPattern();
+
+ String dateFormat = null;
+ YDateTimeResolution resolution = calcResolution(yDt);
+ YDateTimeFormat yFormat = yDt.getFormat();
+ if (yFormat != null) {
+ switch (yFormat) {
+ case DATE:
+ switch (resolution) {
+ case YEAR:
+ dateFormat = filterFormat(pattern, "yyyy");
+ break;
+ case MONTH:
+ dateFormat = filterFormat(pattern, "yyyy.MM");
+ break;
+ case DAY:
+ dateFormat = filterFormat(pattern, "yyyy.MM.dd");
+ break;
+ default:
+ throw new IllegalArgumentException(resolution
+ + " is not a valid resolution for " + yFormat);
+ }
+ break;
+ case DATE_TIME:
+ switch (resolution) {
+ case YEAR:
+ dateFormat = filterFormat(pattern, "yyyy");
+ break;
+ case MONTH:
+ dateFormat = filterFormat(pattern, "yyyy.MM");
+ break;
+ case DAY:
+ dateFormat = filterFormat(pattern, "yyyy.MM.dd");
+ break;
+ case HOUR:
+ dateFormat = filterFormat(pattern, "yyyy.MM.dd HH");
+ break;
+ case MINUTE:
+ dateFormat = filterFormat(pattern, "yyyy.MM.dd HH:mm");
+ break;
+ case SECOND:
+ dateFormat = filterFormat(pattern, "yyyy.MM.dd HH:mm:ss");
+ break;
+ default:
+ throw new IllegalArgumentException(resolution
+ + " is not a valid resolution for " + yFormat);
+ }
+ break;
+ case TIME:
+ switch (resolution) {
+ case HOUR:
+ dateFormat = filterFormat(pattern, "HH");
+ break;
+ case MINUTE:
+ dateFormat = filterFormat(pattern, "HH:mm");
+ break;
+ case SECOND:
+ dateFormat = filterFormat(pattern, "HH:mm:ss");
+ break;
+ default:
+ throw new IllegalArgumentException(resolution
+ + " is not a valid resolution for " + yFormat);
+ }
+ break;
+ }
+ }
+
+ return new IDateFormatProvider.Info(dateFormat, resolution);
+ }
+
+ /**
+ * filters from any localized date-time pattern the desired subset
+ * defined by filterPattern without destroying the original localized
+ * pattern .
+ *
+ * @param localizedPattern
+ * the localized full date-time pattern
+ * @param filterPattern
+ * the subset of desired date-time formatter patterns
+ * @return the string
+ */
+ private String filterFormat(String localizedPattern, String filterPattern) {
+ // remove any multiple characters sequences and remove all separator signs from filterPattern
+ String filter = filterPattern.replaceAll("(.)\\1+", "$1").replaceAll("[^\\w\\s]", "")+",";
+ // create a replacement pattern to remove unnecessary blanks disturbing the recognition of orphaned separators
+ // rule: each blank must be surrounded by any filter-letter to be valid
+ String invalidBlanks = "(?!["+filter+"])( )(?!["+filter+"])";
+ // create a replacement pattern to remove remaining separators without formatting function
+ // rule: each separator must be surrounded by any filter-letter or blank to be valid
+ String invalidSeparators = "(?!["+filter+" ])([.:])(?!["+filter+" ])";
+ return localizedPattern.replaceAll("[^"+filter+",.: ]", "").replaceAll(invalidBlanks, "").replaceAll(invalidSeparators, "");
+ }
+
+ /**
+ * Calc resolution.
+ *
+ * @param yDt
+ * the y dt
+ * @return the y date time resolution
+ */
+ private YDateTimeResolution calcResolution(YDateTimeDatatype yDt) {
+ YDateTimeFormat yFormat = yDt.getFormat();
+ YDateTimeResolution resolution = null;
+ if (yFormat != null) {
+ YDateTimeResolution yResolution = yDt.getResolution();
+ switch (yFormat) {
+ case DATE:
+ if (yResolution == YDateTimeResolution.UNDEFINED
+ || yResolution == YDateTimeResolution.SECOND
+ || yResolution == YDateTimeResolution.MINUTE
+ || yResolution == YDateTimeResolution.HOUR) {
+ resolution = YDateTimeResolution.DAY;
+ }
+ break;
+ case DATE_TIME:
+ if (yResolution == YDateTimeResolution.UNDEFINED
+ || yResolution == YDateTimeResolution.DAY
+ || yResolution == YDateTimeResolution.MONTH
+ || yResolution == YDateTimeResolution.YEAR) {
+ resolution = YDateTimeResolution.MINUTE;
+ }
+ break;
+ case TIME:
+ if (yResolution == YDateTimeResolution.UNDEFINED
+ || yResolution == YDateTimeResolution.DAY
+ || yResolution == YDateTimeResolution.MONTH
+ || yResolution == YDateTimeResolution.YEAR) {
+ resolution = YDateTimeResolution.MINUTE;
+ }
+ break;
+ }
+ }
+
+ if (resolution == null) {
+ switch (yDt.getResolution()) {
+ case SECOND:
+ resolution = YDateTimeResolution.SECOND;
+ break;
+ case MINUTE:
+ resolution = YDateTimeResolution.MINUTE;
+ break;
+ case HOUR:
+ resolution = YDateTimeResolution.HOUR;
+ break;
+ case DAY:
+ resolution = YDateTimeResolution.DAY;
+ break;
+ case MONTH:
+ resolution = YDateTimeResolution.MONTH;
+ break;
+ case YEAR:
+ resolution = YDateTimeResolution.YEAR;
+ break;
+ case UNDEFINED:
+ resolution = YDateTimeResolution.MINUTE;
+ break;
+ default:
+ resolution = YDateTimeResolution.MINUTE;
+ }
+ }
+
+ return resolution;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java
new file mode 100644
index 0000000..157b22b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DecimalFieldPresentation.java
@@ -0,0 +1,472 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YValueBindable;
+import org.eclipse.osbp.ecview.core.common.model.datatypes.YDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IDecimalFieldEditpart;
+import org.eclipse.osbp.ecview.core.util.emf.ModelUtil;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.DecimalField;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text area on the given layout.
+ */
+public class DecimalFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The decimal field. */
+ private CustomField decimalField;
+
+ /** The binding_value to ui. */
+ private Binding binding_valueToUI;
+
+ /** The property. */
+ private ObjectProperty<Double> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public DecimalFieldPresentation(IElementEditpart editpart) {
+ super((IDecimalFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess((YDecimalField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "serial" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (decimalField == null) {
+
+ decimalField = new CustomField((DecimalConverter) getConverter());
+ decimalField.addStyleName(CSS_CLASS_CONTROL);
+ decimalField.setImmediate(true);
+ setupComponent(decimalField, getCastedModel());
+
+ associateWidget(decimalField, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ decimalField.setId(modelAccess.getCssID());
+ } else {
+ decimalField.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<Double>(0d, Double.class);
+ decimalField.setPropertyDataSource(property);
+
+ decimalField
+ .addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (binding_valueToUI != null) {
+ updateUiToECViewModel();
+ }
+ }
+ });
+
+ if (modelAccess.isCssClassValid()) {
+ decimalField.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+ doApplyDatatype(modelAccess.yField.getDatatype());
+
+ initializeField(decimalField);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, decimalField);
+
+ // send an event, that the content was rendered again
+ sendRenderedLifecycleEvent();
+ }
+ return decimalField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter()
+ */
+ @Override
+ protected Converter<?, ?> getDefaultConverter() {
+ return new DecimalConverter();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doUpdateConverter(com.vaadin.data.util.converter.Converter)
+ */
+ @SuppressWarnings("rawtypes")
+ protected void doUpdateConverter(Converter converter) {
+ super.doUpdateConverter(converter);
+
+ // if converter changes, then apply the settings from datatype to it
+ doApplyDatatype(modelAccess.yField.getDatatype());
+ }
+
+ /**
+ * Applies the datatype options to the field.
+ *
+ * @param yDt
+ * the y dt
+ */
+ protected void doApplyDatatype(YDatatype yDt) {
+ if (decimalField == null) {
+ return;
+ }
+
+ int oldPrecision = decimalField.getPrecision();
+ if (yDt == null) {
+ decimalField.setPrecision(2);
+ decimalField.setUseGrouping(true);
+ decimalField.setMarkNegative(true);
+ } else {
+ YDecimalDatatype yCasted = (YDecimalDatatype) yDt;
+ decimalField.setPrecision(yCasted.getPrecision());
+ decimalField.setUseGrouping(yCasted.isGrouping());
+ decimalField.setMarkNegative(yCasted.isMarkNegative());
+ }
+
+ if (isRendered()) {
+ // if the precision changed, then update the value from the ui field
+ // to the ECViewModel
+ if (oldPrecision != decimalField.getPrecision()) {
+ updateUiToECViewModel();
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // update the captions
+ applyCaptions();
+
+ // tell the number field about the locale change
+ if(decimalField != null) {
+ decimalField.setLocale(locale);
+ }
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), decimalField);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return decimalField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YDECIMAL_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YDecimalField yField, DecimalField field) {
+ // create the model binding from ridget to ECView-model
+
+ binding_valueToUI = createModelBinding(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YDECIMAL_FIELD__VALUE, field,
+ null, null);
+
+ registerBinding(binding_valueToUI);
+
+ super.createBindings(yField, field, null);
+ }
+
+ /**
+ * Creates the model binding.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return the binding
+ */
+ protected Binding createModelBinding(EObject model,
+ EStructuralFeature modelFeature, AbstractField<?> field,
+ UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeConvertedValue(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ targetToModel, modelToTarget);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return decimalField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return decimalField != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (decimalField != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) decimalField.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(decimalField);
+ }
+
+ // remove assocations
+ unassociateWidget(decimalField);
+
+ decimalField = null;
+
+ sendUnrenderedLifecycleEvent();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ binding_valueToUI = null;
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * Update ui to ec view model.
+ */
+ protected void updateUiToECViewModel() {
+ if (binding_valueToUI != null) {
+ binding_valueToUI.updateTargetToModel();
+ }
+
+ Binding domainToEObjectBinding = ModelUtil
+ .getValueBinding((YValueBindable) getModel());
+ if (domainToEObjectBinding != null) {
+ domainToEObjectBinding.updateTargetToModel();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YDecimalField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YDecimalField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomField extends DecimalField {
+
+ /**
+ * Instantiates a new custom field.
+ *
+ * @param converter
+ * the converter
+ */
+ public CustomField(DecimalConverter converter) {
+ super("", converter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DialogPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DialogPresentation.java
new file mode 100644
index 0000000..a2f5bff
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/DialogPresentation.java
@@ -0,0 +1,444 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Collections;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager;
+import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.IDialogEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IBindableEndpointEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IBindableValueEndpointEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
+import org.eclipse.osbp.ecview.core.common.model.core.YDialog;
+import org.eclipse.osbp.ecview.core.common.presentation.IDialogPresentation;
+import org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler;
+import org.eclipse.osbp.ecview.core.util.emf.ModelUtil;
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.CloseEvent;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class DialogPresentation extends AbstractDisposable implements
+ IDialogPresentation<Component>, ILocaleChangedService.LocaleListener {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(DialogPresentation.class);
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /** The editpart. */
+ private final IDialogEditpart editpart;
+
+ /** The window. */
+ private Window window;
+
+ /** The content. */
+ private IEmbeddableEditpart content;
+
+ /** The input data binding endpoint. */
+ private Object inputDataBindingEndpoint;
+
+ /** The binding. */
+ private Binding binding;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart for that presentation.
+ */
+ public DialogPresentation(IElementEditpart editpart) {
+ this.editpart = (IDialogEditpart) editpart;
+ this.modelAccess = new ModelAccess((YDialog) editpart.getModel());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getModel()
+ */
+ @Override
+ public YDialog getModel() {
+ return (YDialog) editpart.getModel();
+ }
+
+ /**
+ * Returns the editpart the presenter will render for.
+ *
+ * @return editpart
+ */
+ public IDialogEditpart getEditpart() {
+ checkDisposed();
+ return editpart;
+ }
+
+ /**
+ * Is called to render the content.
+ */
+ protected void renderContent() {
+ if (!isRendered()) {
+ return;
+ }
+
+ window.setContent(null);
+
+ if (content != null) {
+ Component contentComponent = (Component) content.render(window);
+ window.setContent(contentComponent);
+ } else {
+ LOGGER.warn("Content is null");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("serial")
+ @Override
+ public Component createWidget(Object parent) {
+ if (window == null) {
+ // create component base with grid layout to enable margins
+ //
+ window = new Window();
+ window.addStyleName(IConstants.CSS_CLASS_CONTROL);
+
+ window.addCloseListener(new Window.CloseListener() {
+ @Override
+ public void windowClose(CloseEvent e) {
+ getEditpart().getView().closeDialog(getEditpart());
+ }
+ });
+
+ if (modelAccess.isCssIdValid()) {
+ window.setId(modelAccess.getCssID());
+ } else {
+ window.setId(editpart.getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ window.addStyleName(modelAccess.getCssClass());
+ }
+
+ // render the content
+ //
+ renderContent();
+
+ createBindings();
+
+ // register as an locale change listener
+ IViewContext context = ModelUtil.getViewContext(modelAccess.yDialog
+ .getView());
+ ILocaleChangedService service = context
+ .getService(ILocaleChangedService.ID);
+ if (service != null) {
+ service.addLocaleListener(this);
+ }
+
+ applyCaptions();
+
+ }
+ return window;
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), window);
+ }
+
+ /**
+ * Returns the active locale for the view.
+ *
+ * @return the locale
+ */
+ protected Locale getLocale() {
+ return getViewContext().getLocale();
+ }
+
+ /**
+ * Returns the i18n service or <code>null</code> if no service is available.
+ *
+ * @return the i18n service
+ */
+ protected II18nService getI18nService() {
+ return getViewContext().getService(II18nService.ID);
+ }
+
+ /**
+ * Creates the bindings.
+ */
+ private void createBindings() {
+ if (inputDataBindingEndpoint != null) {
+ // if input data is available, then bind values against that input
+
+ if (window.isAttached()) {
+ VaadinObservables.activateRealm(UI.getCurrent());
+ }
+ IECViewBindingManager bindingManager = getViewContext().getService(
+ IECViewBindingManager.class.getName());
+ IBindableValueEndpointEditpart modelValueEditpart = (IBindableValueEndpointEditpart) inputDataBindingEndpoint;
+ IObservableValue modelObservable = modelValueEditpart
+ .getObservable();
+
+ IObservableValue targetObservable = EMFObservables.observeValue(
+ (EObject) getModel(),
+ CoreModelPackage.Literals.YDIALOG__VALUE);
+ binding = bindingManager.bindValue(targetObservable,
+ modelObservable, new UpdateValueStrategy(
+ UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IDialogPresentation#setInputDataBindingEndpoint(org.eclipse.osbp.ecview.core.common.editpart.binding.IBindableEndpointEditpart)
+ */
+ @Override
+ public void setInputDataBindingEndpoint(
+ IBindableEndpointEditpart bindingEndpoint) {
+ this.inputDataBindingEndpoint = bindingEndpoint;
+
+ if (binding != null) {
+ binding.dispose();
+ binding = null;
+ }
+
+ if (isRendered()) {
+ createBindings();
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return window;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return window != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getUIBindings()
+ */
+ @Override
+ public Set<Binding> getUIBindings() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void unrender() {
+ if (window != null) {
+ // unregister as an locale change listener
+ IViewContext context = ModelUtil.getViewContext(modelAccess.yDialog
+ .getView());
+ ILocaleChangedService service = context
+ .getService(ILocaleChangedService.ID);
+ if (service != null) {
+ service.removeLocaleListener(this);
+ }
+
+ if (binding != null) {
+ binding.dispose();
+ binding = null;
+ }
+
+ ComponentContainer parent = ((ComponentContainer) window
+ .getParent());
+ if (parent != null) {
+ parent.removeComponent(window);
+ }
+ window = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ if (window != null) {
+ unrender();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IDialogPresentation#setContent(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void setContent(IEmbeddableEditpart editpart) {
+ this.content = editpart;
+ renderContent();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getViewContext()
+ */
+ @Override
+ public IViewContext getViewContext() {
+ return ModelUtil.getViewContext(getModel().getView());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getObservableValue(java.lang.Object)
+ */
+ @Override
+ public IObservable getObservableValue(Object model) {
+ throw new UnsupportedOperationException("Must be overridden!");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.IVisibilityProcessable#apply(org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler)
+ */
+ @Override
+ public void apply(IVisibilityHandler handler) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.IVisibilityProcessable#resetVisibilityProperties()
+ */
+ @Override
+ public void resetVisibilityProperties() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#notifyDatatypeChanged(org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent)
+ */
+ @Override
+ public void notifyDatatypeChanged(DatatypeChangeEvent event) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService.LocaleListener#localeChanged(java.util.Locale)
+ */
+ @Override
+ public void localeChanged(Locale locale) {
+ // pass the locale to the root element
+ window.setLocale(locale);
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y dialog. */
+ private final YDialog yDialog;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yDialog
+ * the y dialog
+ */
+ public ModelAccess(YDialog yDialog) {
+ super();
+ this.yDialog = yDialog;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yDialog.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yDialog.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yDialog.getDatadescription().getLabel();
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yDialog.getDatadescription().getLabelI18nKey();
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java
new file mode 100644
index 0000000..7259883
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumComboBoxPresentation.java
@@ -0,0 +1,477 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YEnumComboBox;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumComboBoxEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumConverter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumOptionBean;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumOptionBeanHelper;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService.ThemeResourceType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a combo box on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class EnumComboBoxPresentation extends AbstractFieldWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory.getLogger(EnumComboBoxPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The combo. */
+ private ComboBox combo;
+
+ /** The property. */
+ @SuppressWarnings("rawtypes")
+ private ObjectProperty property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public EnumComboBoxPresentation(IElementEditpart editpart) {
+ super((IEnumComboBoxEditpart) editpart);
+ this.modelAccess = new ModelAccess((YEnumComboBox) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (combo == null) {
+
+ combo = new CustomComboBox();
+ combo.addStyleName(CSS_CLASS_CONTROL);
+ combo.setImmediate(true);
+
+ setupComponent(combo, getCastedModel());
+
+ associateWidget(combo, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ combo.setId(modelAccess.getCssID());
+ } else {
+ combo.setId(getEditpart().getId());
+ }
+
+ try {
+ property = new ObjectProperty(null, modelAccess.yField.getType());
+ combo.setPropertyDataSource(property);
+
+ if (modelAccess.yField.getType() != null) {
+ BeanItemContainer<EnumOptionBean> datasource = createDatasource((Class<? extends Enum<?>>) modelAccess.yField.getType());
+ combo.setContainerDataSource(datasource);
+ }
+
+ combo.setConverter(getConverter());
+
+ combo.setItemCaptionPropertyId("description");
+ combo.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+ combo.setItemIconPropertyId("imagePath");
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, combo);
+
+ if (modelAccess.isCssClassValid()) {
+ combo.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(combo);
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ return combo;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter()
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ protected Converter getDefaultConverter() {
+ if (combo == null) {
+ return null;
+ }
+
+ return new EnumConverter((Class<Enum<?>>) modelAccess.yField.getType(), combo);
+ }
+
+ /**
+ * Creates the datasource used for the enum field.
+ *
+ * @param enumClass
+ * the enum class
+ * @return the bean item container
+ */
+ protected BeanItemContainer<EnumOptionBean> createDatasource(Class<? extends Enum<?>> enumClass) {
+ BeanItemContainer<EnumOptionBean> datasource = new BeanItemContainer<EnumOptionBean>(EnumOptionBean.class);
+ datasource.addAll(EnumOptionBeanHelper.getBeans(enumClass, getI18nService(), getLocale()));
+ return datasource;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), combo);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return combo;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core
+ * .YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException("BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ }
+ throw new IllegalArgumentException("Not a valid input: " + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(ExtensionModelPackage.Literals.YCOMBO_BOX__SELECTION, yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()), attributePath, modelAccess.yField.getType(), modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YEnumComboBox yField, ComboBox field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()), ExtensionModelPackage.Literals.YENUM_COMBO_BOX__SELECTION, field, yField.getType()));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return combo;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return combo != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (combo != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) combo.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(combo);
+ }
+
+ // remove assocations
+ unassociateWidget(combo);
+
+ combo = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YEnumComboBox yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YEnumComboBox yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private class CustomComboBox extends ComboBox {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /**
+ * Instantiates a new custom combo box.
+ */
+ public CustomComboBox() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getType()
+ */
+ @Override
+ public Class<?> getType() {
+ return EnumOptionBean.class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super.getItemIconPropertyId();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId, getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ try {
+ if (icon instanceof String) {
+ IThemeResourceService themeResourceService = getViewContext().getService(IThemeResourceService.class.getName());
+ return themeResourceService.getThemeResource((String) icon, ThemeResourceType.ICON);
+ }
+ } catch (Exception e) {
+ LOGGER.debug(e.getLocalizedMessage());
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java
new file mode 100644
index 0000000..129718a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumListPresentation.java
@@ -0,0 +1,501 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YEnumList;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumListEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumConverter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumOptionBean;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumOptionBeanHelper;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumSetConverter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.ListSelect;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a list box on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class EnumListPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(EnumListPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The list. */
+ private CustomList list;
+
+ /** The property. */
+ @SuppressWarnings("rawtypes")
+ private ObjectProperty property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public EnumListPresentation(IElementEditpart editpart) {
+ super((IEnumListEditpart) editpart);
+ this.modelAccess = new ModelAccess((YEnumList) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (list == null) {
+
+ list = new CustomList();
+ list.addStyleName(CSS_CLASS_CONTROL);
+ list.setImmediate(true);
+ list.setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI);
+
+ setupComponent(list, getCastedModel());
+
+ associateWidget(list, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ list.setId(modelAccess.getCssID());
+ } else {
+ list.setId(getEditpart().getId());
+ }
+
+ try {
+ if (list.isMultiSelect()) {
+ property = new ObjectProperty(new HashSet(), Set.class);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ } else {
+ property = new ObjectProperty(null, Object.class);
+ }
+ }
+ list.setPropertyDataSource(property);
+
+ if (modelAccess.yField.getType() != null) {
+ BeanItemContainer<EnumOptionBean> datasource = createDatasource((Class<? extends Enum<?>>) modelAccess.yField
+ .getType());
+ list.setContainerDataSource(datasource);
+ }
+
+ list.setConverter(getConverter());
+
+ list.setItemCaptionPropertyId("description");
+ list.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+ list.setItemIconPropertyId("imagePath");
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, list);
+
+ if (modelAccess.isCssClassValid()) {
+ list.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(list);
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter()
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ protected Converter getDefaultConverter() {
+ if(list == null) {
+ return null;
+ }
+
+ if (list.isMultiSelect()) {
+ return new EnumSetConverter(
+ (Class<Enum<?>>) modelAccess.yField.getType(), list);
+ } else {
+ return new EnumConverter(
+ (Class<Enum<?>>) modelAccess.yField.getType(), list);
+ }
+ }
+
+ /**
+ * Creates the datasource used for the enum field.
+ *
+ * @param enumClass
+ * the enum class
+ * @return the bean item container
+ */
+ protected BeanItemContainer<EnumOptionBean> createDatasource(
+ Class<? extends Enum<?>> enumClass) {
+ BeanItemContainer<EnumOptionBean> datasource = new BeanItemContainer<EnumOptionBean>(
+ EnumOptionBean.class);
+ datasource.addAll(EnumOptionBeanHelper.getBeans(enumClass,
+ getI18nService(), getLocale()));
+ return datasource;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), list);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YENUM_LIST__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YEnumList yField, ListSelect field) {
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsMultiSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YENUM_LIST__MULTI_SELECTION,
+ field, yField.getType()));
+ } else {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YENUM_LIST__SELECTION,
+ field, yField.getType()));
+
+ }
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return list != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (list != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) list.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(list);
+ }
+
+ // remove assocations
+ unassociateWidget(list);
+
+ list = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YEnumList yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YEnumList yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to
+ * {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private class CustomList extends ListSelect {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /**
+ * Instantiates a new custom list.
+ */
+ public CustomList() {
+ }
+
+ // @Override
+ // public Class<?> getType() {
+ // return EnumOptionBean.class;
+ // }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ try {
+ if (icon instanceof String) {
+ IResourceProvider provider = getViewContext()
+ .getService(IResourceProvider.class.getName());
+ return provider.getResource((String) icon);
+ }
+ } catch (Exception e) {
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java
new file mode 100644
index 0000000..eabd432
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/EnumOptionsGroupPresentation.java
@@ -0,0 +1,504 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YEnumOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumOptionsGroupEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumConverter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumOptionBean;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumOptionBeanHelper;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data.EnumSetConverter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.OptionGroup;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a list box on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class EnumOptionsGroupPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(EnumOptionsGroupPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The options group. */
+ private OptionGroup optionsGroup;
+
+ /** The property. */
+ @SuppressWarnings("rawtypes")
+ private ObjectProperty property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public EnumOptionsGroupPresentation(IElementEditpart editpart) {
+ super((IEnumOptionsGroupEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YEnumOptionsGroup) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (optionsGroup == null) {
+
+ optionsGroup = new CustomOptionsGroup();
+ optionsGroup.addStyleName(CSS_CLASS_CONTROL);
+ optionsGroup.setImmediate(true);
+ optionsGroup
+ .setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI);
+
+ setupComponent(optionsGroup, getCastedModel());
+
+ associateWidget(optionsGroup, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ optionsGroup.setId(modelAccess.getCssID());
+ } else {
+ optionsGroup.setId(getEditpart().getId());
+ }
+
+ try {
+ if (optionsGroup.isMultiSelect()) {
+ property = new ObjectProperty(new HashSet(), Set.class);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ } else {
+ property = new ObjectProperty(null, Object.class);
+ }
+ }
+ optionsGroup.setPropertyDataSource(property);
+
+ if (modelAccess.yField.getType() != null) {
+ BeanItemContainer<EnumOptionBean> datasource = createDatasource((Class<? extends Enum<?>>) modelAccess.yField
+ .getType());
+ optionsGroup.setContainerDataSource(datasource);
+ }
+
+ optionsGroup.setConverter(getConverter());
+
+ optionsGroup.setItemCaptionPropertyId("description");
+ optionsGroup.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+ optionsGroup.setItemIconPropertyId("imagePath");
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, optionsGroup);
+
+ if (modelAccess.isCssClassValid()) {
+ optionsGroup.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(optionsGroup);
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ }
+ }
+ return optionsGroup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter()
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ protected Converter getDefaultConverter() {
+ if(optionsGroup == null) {
+ return null;
+ }
+
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ return new EnumSetConverter(
+ (Class<Enum<?>>) modelAccess.yField.getType(), optionsGroup);
+ } else {
+ return new EnumConverter(
+ (Class<Enum<?>>) modelAccess.yField.getType(), optionsGroup);
+ }
+ }
+
+ /**
+ * Creates the datasource used for the enum field.
+ *
+ * @param enumClass
+ * the enum class
+ * @return the bean item container
+ */
+ protected BeanItemContainer<EnumOptionBean> createDatasource(
+ Class<? extends Enum<?>> enumClass) {
+ BeanItemContainer<EnumOptionBean> datasource = new BeanItemContainer<EnumOptionBean>(
+ EnumOptionBean.class);
+ datasource.addAll(EnumOptionBeanHelper.getBeans(enumClass,
+ getI18nService(), getLocale()));
+ return datasource;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), optionsGroup);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return optionsGroup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YENUM_OPTIONS_GROUP__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YEnumOptionsGroup yField, OptionGroup field) {
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ // create the model binding from widget to ECView-model
+ registerBinding(createBindingsMultiSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YENUM_OPTIONS_GROUP__MULTI_SELECTION,
+ field, yField.getType()));
+ } else {
+ // create the model binding from widget to ECView-model
+ registerBinding(createBindingsSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YENUM_OPTIONS_GROUP__SELECTION,
+ field, yField.getType()));
+
+ }
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return optionsGroup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return optionsGroup != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (optionsGroup != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) optionsGroup.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(optionsGroup);
+ }
+
+ // remove assocations
+ unassociateWidget(optionsGroup);
+
+ optionsGroup = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YEnumOptionsGroup yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YEnumOptionsGroup yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to
+ * {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private class CustomOptionsGroup extends OptionGroup {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /**
+ * Instantiates a new custom options group.
+ */
+ public CustomOptionsGroup() {
+ }
+
+ // @Override
+ // public Class<?> getType() {
+ // return EnumOptionBean.class;
+ // }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ try {
+ if (icon instanceof String) {
+ IResourceProvider provider = getViewContext()
+ .getService(IResourceProvider.class.getName());
+ return provider.getResource((String) icon);
+ }
+ } catch (Exception e) {
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FormLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FormLayoutPresentation.java
new file mode 100644
index 0000000..37fbafb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/FormLayoutPresentation.java
@@ -0,0 +1,452 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YFormLayout;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+import fi.jasoft.dragdroplayouts.DDFormLayout;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class FormLayoutPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ /** The Constant LOGGER. */
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(FormLayoutPresentation.class);
+
+ /** The form layout. */
+ private DDFormLayout formLayout;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public FormLayoutPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess((YFormLayout) editpart.getModel());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #updateCellStyle(org.eclipse.osbp.ecview.core.common
+ * .model.core.YEmbeddable)
+ */
+ public void updateCellStyle(YEmbeddable child) {
+ // refresh the whole ui
+ refreshUI();
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ formLayout.removeAllComponents();
+
+ // iterate all elements and build the child element
+ //
+ List<Cell> cells = new ArrayList<Cell>();
+ for (IEmbeddableEditpart child : getChildren()) {
+ cells.add(addChild(child));
+ }
+ }
+
+ /**
+ * Is called to create the child component and apply layouting defaults to
+ * it.
+ *
+ * @param editpart
+ * the editpart
+ * @return the cell
+ */
+ protected Cell addChild(IEmbeddableEditpart editpart) {
+
+ Component child = (Component) editpart.render(formLayout);
+
+ child.setSizeUndefined();
+ child.setWidth("100%");
+ formLayout.addComponent(child);
+
+ return new Cell(child);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (formLayout == null) {
+
+ formLayout = new DDFormLayout();
+ setupComponent(formLayout, getCastedModel());
+
+ associateWidget(formLayout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ formLayout.setId(modelAccess.getCssID());
+ } else {
+ formLayout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isMargin()) {
+ formLayout.addStyleName(IConstants.CSS_CLASS_MARGIN);
+ formLayout.setMargin(true);
+ }
+
+ if (!modelAccess.isSpacing()) {
+ formLayout.setSpacing(false);
+ } else {
+ formLayout.addStyleName(IConstants.CSS_CLASS_SPACING);
+ formLayout.setSpacing(true);
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ formLayout.addStyleName(modelAccess.getCssClass());
+ } else {
+ formLayout.addStyleName(CSS_CLASS_CONTROL);
+ }
+ formLayout.addStyleName(IConstants.CSS_CLASS_FORMLAYOUT);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, formLayout, null);
+
+ // initialize all children
+ initializeChildren();
+
+ renderChildren(false);
+ }
+
+ return formLayout;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return formLayout;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return formLayout != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (formLayout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // unrender the children
+ unrenderChildren();
+
+ // remove assocations
+ unassociateWidget(formLayout);
+
+ formLayout.removeAllComponents();
+ formLayout = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ for (IEmbeddableEditpart child : new ArrayList<IEmbeddableEditpart>(
+ getChildren())) {
+ child.dispose();
+ }
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalAdd(org.eclipse.osbp.ecview.core.common.editpart
+ * .IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ addChild(editpart);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalRemove(org.eclipse.osbp.ecview.core.common
+ * .editpart.IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (formLayout != null && child.isRendered()) {
+ // will happen during disposal since children already disposed.
+ formLayout.removeComponent((Component) child.getWidget());
+ }
+
+ child.unrender();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalInsert(org.eclipse.osbp.ecview.core.common
+ * .editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalMove(org.eclipse.osbp.ecview.core.common.editpart
+ * .IEmbeddableEditpart, int, int)
+ */
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#
+ * renderChildren(boolean)
+ */
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YFormLayout yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YFormLayout yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Checks if is spacing.
+ *
+ * @return true, if is spacing
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YFormLayout#isSpacing()
+ */
+ public boolean isSpacing() {
+ return yLayout.isSpacing();
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Checks if is margin.
+ *
+ * @return true, if is margin
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YFormLayout#isMargin()
+ */
+ public boolean isMargin() {
+ return yLayout.isMargin();
+ }
+ }
+
+ /**
+ * The Class Cell.
+ */
+ public static class Cell {
+
+ /** The component. */
+ private final Component component;
+
+ /**
+ * Instantiates a new cell.
+ *
+ * @param component
+ * the component
+ */
+ public Cell(Component component) {
+ super();
+ this.component = component;
+ }
+
+ /**
+ * Gets the component.
+ *
+ * @return the component
+ */
+ protected Component getComponent() {
+ return component;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/GridLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/GridLayoutPresentation.java
new file mode 100644
index 0000000..0fc1734
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/GridLayoutPresentation.java
@@ -0,0 +1,969 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YAlignment;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayoutCellStyle;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSpanInfo;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.GridLayout.Area;
+
+import fi.jasoft.dragdroplayouts.DDGridLayout;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class GridLayoutPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(GridLayoutPresentation.class);
+
+ /** The gridlayout. */
+ private DDGridLayout gridlayout;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public GridLayoutPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess((YGridLayout) editpart.getModel());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #add(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void add(IEmbeddableEditpart editpart) {
+ super.add(editpart);
+
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #remove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void remove(IEmbeddableEditpart editpart) {
+ super.remove(editpart);
+
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #updateCellStyle(org.eclipse.osbp.ecview.core.common
+ * .model.core.YEmbeddable)
+ */
+ public void updateCellStyle(YEmbeddable child) {
+ // refresh the whole ui
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #insert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart,
+ * int)
+ */
+ @Override
+ public void insert(IEmbeddableEditpart editpart, int index) {
+ super.insert(editpart, index);
+
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #move(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart,
+ * int)
+ */
+ @Override
+ public void move(IEmbeddableEditpart editpart, int index) {
+ super.move(editpart, index);
+
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ if (!isRendered()) {
+ return;
+ }
+ gridlayout.removeAllComponents();
+
+ // create a map containing the style for the embeddable
+ //
+ Map<YEmbeddable, YGridLayoutCellStyle> yStyles = new HashMap<YEmbeddable, YGridLayoutCellStyle>();
+ for (YGridLayoutCellStyle style : modelAccess.getCellStyles()) {
+ if (yStyles.containsKey(style.getTarget())) {
+ LOGGER.warn("Multiple style for element {}", style.getTarget());
+ }
+ yStyles.put(style.getTarget(), style);
+ }
+
+ // iterate all elements and build the child element
+ //
+ List<Cell> cells = new ArrayList<Cell>();
+ for (IEmbeddableEditpart editPart : getChildren()) {
+ YEmbeddable yChild = (YEmbeddable) editPart.getModel();
+ Cell cell = addChild(editPart, yStyles.get(yChild));
+ cells.add(cell);
+ }
+
+ // Build a model of rows and columns.
+ // Each coordinate (row/column) has an assigned cell. If a cell is
+ // spanned, it will be assigned to many coordinates.
+ List<Row> rows = new ArrayList<Row>();
+ for (int i = 0; i < gridlayout.getRows(); i++) {
+ rows.add(new Row(i, gridlayout.getColumns()));
+ }
+ List<Column> columns = new ArrayList<Column>();
+ for (int i = 0; i < gridlayout.getColumns(); i++) {
+ columns.add(new Column(i, gridlayout.getRows()));
+ }
+
+ for (Cell cell : cells) {
+ for (int r = cell.area.getRow1(); r <= cell.area.getRow2(); r++) {
+ for (int c = cell.area.getColumn1(); c <= cell.area
+ .getColumn2(); c++) {
+ Row row = rows.get(r);
+ row.addCell(c, cell);
+ Column col = columns.get(c);
+ col.addCell(r, cell);
+ }
+ }
+ }
+
+ for (Row row : rows) {
+ if (row.isShouldExpandVertical()) {
+ gridlayout.setRowExpandRatio(row.getRowindex(), 1.0f);
+ }
+ }
+
+ for (Column col : columns) {
+ if (col.isShouldExpandHorizontal()) {
+ gridlayout.setColumnExpandRatio(col.getColumnindex(), 1.0f);
+ }
+ }
+
+ gridlayout.setSizeUndefined();
+ }
+
+ /**
+ * Is called to create the child component and apply layouting defaults to
+ * it.
+ *
+ * @param editpart
+ * the editpart
+ * @param yStyle
+ * the y style
+ * @return the cell
+ */
+ protected Cell addChild(IEmbeddableEditpart editpart,
+ YGridLayoutCellStyle yStyle) {
+
+ Component child = (Component) editpart.render(gridlayout);
+
+ // calculate the spanning of the element
+ // and adds the child to the grid layout
+ //
+ int col1 = -1;
+ int row1 = -1;
+ int col2 = -1;
+ int row2 = -1;
+ if (yStyle != null) {
+ YSpanInfo ySpanInfo = yStyle.getSpanInfo();
+ if (ySpanInfo != null) {
+ col1 = ySpanInfo.getColumnFrom();
+ row1 = ySpanInfo.getRowFrom();
+ col2 = ySpanInfo.getColumnTo();
+ row2 = ySpanInfo.getRowTo();
+ }
+ }
+
+ // calculate and apply the alignment to be used
+ //
+ YAlignment yAlignment = yStyle != null && yStyle.getAlignment() != null ? yStyle
+ .getAlignment() : YAlignment.TOP_LEFT;
+
+ // add the element to the grid layout
+ //
+ if (col1 >= 0 && row1 >= 0 && (col1 < col2 || row1 < row2)) {
+ if (gridlayout.getRows() < row2 + 1) {
+ gridlayout.setRows(row2 + 1);
+ }
+ gridlayout.addComponent(child, col1, row1, col2, row2);
+ } else if (col1 < 0 || row1 < 0) {
+ gridlayout.addComponent(child);
+ } else {
+ gridlayout.addComponent(child);
+ LOGGER.warn("Invalid span: col1 {}, row1 {}, col2 {}, row2{}",
+ new Object[] { col1, row1, col2, row2 });
+ }
+ applyAlignment(child, yAlignment);
+
+ GridLayout.Area area = gridlayout.getComponentArea(child);
+
+ return new Cell(child, yAlignment, area);
+ }
+
+ /**
+ * Sets the alignment to the component.
+ *
+ * @param child
+ * the child
+ * @param yAlignment
+ * the y alignment
+ */
+ protected void applyAlignment(Component child, YAlignment yAlignment) {
+
+ if (yAlignment != null) {
+ child.setSizeUndefined();
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ gridlayout
+ .setComponentAlignment(child, Alignment.BOTTOM_CENTER);
+ break;
+ case BOTTOM_FILL:
+ gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
+ child.setWidth("100%");
+ break;
+ case BOTTOM_LEFT:
+ gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
+ break;
+ case BOTTOM_RIGHT:
+ gridlayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
+ break;
+ case MIDDLE_CENTER:
+ gridlayout
+ .setComponentAlignment(child, Alignment.MIDDLE_CENTER);
+ break;
+ case MIDDLE_FILL:
+ gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
+ child.setWidth("100%");
+ break;
+ case MIDDLE_LEFT:
+ gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
+ break;
+ case MIDDLE_RIGHT:
+ gridlayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
+ break;
+ case TOP_CENTER:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER);
+ break;
+ case TOP_FILL:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setWidth("100%");
+ break;
+ case TOP_LEFT:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ break;
+ case TOP_RIGHT:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
+ break;
+ case FILL_CENTER:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER);
+ child.setHeight("100%");
+ break;
+ case FILL_FILL:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setSizeFull();
+ // child.setHeight("100%");
+ break;
+ case FILL_LEFT:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setHeight("100%");
+ break;
+ case FILL_RIGHT:
+ gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
+ child.setHeight("100%");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * Maps the vertical part of the alignment to FILL.
+ *
+ * @param yAlignment
+ * the alignment
+ * @return alignment the mapped alignment
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ protected YAlignment mapToVerticalFill(YAlignment yAlignment) {
+ // END SUPRESS CATCH EXCEPTION
+ if (yAlignment != null) {
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ case MIDDLE_CENTER:
+ case TOP_CENTER:
+ return YAlignment.FILL_CENTER;
+ case BOTTOM_FILL:
+ case MIDDLE_FILL:
+ case TOP_FILL:
+ return YAlignment.FILL_FILL;
+ case BOTTOM_LEFT:
+ case MIDDLE_LEFT:
+ case TOP_LEFT:
+ return YAlignment.FILL_LEFT;
+ case BOTTOM_RIGHT:
+ case MIDDLE_RIGHT:
+ case TOP_RIGHT:
+ return YAlignment.FILL_RIGHT;
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ case FILL_CENTER:
+ return YAlignment.FILL_FILL;
+ default:
+ break;
+ }
+ }
+ return YAlignment.FILL_FILL;
+ }
+
+ /**
+ * Maps the horizontal part of the alignment to FILL.
+ *
+ * @param yAlignment
+ * the alignment
+ * @return alignment the mapped alignment
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ protected YAlignment mapToHorizontalFill(YAlignment yAlignment) {
+ // END SUPRESS CATCH EXCEPTION
+ if (yAlignment != null) {
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ case BOTTOM_FILL:
+ case BOTTOM_LEFT:
+ case BOTTOM_RIGHT:
+ return YAlignment.BOTTOM_FILL;
+ case MIDDLE_CENTER:
+ case MIDDLE_FILL:
+ case MIDDLE_LEFT:
+ case MIDDLE_RIGHT:
+ return YAlignment.MIDDLE_FILL;
+ case TOP_CENTER:
+ case TOP_FILL:
+ case TOP_LEFT:
+ case TOP_RIGHT:
+ return YAlignment.TOP_FILL;
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ case FILL_CENTER:
+ return YAlignment.FILL_FILL;
+ default:
+ break;
+ }
+ }
+ return YAlignment.FILL_FILL;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (gridlayout == null) {
+
+ gridlayout = new DDGridLayout(modelAccess.getColumns(), 1);
+ gridlayout.setSpacing(false);
+ gridlayout.setImmediate(true);
+
+ // register the designer drop handler here
+ setupComponent(gridlayout, getCastedModel());
+
+ associateWidget(gridlayout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ gridlayout.setId(modelAccess.getCssID());
+ } else {
+ gridlayout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isMargin()) {
+ gridlayout.addStyleName(IConstants.CSS_CLASS_MARGIN);
+ gridlayout.setMargin(true);
+ }
+
+ if (modelAccess.isSpacing()) {
+ gridlayout.addStyleName(IConstants.CSS_CLASS_SPACING);
+ gridlayout.setSpacing(true);
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ gridlayout.addStyleName(modelAccess.getCssClass());
+ } else {
+ gridlayout.addStyleName(CSS_CLASS_CONTROL);
+ }
+ gridlayout.addStyleName(IConstants.CSS_CLASS_GRIDLAYOUT);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, gridlayout, null);
+
+ initializeChildren();
+
+ // and now render children
+ renderChildren(false);
+ }
+
+ return gridlayout;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return gridlayout;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return gridlayout != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (gridlayout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ ComponentContainer parent = ((ComponentContainer) gridlayout
+ .getParent());
+ if (parent != null) {
+ parent.removeComponent(gridlayout);
+ }
+
+ // remove assocations
+ unassociateWidget(gridlayout);
+
+ gridlayout.removeAllComponents();
+ gridlayout = null;
+
+ // unrender the childs
+ for (IEmbeddableEditpart child : getChildren()) {
+ child.unrender();
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#
+ * renderChildren(boolean)
+ */
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YGridLayout yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YGridLayout yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Checks if is spacing.
+ *
+ * @return true, if is spacing
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YGridLayout#isSpacing()
+ */
+ public boolean isSpacing() {
+ return yLayout.isSpacing();
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Checks if is margin.
+ *
+ * @return true, if is margin
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YGridLayout#isMargin()
+ */
+ public boolean isMargin() {
+ return yLayout.isMargin();
+ }
+
+ /**
+ * Gets the columns.
+ *
+ * @return the columns
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YGridLayout#getColumns()
+ */
+ public int getColumns() {
+ int columns = yLayout.getColumns();
+ return columns <= 0 ? 2 : columns;
+ }
+
+ /**
+ * Gets the cell styles.
+ *
+ * @return the cell styles
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YGridLayout#getCellStyles()
+ */
+ public EList<YGridLayoutCellStyle> getCellStyles() {
+ return yLayout.getCellStyles();
+ }
+
+ }
+
+ /**
+ * The Class Row.
+ */
+ private static class Row {
+
+ /** The rowindex. */
+ private int rowindex;
+
+ /** The cells. */
+ private List<Cell> cells;
+
+ /** The should expand vertical. */
+ private boolean shouldExpandVertical;
+
+ /**
+ * Instantiates a new row.
+ *
+ * @param rowindex
+ * the rowindex
+ * @param columns
+ * the columns
+ */
+ private Row(int rowindex, int columns) {
+ this.rowindex = rowindex;
+ cells = new ArrayList<Cell>(columns);
+ }
+
+ /**
+ * Adds the cell.
+ *
+ * @param column
+ * the column
+ * @param cell
+ * the cell
+ */
+ public void addCell(int column, Cell cell) {
+ cells.add(column, cell);
+
+ YAlignment alignment = cell.getAlignment();
+ // if not already sure, that it should expand
+ // try to find out
+ if (!shouldExpandVertical) {
+ // If the cell should FILL-vertical, then we test if the cell is
+ // spanned.
+ // --> If not spanned, then "shouldExpandVertical" is true.
+ // --> Otherwise we test, if the cell is the most bottom cell.
+ // ----> If not most bottom, then no span.
+ // ----> Otherwise "shouldExpandVertical" is true.
+ switch (alignment) {
+ case FILL_LEFT:
+ case FILL_CENTER:
+ case FILL_RIGHT:
+ case FILL_FILL:
+ if (!cell.isSpanned()) {
+ // if the cell is not spanned, then
+ // "shouldExpandHorizontal" is true
+ shouldExpandVertical = true;
+ } else {
+ if (cell.getArea().getRow2() == rowindex) {
+ // if the cell is the most right one, then
+ // "shouldExpandHorizontal" is true
+ shouldExpandVertical = true;
+ }
+ }
+ break;
+ default:
+ // nothing to do
+ break;
+ }
+ }
+ }
+
+ /**
+ * Gets the rowindex.
+ *
+ * @return the rowindex
+ */
+ protected int getRowindex() {
+ return rowindex;
+ }
+
+ /**
+ * Checks if is should expand vertical.
+ *
+ * @return the shouldExpandVertical
+ */
+ protected boolean isShouldExpandVertical() {
+ return shouldExpandVertical;
+ }
+
+ }
+
+ /**
+ * The Class Column.
+ */
+ private static class Column {
+
+ /** The columnindex. */
+ private final int columnindex;
+
+ /** The cells. */
+ private List<Cell> cells;
+
+ /** The should expand horizontal. */
+ private boolean shouldExpandHorizontal;
+
+ /**
+ * Instantiates a new column.
+ *
+ * @param columnindex
+ * the columnindex
+ * @param rows
+ * the rows
+ */
+ private Column(int columnindex, int rows) {
+ this.columnindex = columnindex;
+ cells = new ArrayList<Cell>(rows);
+ }
+
+ /**
+ * Adds the cell.
+ *
+ * @param row
+ * the row
+ * @param cell
+ * the cell
+ */
+ public void addCell(int row, Cell cell) {
+ try {
+ cells.add(row, cell);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ YAlignment alignment = cell.getAlignment();
+ // if not already sure, that it should expand
+ // try to find out
+ if (!shouldExpandHorizontal) {
+ // If the cell should FILL-horizontal, then we test if the cell
+ // is spanned.
+ // --> If not spanned, then "shouldExpandHorizontal" is true.
+ // --> Otherwise we test, if the cell is the most right cell.
+ // ----> If not most right, then no span.
+ // ----> Otherwise "shouldExpandHorizontal" is true.
+ switch (alignment) {
+ case BOTTOM_FILL:
+ case MIDDLE_FILL:
+ case TOP_FILL:
+ case FILL_FILL:
+ if (!cell.isSpanned()) {
+ // if the cell is not spanned, then
+ // "shouldExpandHorizontal" is true
+ shouldExpandHorizontal = true;
+ } else {
+ if (cell.getArea().getColumn2() == cells.size() - 1) {
+ // if the cell is the most right one, then
+ // "shouldExpandHorizontal" is true
+ shouldExpandHorizontal = true;
+ }
+ }
+ break;
+ default:
+ // nothing to do
+ break;
+ }
+ }
+ }
+
+ /**
+ * Gets the columnindex.
+ *
+ * @return the columnindex
+ */
+ protected int getColumnindex() {
+ return columnindex;
+ }
+
+ /**
+ * Checks if is should expand horizontal.
+ *
+ * @return the shouldExpandHorizontal
+ */
+ protected boolean isShouldExpandHorizontal() {
+ return shouldExpandHorizontal;
+ }
+
+ }
+
+ /**
+ * The Class Cell.
+ */
+ public static class Cell {
+
+ /** The component. */
+ private final Component component;
+
+ /** The alignment. */
+ private final YAlignment alignment;
+
+ /** The area. */
+ private final Area area;
+
+ /**
+ * Instantiates a new cell.
+ *
+ * @param component
+ * the component
+ * @param alignment
+ * the alignment
+ * @param area
+ * the area
+ */
+ public Cell(Component component, YAlignment alignment,
+ GridLayout.Area area) {
+ super();
+ this.component = component;
+ this.alignment = alignment;
+ this.area = area;
+ }
+
+ /**
+ * Gets the component.
+ *
+ * @return the component
+ */
+ protected Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Gets the alignment.
+ *
+ * @return the alignment
+ */
+ protected YAlignment getAlignment() {
+ return alignment;
+ }
+
+ /**
+ * Gets the area.
+ *
+ * @return the area
+ */
+ protected Area getArea() {
+ return area;
+ }
+
+ /**
+ * Returns true, if the cell is spanned.
+ *
+ * @return true, if is spanned
+ */
+ public boolean isSpanned() {
+ return area.getRow1() != area.getRow2()
+ || area.getColumn1() != area.getColumn2();
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java
new file mode 100644
index 0000000..720d42f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/HorizontalLayoutPresentation.java
@@ -0,0 +1,615 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YAlignment;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YHorizontalLayoutCellStyle;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+import fi.jasoft.dragdroplayouts.DDHorizontalLayout;
+import fi.jasoft.dragdroplayouts.drophandlers.DefaultHorizontalLayoutDropHandler;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class HorizontalLayoutPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(HorizontalLayoutPresentation.class);
+
+ /** The horizontal layout. */
+ private DDHorizontalLayout horizontalLayout;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that editpart.
+ */
+ public HorizontalLayoutPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YHorizontalLayout) editpart.getModel());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#updateCellStyle(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable)
+ */
+ public void updateCellStyle(YEmbeddable child) {
+ // refresh the whole ui
+ refreshUI();
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the layout
+ * and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ horizontalLayout.removeAllComponents();
+
+ // create a map containing the style for the embeddable
+ //
+ Map<YEmbeddable, YHorizontalLayoutCellStyle> yStyles = new HashMap<YEmbeddable, YHorizontalLayoutCellStyle>();
+ for (YHorizontalLayoutCellStyle style : modelAccess.getCellStyles()) {
+ if (yStyles.containsKey(style.getTarget())) {
+ LOGGER.warn("Multiple style for element {}", style.getTarget());
+ }
+ yStyles.put(style.getTarget(), style);
+ }
+
+ // iterate all elements and build the child element
+ //
+ List<Cell> cells = new ArrayList<Cell>();
+ for (IEmbeddableEditpart child : getChildren()) {
+ YEmbeddable yChild = (YEmbeddable) child.getModel();
+ cells.add(addChild(child, yStyles.get(yChild)));
+ }
+
+ for (Cell cell : cells) {
+ if (cell.isExpandHorizontal()) {
+ horizontalLayout.setExpandRatio(cell.getComponent(), 1.0f);
+ }
+ }
+
+ // if (!modelAccess.isFillHorizontal()) {
+ // fillerLayout = new CssLayout();
+ // fillerLayout.setSizeFull();
+ // fillerLayout.addStyleName(CSS_CLASS_COMPRESSOR);
+ // horizontalLayout.addComponent(fillerLayout);
+ // horizontalLayout.setExpandRatio(fillerLayout, 1.0f);
+ // } else {
+ // horizontalLayout.setWidth("100%");
+ // }
+ //
+ // horizontalLayout.setHeight("100%");
+
+ }
+
+ /**
+ * Is called to create the child component and apply layouting defaults to
+ * it.
+ *
+ * @param editpart
+ * the editpart
+ * @param yStyle
+ * the y style
+ * @return the cell
+ */
+ protected Cell addChild(IEmbeddableEditpart editpart,
+ YHorizontalLayoutCellStyle yStyle) {
+
+ Component child = (Component) editpart.render(horizontalLayout);
+
+ // calculate and apply the alignment to be used
+ //
+ YAlignment yAlignment = yStyle != null && yStyle.getAlignment() != null ? yStyle
+ .getAlignment() : YAlignment.TOP_LEFT;
+
+ horizontalLayout.addComponent(child);
+ applyAlignment(child, yAlignment);
+
+ return new Cell(child, yAlignment);
+ }
+
+ /**
+ * Sets the alignment to the component.
+ *
+ * @param child
+ * the child
+ * @param yAlignment
+ * the y alignment
+ */
+ protected void applyAlignment(Component child, YAlignment yAlignment) {
+
+ if (yAlignment != null) {
+ child.setSizeUndefined();
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_CENTER);
+ break;
+ case BOTTOM_FILL:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_LEFT);
+ child.setWidth("100%");
+ break;
+ case BOTTOM_LEFT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_LEFT);
+ break;
+ case BOTTOM_RIGHT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_RIGHT);
+ break;
+ case MIDDLE_CENTER:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_CENTER);
+ break;
+ case MIDDLE_FILL:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_LEFT);
+ child.setWidth("100%");
+ break;
+ case MIDDLE_LEFT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_LEFT);
+ break;
+ case MIDDLE_RIGHT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_RIGHT);
+ break;
+ case TOP_CENTER:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_CENTER);
+ break;
+ case TOP_FILL:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_LEFT);
+ child.setWidth("100%");
+ break;
+ case TOP_LEFT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_LEFT);
+ break;
+ case TOP_RIGHT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_RIGHT);
+ break;
+ case FILL_CENTER:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_CENTER);
+ child.setHeight("100%");
+ break;
+ case FILL_FILL:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_LEFT);
+ if (child.getWidth() == -1
+ || child.getWidthUnits() == Unit.PERCENTAGE)
+ child.setWidth("100%");
+ if (child.getHeight() == -1
+ || child.getHeightUnits() == Unit.PERCENTAGE)
+ child.setHeight("100%");
+ break;
+ case FILL_LEFT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_LEFT);
+ child.setHeight("100%");
+ break;
+ case FILL_RIGHT:
+ horizontalLayout.setComponentAlignment(child,
+ Alignment.TOP_RIGHT);
+ child.setHeight("100%");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (horizontalLayout == null) {
+
+ horizontalLayout = new DDHorizontalLayout();
+ setupComponent(horizontalLayout, getCastedModel());
+
+ associateWidget(horizontalLayout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ horizontalLayout.setId(modelAccess.getCssID());
+ } else {
+ horizontalLayout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isMargin()) {
+ horizontalLayout.addStyleName(IConstants.CSS_CLASS_MARGIN);
+ horizontalLayout.setMargin(true);
+ }
+
+ if (!modelAccess.isSpacing()) {
+ horizontalLayout.setSpacing(false);
+ } else {
+ horizontalLayout.addStyleName(IConstants.CSS_CLASS_SPACING);
+ horizontalLayout.setSpacing(true);
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ horizontalLayout.addStyleName(modelAccess.getCssClass());
+ } else {
+ horizontalLayout.addStyleName(CSS_CLASS_CONTROL);
+ }
+ horizontalLayout
+ .addStyleName(IConstants.CSS_CLASS_HORIZONTALLAYOUT);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, horizontalLayout, null);
+
+ // initialize all children
+ initializeChildren();
+
+ // and now render children
+ renderChildren(false);
+ }
+
+ return horizontalLayout;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return horizontalLayout;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return horizontalLayout != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (horizontalLayout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(horizontalLayout);
+
+ // unrender the children
+ unrenderChildren();
+
+ horizontalLayout.removeAllComponents();
+ horizontalLayout = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalAdd(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ YEmbeddable yChild = (YEmbeddable) editpart.getModel();
+ addChild(editpart, modelAccess.getCellStyle(yChild));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalRemove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (horizontalLayout != null && child.isRendered()) {
+ // will happen during disposal since children already disposed.
+ horizontalLayout.removeComponent((Component) child.getWidget());
+ }
+
+ child.unrender();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalInsert(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter#internalMove(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart, int, int)
+ */
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#renderChildren(boolean)
+ */
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ // TODO Pirchner - remove undrendered from componentLayout
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YHorizontalLayout yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YHorizontalLayout yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Checks if is spacing.
+ *
+ * @return true, if is spacing
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YHorizontalLayout#isSpacing()
+ */
+ public boolean isSpacing() {
+ return yLayout.isSpacing();
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Checks if is margin.
+ *
+ * @return true, if is margin
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YHorizontalLayout#isMargin()
+ */
+ public boolean isMargin() {
+ return yLayout.isMargin();
+ }
+
+ /**
+ * Gets the cell styles.
+ *
+ * @return the cell styles
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YHorizontalLayout#getCellStyles()
+ */
+ public EList<YHorizontalLayoutCellStyle> getCellStyles() {
+ return yLayout.getCellStyles();
+ }
+
+ /**
+ * Gets the cell style.
+ *
+ * @param element
+ * the element
+ * @return the cell style
+ */
+ public YHorizontalLayoutCellStyle getCellStyle(YEmbeddable element) {
+ return yLayout.getCellStyle(element);
+ }
+
+ }
+
+ /**
+ * The Class Cell.
+ */
+ public static class Cell {
+
+ /** The component. */
+ private final Component component;
+
+ /** The alignment. */
+ private final YAlignment alignment;
+
+ /**
+ * Instantiates a new cell.
+ *
+ * @param component
+ * the component
+ * @param alignment
+ * the alignment
+ */
+ public Cell(Component component, YAlignment alignment) {
+ super();
+ this.component = component;
+ this.alignment = alignment;
+ }
+
+ /**
+ * Gets the component.
+ *
+ * @return the component
+ */
+ protected Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Gets the alignment.
+ *
+ * @return the alignment
+ */
+ protected YAlignment getAlignment() {
+ return alignment;
+ }
+
+ /**
+ * Checks if is expand vertical.
+ *
+ * @return true, if is expand vertical
+ */
+ protected boolean isExpandVertical() {
+ switch (alignment) {
+ case FILL_CENTER:
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks if is expand horizontal.
+ *
+ * @return true, if is expand horizontal
+ */
+ protected boolean isExpandHorizontal() {
+ switch (alignment) {
+ case BOTTOM_FILL:
+ case FILL_FILL:
+ case MIDDLE_FILL:
+ case TOP_FILL:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java
new file mode 100644
index 0000000..3da2ff4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ImagePresentation.java
@@ -0,0 +1,270 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YImage;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IImageEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractEmbeddedWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Embedded;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text area on the given layout.
+ */
+public class ImagePresentation extends
+ AbstractEmbeddedWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The image. */
+ private Embedded image;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public ImagePresentation(IElementEditpart editpart) {
+ super((IImageEditpart) editpart);
+ this.modelAccess = new ModelAccess((YImage) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (image == null) {
+
+ image = new Embedded();
+ image.addStyleName(CSS_CLASS_CONTROL);
+ image.setImmediate(true);
+ setupComponent(image, getCastedModel());
+
+ associateWidget(image, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ image.setId(modelAccess.getCssID());
+ } else {
+ image.setId(getEditpart().getId());
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, image, null);
+
+ if (modelAccess.isCssClassValid()) {
+ image.addStyleName(modelAccess.getCssClass());
+ }
+
+ // set the captions
+ applyCaptions();
+ }
+ return image;
+ }
+//TODO: check the return type - the documentation and the implementation do not match
+ /**
+ * Creates the bindings from the ECView EMF model to the given UI element.
+ *
+ * @param yField
+ * the y field
+ * @param widget
+ * the widget
+ * @param container
+ * the container
+ *
+ * return Binding - the created binding
+ */
+ protected void createBindings(YImage yField, AbstractComponent widget,
+ AbstractComponent container) {
+
+ IObservableValue modelObservable = EMFObservables.observeValue(yField,
+ ExtensionModelPackage.Literals.YIMAGE__VALUE);
+ IObservableValue uiObservable = VaadinObservables.observeSource(image);
+
+ IConverter stringToResourceConverter = new Converter(String.class,
+ Resource.class) {
+ @Override
+ public Object convert(Object fromObject) {
+ return (fromObject != null && !fromObject.equals("")) ? new ThemeResource(
+ (String) fromObject) : null;
+ }
+ };
+ registerBinding(createBindings(uiObservable, modelObservable,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE)
+ .setConverter(stringToResourceConverter)));
+
+ super.createBindings(yField, widget, container);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), image);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return image;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return image != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (image != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(image);
+
+ Component parent = ((Component) image.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(image);
+ }
+ image = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YImage yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YImage yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/LabelPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/LabelPresentation.java
new file mode 100644
index 0000000..555621f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/LabelPresentation.java
@@ -0,0 +1,254 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YLabel;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ILabelEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractEmbeddedWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Label;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class LabelPresentation extends
+ AbstractEmbeddedWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The label. */
+ private Label label;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public LabelPresentation(IElementEditpart editpart) {
+ super((ILabelEditpart) editpart);
+ this.modelAccess = new ModelAccess((YLabel) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (label == null) {
+
+ label = new Label();
+ label.addStyleName(CSS_CLASS_CONTROL);
+ label.setImmediate(true);
+ setupComponent(label, getCastedModel());
+
+ if (modelAccess.isCssIdValid()) {
+ label.setId(modelAccess.getCssID());
+ } else {
+ label.setId(getEditpart().getId());
+ }
+
+ associateWidget(label, modelAccess.yField);
+
+ property = new ObjectProperty<String>("", String.class);
+ label.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, label, null);
+
+ if (modelAccess.isCssClassValid()) {
+ label.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+ }
+ return label;
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ * @param componentBase
+ * the component base
+ */
+ protected void createBindings(YLabel yField, Label field,
+ AbstractComponent componentBase) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YLABEL__VALUE, field));
+
+ super.createBindings(yField, field, componentBase);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), label);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return label;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return label != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (label != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) label.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(label);
+ }
+
+ // remove assocations
+ unassociateWidget(label);
+
+ label = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YLabel yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YLabel yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ListPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ListPresentation.java
new file mode 100644
index 0000000..ac7eca4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ListPresentation.java
@@ -0,0 +1,499 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YList;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IListEditpart;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItemContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.ListSelect;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a list on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class ListPresentation extends AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The list. */
+ private ListSelect list;
+
+ /** The property. */
+ private ObjectProperty<?> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public ListPresentation(IElementEditpart editpart) {
+ super((IListEditpart) editpart);
+ this.modelAccess = new ModelAccess((YList) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (list == null) {
+
+ list = new CustomListSelect();
+ list.addStyleName(CSS_CLASS_CONTROL);
+ list.setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI);
+ list.setImmediate(true);
+ setupComponent(list, getCastedModel());
+ associateWidget(list, modelAccess.yField);
+
+ if (modelAccess.isCssIdValid()) {
+ list.setId(modelAccess.getCssID());
+ } else {
+ list.setId(getEditpart().getId());
+ }
+
+ if (list.isMultiSelect()) {
+ property = new ObjectProperty(new HashSet(), Set.class);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ } else {
+ property = new ObjectProperty(null, Object.class);
+ }
+ }
+ list.setPropertyDataSource(property);
+
+ if (modelAccess.yField.getType() == String.class) {
+ IndexedContainer datasource = new IndexedContainer();
+ list.setContainerDataSource(datasource);
+ list.setItemCaptionMode(ItemCaptionMode.ID);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ if (!modelAccess.yField.isUseBeanService()) {
+ DeepResolvingBeanItemContainer datasource = new DeepResolvingBeanItemContainer(
+ modelAccess.yField.getType());
+ list.setContainerDataSource(datasource);
+ } else {
+ IBeanSearchServiceFactory factory = getViewContext()
+ .getService(
+ IBeanSearchServiceFactory.class
+ .getName());
+ if (factory != null) {
+ ISharedStateContext sharedState = getViewContext()
+ .getService(
+ ISharedStateContext.class.getName());
+ BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer(
+ factory.createService(modelAccess.yField
+ .getType()),
+ modelAccess.yField.getType(), sharedState);
+ list.setContainerDataSource(datasource);
+ }
+ }
+ } else {
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty("for", String.class, null);
+ container.addContainerProperty("preview", String.class,
+ null);
+ container.addItem(new String[] { "Some value", "other" });
+ list.setContainerDataSource(container);
+ }
+ }
+
+ String itemCaptionProperty = modelAccess.yField
+ .getCaptionProperty();
+ if (itemCaptionProperty != null && !itemCaptionProperty.equals("")) {
+ list.setItemCaptionPropertyId(itemCaptionProperty);
+ }
+
+ String itemImageProperty = modelAccess.yField.getImageProperty();
+ if (itemImageProperty != null && !itemImageProperty.equals("")) {
+ list.setItemIconPropertyId(itemImageProperty);
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, list);
+
+ if (modelAccess.isCssClassValid()) {
+ list.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(list);
+ }
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), list);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ } else if (bindableValue instanceof YEmbeddableMultiSelectionEndpoint) {
+ return internalGetMultiSelectionEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YLIST__COLLECTION).observe(
+ getModel());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YLIST__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetMultiSelectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YLIST__MULTI_SELECTION).observe(
+ getModel());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YList yField, ListSelect field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_ContainerContents(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YLIST__COLLECTION, field,
+ yField.getType()));
+
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsMultiSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YLIST__MULTI_SELECTION,
+ field, yField.getType()));
+ } else {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YLIST__SELECTION, field,
+ yField.getType()));
+
+ }
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return list;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return list != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (list != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) list.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(list);
+ }
+
+ // remove assocations
+ unassociateWidget(list);
+
+ list = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YList yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YList yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to
+ * {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private class CustomListSelect extends ListSelect {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ try {
+ if (icon instanceof String) {
+ return new ThemeResource((String) icon);
+ }
+ } catch (Exception e) {
+ // nothing to do
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/MasterDetailPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/MasterDetailPresentation.java
new file mode 100644
index 0000000..eaf5488
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/MasterDetailPresentation.java
@@ -0,0 +1,503 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.net.URI;
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.osbp.ecview.core.common.binding.observables.ContextObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YCollectionBindable;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.common.uri.URIHelper;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YMasterDetail;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IMasterDetailEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.IMasterDetailPresentation;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.VerticalLayout;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class MasterDetailPresentation extends
+ AbstractVaadinWidgetPresenter<ComponentContainer> implements
+ IMasterDetailPresentation<ComponentContainer> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The component base. */
+ private VerticalLayout componentBase;
+
+ /** The master base. */
+ private CssLayout masterBase;
+
+ /** The detail base. */
+ private CssLayout detailBase;
+
+ /** The master presentation. */
+ private IWidgetPresentation<?> masterPresentation;
+
+ /** The detail presentation. */
+ private IWidgetPresentation<?> detailPresentation;
+
+ /** The master collection binding. */
+ private Binding masterCollectionBinding;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public MasterDetailPresentation(IElementEditpart editpart) {
+ super((IMasterDetailEditpart) editpart);
+ this.modelAccess = new ModelAccess((YMasterDetail) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (componentBase == null) {
+ componentBase = new VerticalLayout();
+ componentBase.addStyleName(CSS_CLASS_CONTROL_BASE);
+ if (modelAccess.isCssIdValid()) {
+ componentBase.setId(modelAccess.getCssID());
+ } else {
+ componentBase.setId(getEditpart().getId());
+ }
+
+ associateWidget(componentBase, modelAccess.yField);
+
+ // create the container for master an detail
+ masterBase = new CssLayout();
+ masterBase.setStyleName(IConstants.CSS_CLASS_MASTER_BASE);
+ masterBase.setSizeFull();
+ componentBase.addComponent(masterBase);
+
+ associateWidget(masterBase, modelAccess.yField);
+
+ detailBase = new CssLayout();
+ masterBase.setStyleName(IConstants.CSS_CLASS_DETAIL_BASE);
+ detailBase.setSizeFull();
+ componentBase.addComponent(detailBase);
+
+ associateWidget(detailBase, modelAccess.yField);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField);
+
+ // render master an detail
+ if (masterPresentation != null) {
+ createMasterWidget();
+ }
+
+ if (detailPresentation != null) {
+ Component detailWidget = (Component) detailPresentation
+ .createWidget(detailBase);
+ if (detailWidget != null) {
+ detailBase.removeAllComponents();
+ detailBase.addComponent(detailWidget);
+ }
+ }
+
+ }
+ return componentBase;
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ */
+ protected void createBindings(YMasterDetail yField) {
+
+ // create the model binding from ECView-Model to the collection bean
+ // slot
+ URI uri = URIHelper.view().bean(getCollectionBeanSlot())
+ .fragment("value").toURI();
+ IObservableList targetObservableList = ContextObservables.observeList(
+ getViewContext(), uri, modelAccess.yField.getType());
+ IObservableList modelObservable = EMFProperties.list(
+ ExtensionModelPackage.Literals.YMASTER_DETAIL__COLLECTION)
+ .observe(getModel());
+ registerBinding(createBindings(targetObservableList, modelObservable));
+
+ }
+
+ /**
+ * Creates a bean slot that is the input for the detail fields. It is used
+ * by the presentation to bind the detail fields to that slot.
+ *
+ * @return the selection bean slot
+ */
+ protected String getSelectionBeanSlot() {
+ return "selection_" + getEditpart().getId();
+ }
+
+ /**
+ * Create a bean slot which is the input for the master detail. It is used
+ * by the presentation to bind the table, list,... to that slot.
+ *
+ * @return the collection bean slot
+ */
+ protected String getCollectionBeanSlot() {
+ return "input_" + getEditpart().getId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), masterBase);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new NullPointerException("BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ } else if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ // delegate the binding to the proper bean slot
+ URI uri = URIHelper.view().bean(getCollectionBeanSlot()).toURI();
+ IObservableList modelObservableList = ContextObservables.observeList(
+ getViewContext(), uri, modelAccess.yField.getType());
+ return modelObservableList;
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YMASTER_DETAIL__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return componentBase;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return componentBase != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (componentBase != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ ComponentContainer parent = ((ComponentContainer) componentBase
+ .getParent());
+ if (parent != null) {
+ parent.removeComponent(componentBase);
+ }
+
+ // remove assocations
+ unassociateWidget(componentBase);
+
+ componentBase = null;
+
+ if (masterPresentation != null) {
+ disposeMasterWidget();
+ }
+
+ if (detailPresentation != null) {
+ detailPresentation.unrender();
+ detailBase.removeAllComponents();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+
+ // do NOT dispose. Will be handled by editpart.
+ masterPresentation = null;
+ detailPresentation = null;
+
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.IMasterDetailPresentation#getMaster()
+ */
+ @Override
+ public IWidgetPresentation<?> getMaster() {
+ return masterPresentation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.IMasterDetailPresentation#getDetail()
+ */
+ @Override
+ public IWidgetPresentation<?> getDetail() {
+ return detailPresentation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.IMasterDetailPresentation#setMaster(org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation)
+ */
+ @Override
+ public void setMaster(IWidgetPresentation<?> master) {
+ if (this.masterPresentation == master) {
+ return;
+ }
+
+ if (this.masterPresentation != null) {
+ disposeMasterWidget();
+ }
+
+ this.masterPresentation = master;
+
+ if (isRendered()) {
+ if (this.masterPresentation != null) {
+ createMasterWidget();
+ }
+ }
+ }
+
+ /**
+ * Creates the master widget and does the databinding.
+ */
+ public void createMasterWidget() {
+
+ Component masterWidget = (Component) masterPresentation
+ .createWidget(masterBase);
+ if (masterWidget != null) {
+ masterBase.removeAllComponents();
+ masterBase.addComponent(masterWidget);
+ }
+
+ YEmbeddable yMaster = (YEmbeddable) masterPresentation.getModel();
+ if (yMaster instanceof YCollectionBindable) {
+ createMasterCollectionBinding((YCollectionBindable) yMaster);
+ }
+ }
+
+ /**
+ * Disposes the master widget and removes active bindings.
+ */
+ protected void disposeMasterWidget() {
+ masterPresentation.dispose();
+ masterBase.removeAllComponents();
+
+ if (masterCollectionBinding != null) {
+ masterCollectionBinding.dispose();
+ masterCollectionBinding = null;
+ }
+ }
+
+ /**
+ * Creates a binding from the master element to the proper bean slot.
+ *
+ * @param yMasterCollectionBindable
+ * the y master collection bindable
+ */
+ protected void createMasterCollectionBinding(
+ YCollectionBindable yMasterCollectionBindable) {
+
+ YEmbeddableCollectionEndpoint yMasterEndpoint = yMasterCollectionBindable
+ .createCollectionEndpoint();
+ IObservableList targetObservableList = (IObservableList) this.masterPresentation
+ .getObservableValue(yMasterEndpoint);
+ URI uri = URIHelper.view().bean(getCollectionBeanSlot())
+ .fragment("value").toURI();
+ IObservableList modelObservableList = ContextObservables.observeList(
+ getViewContext(), uri, modelAccess.yField.getType());
+
+ masterCollectionBinding = createBindings(targetObservableList,
+ modelObservableList);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.IMasterDetailPresentation#setDetail(org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation)
+ */
+ @Override
+ public void setDetail(IWidgetPresentation<?> detail) {
+ if (this.detailPresentation == detail) {
+ return;
+ }
+
+ if (this.detailPresentation != null) {
+ this.detailPresentation.dispose();
+ detailBase.removeAllComponents();
+ }
+
+ this.detailPresentation = detail;
+
+ if (isRendered()) {
+ if (this.detailPresentation != null) {
+ this.detailPresentation.createWidget(detailBase);
+ }
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YMasterDetail yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YMasterDetail yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ @SuppressWarnings("unused")
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java
new file mode 100644
index 0000000..e6d976a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericFieldPresentation.java
@@ -0,0 +1,449 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YValueBindable;
+import org.eclipse.osbp.ecview.core.common.model.datatypes.YDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YNumericDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.INumericFieldEditpart;
+import org.eclipse.osbp.ecview.core.util.emf.ModelUtil;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.NumberConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.NumericField;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text area on the given layout.
+ */
+public class NumericFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The number field. */
+ private CustomField numberField;
+
+ /** The binding_value to ui. */
+ private Binding binding_valueToUI;
+
+ /** The property. */
+ private ObjectProperty<Double> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public NumericFieldPresentation(IElementEditpart editpart) {
+ super((INumericFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess((YNumericField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("serial")
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (numberField == null) {
+
+ numberField = new CustomField((NumberConverter) getConverter());
+ numberField.addStyleName(CSS_CLASS_CONTROL);
+ numberField.setImmediate(true);
+ setupComponent(numberField, getCastedModel());
+
+ associateWidget(numberField, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ numberField.setId(modelAccess.getCssID());
+ } else {
+ numberField.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<Double>(0d, Double.class);
+ numberField.setPropertyDataSource(property);
+
+ numberField
+ .addValueChangeListener(new Property.ValueChangeListener() {
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ if (binding_valueToUI != null) {
+ binding_valueToUI.updateTargetToModel();
+
+ Binding domainToEObjectBinding = ModelUtil
+ .getValueBinding((YValueBindable) getModel());
+ if (domainToEObjectBinding != null) {
+ domainToEObjectBinding
+ .updateTargetToModel();
+ }
+ }
+ }
+ });
+
+ if (modelAccess.isCssClassValid()) {
+ numberField.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+ doApplyDatatype(modelAccess.yField.getDatatype());
+
+ initializeField(numberField);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, numberField);
+
+ // send an event, that the content was rendered again
+ sendRenderedLifecycleEvent();
+
+ }
+ return numberField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#getDefaultConverter()
+ */
+ @Override
+ protected Converter<?, ?> getDefaultConverter() {
+ return new NumberConverter();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doUpdateConverter(com.vaadin.data.util.converter.Converter)
+ */
+ @SuppressWarnings("rawtypes")
+ protected void doUpdateConverter(Converter converter) {
+ super.doUpdateConverter(converter);
+
+ // if converter changes, then apply the settings from datatype to it
+ doApplyDatatype(modelAccess.yField.getDatatype());
+ }
+
+ /**
+ * Applies the datatype options to the field.
+ *
+ * @param yDt
+ * the y dt
+ */
+ protected void doApplyDatatype(YDatatype yDt) {
+ if (numberField == null) {
+ return;
+ }
+ if (yDt == null) {
+ numberField.setUseGrouping(true);
+ numberField.setMarkNegative(true);
+ } else {
+ YNumericDatatype yCasted = (YNumericDatatype) yDt;
+ numberField.setUseGrouping(yCasted.isGrouping());
+ numberField.setMarkNegative(yCasted.isMarkNegative());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // update the captions
+ applyCaptions();
+
+ // tell the number field about the locale change
+ if(numberField != null) {
+ numberField.setLocale(locale);
+ }
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), numberField);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return numberField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YNUMERIC_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YNumericField yField, NumericField field) {
+ // create the model binding from ridget to ECView-model
+
+ binding_valueToUI = createModelBinding(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YNUMERIC_FIELD__VALUE, field,
+ null, null);
+
+ registerBinding(binding_valueToUI);
+
+ super.createBindings(yField, field, null);
+ }
+
+ /**
+ * Creates the model binding.
+ *
+ * @param model
+ * the model
+ * @param modelFeature
+ * the model feature
+ * @param field
+ * the field
+ * @param targetToModel
+ * the target to model
+ * @param modelToTarget
+ * the model to target
+ * @return the binding
+ */
+ protected Binding createModelBinding(EObject model,
+ EStructuralFeature modelFeature, AbstractField<?> field,
+ UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to textRidget
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, modelFeature);
+ IObservableValue uiObservable = VaadinObservables
+ .observeConvertedValue(field);
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ targetToModel, modelToTarget);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return numberField;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return numberField != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (numberField != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) numberField.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(numberField);
+ }
+
+ // remove assocations
+ unassociateWidget(numberField);
+
+ numberField = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YNumericField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YNumericField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomField extends NumericField {
+
+ /**
+ * Instantiates a new custom field.
+ *
+ * @param converter
+ * the converter
+ */
+ public CustomField(NumberConverter converter) {
+ super("", converter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericSearchFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericSearchFieldPresentation.java
new file mode 100644
index 0000000..79025dd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/NumericSearchFieldPresentation.java
@@ -0,0 +1,334 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericSearchField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.INumericSearchFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.NumericSearchField;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.NumericFilterProperty;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class NumericSearchFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> implements
+ IFilterProvidingPresentation {
+
+ /** The Constant LOGGER. */
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(NumericSearchFieldPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The field. */
+ private NumericSearchField field;
+
+ /** The property. */
+ private ObjectProperty<NumericFilterProperty> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public NumericSearchFieldPresentation(IElementEditpart editpart) {
+ super((INumericSearchFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YNumericSearchField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (field == null) {
+ IBindingManager bm = getViewContext().getService(
+ IECViewBindingManager.class.getName());
+ field = new NumericSearchField(getEditpart().getId(),
+ modelAccess.yField.getPropertyPath(),
+ modelAccess.yField.getType(), bm.getDatabindingContext());
+ field.addStyleName(CSS_CLASS_CONTROL);
+ field.addStyleName(IConstants.CSS_CLASS_SEARCHFIELD);
+
+ field.setNullRepresentation("");
+ field.setImmediate(true);
+ setupComponent(field, getCastedModel());
+
+ associateWidget(field, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ field.setId(modelAccess.getCssID());
+ } else {
+ field.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<NumericFilterProperty>(null,
+ NumericFilterProperty.class);
+ field.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, field);
+
+ if (modelAccess.isCssClassValid()) {
+ field.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(field);
+ }
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation#getFilter()
+ */
+ @Override
+ public Object getFilter() {
+ return field != null ? field.getFilter() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ II18nService service = getI18nService();
+ Util.applyCaptions(service, modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), field);
+
+ field.setDescription(service.getValue(
+ IConstants.I18N_TOOLTIP_NUMBERSEARCHFIELD, getLocale()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YNUMERIC_SEARCH_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YNumericSearchField yField,
+ NumericSearchField field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YNUMERIC_SEARCH_FIELD__VALUE,
+ field));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return field != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (field != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) field.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(field);
+ }
+
+ // remove assocations
+ unassociateWidget(field);
+
+ field.dispose();
+ field = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YNumericSearchField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YNumericSearchField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/OptionsGroupPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/OptionsGroupPresentation.java
new file mode 100644
index 0000000..da46582
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/OptionsGroupPresentation.java
@@ -0,0 +1,500 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IOptionsGroupEditpart;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItemContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.OptionGroup;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a list on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class OptionsGroupPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The options group. */
+ private OptionGroup optionsGroup;
+
+ /** The property. */
+ private ObjectProperty<?> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public OptionsGroupPresentation(IElementEditpart editpart) {
+ super((IOptionsGroupEditpart) editpart);
+ this.modelAccess = new ModelAccess((YOptionsGroup) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (optionsGroup == null) {
+
+ optionsGroup = new CustomOptionGroup();
+ optionsGroup.addStyleName(CSS_CLASS_CONTROL);
+ optionsGroup
+ .setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI);
+ optionsGroup.setImmediate(true);
+ setupComponent(optionsGroup, getCastedModel());
+ associateWidget(optionsGroup, modelAccess.yField);
+
+ if (modelAccess.isCssIdValid()) {
+ optionsGroup.setId(modelAccess.getCssID());
+ } else {
+ optionsGroup.setId(getEditpart().getId());
+ }
+
+ if (optionsGroup.isMultiSelect()) {
+ property = new ObjectProperty(new HashSet(), Set.class);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ } else {
+ property = new ObjectProperty(null, Object.class);
+ }
+ }
+ optionsGroup.setPropertyDataSource(property);
+
+ if (modelAccess.yField.getType() == String.class) {
+ IndexedContainer datasource = new IndexedContainer();
+ optionsGroup.setContainerDataSource(datasource);
+ optionsGroup.setItemCaptionMode(ItemCaptionMode.ID);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ if (!modelAccess.yField.isUseBeanService()) {
+ DeepResolvingBeanItemContainer datasource = new DeepResolvingBeanItemContainer(
+ modelAccess.yField.getType());
+ optionsGroup.setContainerDataSource(datasource);
+ } else {
+ IBeanSearchServiceFactory factory = getViewContext()
+ .getService(
+ IBeanSearchServiceFactory.class
+ .getName());
+ if (factory != null) {
+ ISharedStateContext sharedState = getViewContext()
+ .getService(
+ ISharedStateContext.class.getName());
+ BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer(
+ factory.createService(modelAccess.yField
+ .getType()),
+ modelAccess.yField.getType(), sharedState);
+ optionsGroup.setContainerDataSource(datasource);
+ }
+ }
+ } else {
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty("for", String.class, null);
+ container.addContainerProperty("preview", String.class,
+ null);
+ container.addItem(new String[] { "Some value", "other" });
+ optionsGroup.setContainerDataSource(container);
+ }
+ }
+
+ String itemCaptionProperty = modelAccess.yField
+ .getCaptionProperty();
+ if (itemCaptionProperty != null && !itemCaptionProperty.equals("")) {
+ optionsGroup.setItemCaptionPropertyId(itemCaptionProperty);
+ }
+
+ String itemImageProperty = modelAccess.yField.getImageProperty();
+ if (itemImageProperty != null && !itemImageProperty.equals("")) {
+ optionsGroup.setItemIconPropertyId(itemImageProperty);
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, optionsGroup);
+
+ if (modelAccess.isCssClassValid()) {
+ optionsGroup.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(optionsGroup);
+ }
+ return optionsGroup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), optionsGroup);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return optionsGroup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ } else if (bindableValue instanceof YEmbeddableMultiSelectionEndpoint) {
+ return internalGetMultiSelectionEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YOPTIONS_GROUP__COLLECTION)
+ .observe(getModel());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YOPTIONS_GROUP__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetMultiSelectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YOPTIONS_GROUP__MULTI_SELECTION)
+ .observe(getModel());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YOptionsGroup yField, OptionGroup field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_ContainerContents(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YOPTIONS_GROUP__COLLECTION,
+ field, yField.getType()));
+
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsMultiSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YOPTIONS_GROUP__MULTI_SELECTION,
+ field, yField.getType()));
+ } else {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YOPTIONS_GROUP__SELECTION,
+ field, yField.getType()));
+
+ }
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return optionsGroup;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return optionsGroup != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (optionsGroup != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) optionsGroup.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(optionsGroup);
+ }
+
+ // remove assocations
+ unassociateWidget(optionsGroup);
+
+ optionsGroup = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YOptionsGroup yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YOptionsGroup yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to
+ * {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private class CustomOptionGroup extends OptionGroup {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ try {
+ if (icon instanceof String) {
+ return new ThemeResource((String) icon);
+ }
+ } catch (Exception e) {
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PanelPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PanelPresentation.java
new file mode 100644
index 0000000..a0d12bd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PanelPresentation.java
@@ -0,0 +1,297 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YPanel;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Panel;
+
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class PanelPresentation extends AbstractLayoutPresenter<Component> {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(PanelPresentation.class);
+
+ private Panel panel;
+ private ModelAccess modelAccess;
+
+ // private CssLayout fillerLayout;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public PanelPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess((YPanel) editpart.getModel());
+ }
+
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), panel);
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ panel.setContent(null);
+
+ // iterate all elements and build the child element
+ //
+ for (IEmbeddableEditpart child : getChildren()) {
+ addChild(child);
+ }
+ }
+
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (panel == null) {
+
+ panel = new Panel();
+ setupComponent(panel, getCastedModel());
+
+ associateWidget(panel, modelAccess.yLayout);
+ if (modelAccess.isCssIdValid()) {
+ panel.setId(modelAccess.getCssID());
+ } else {
+ panel.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ panel.addStyleName(modelAccess.getCssClass());
+ } else {
+ panel.addStyleName(CSS_CLASS_CONTROL);
+ }
+
+ initialize(panel, getCastedModel());
+
+ applyCaptions();
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, panel, null);
+
+ // initialize all children
+ initializeChildren();
+
+ renderChildren(false);
+ }
+
+ return panel;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ @Override
+ public Component getWidget() {
+ return panel;
+ }
+
+ @Override
+ public boolean isRendered() {
+ return panel != null;
+ }
+
+ @Override
+ public void doUnrender() {
+ if (panel != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(panel);
+
+ panel = null;
+ }
+ }
+
+ @Override
+ protected void internalDispose() {
+ try {
+ for (IEmbeddableEditpart child : new ArrayList<IEmbeddableEditpart>(
+ getChildren())) {
+ child.dispose();
+ }
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ addChild(editpart);
+ }
+
+ private void addChild(IEmbeddableEditpart editpart) {
+ int index = getChildren().indexOf(editpart);
+ if (index > 0) {
+ LOGGER.warn("More than one element added to panel.");
+ return;
+ }
+
+ if (index == 0) {
+ panel.setContent((Component) editpart.render(panel));
+ }
+ }
+
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (panel != null && child.isRendered()
+ && panel.getContent() == child.getWidget()) {
+ panel.setContent(null);
+ }
+
+ child.unrender();
+ }
+
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ @Override
+ public void notify(DesignEvent event) {
+ // nothing to do
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+ private final YPanel yLayout;
+
+ public ModelAccess(YPanel yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return
+ */
+ public String getLabel() {
+ return yLayout.getDatadescription().getLabel();
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return
+ */
+ public String getLabelI18nKey() {
+ return yLayout.getDatadescription().getLabelI18nKey();
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java
new file mode 100644
index 0000000..18e0c25
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PasswordFieldPresentation.java
@@ -0,0 +1,341 @@
+/**
+ * Copyright (c) 2011 - 2015, Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YPasswordField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IPasswordFieldEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.PasswordField;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class PasswordFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The text. */
+ private CustomPasswordField text;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public PasswordFieldPresentation(IElementEditpart editpart) {
+ super((IPasswordFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess((YPasswordField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (text == null) {
+
+ text = new CustomPasswordField();
+ text.addStyleName(CSS_CLASS_CONTROL);
+ text.setNullRepresentation("");
+ text.setImmediate(true);
+ setupComponent(text, getCastedModel());
+
+ associateWidget(text, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ text.setId(modelAccess.getCssID());
+ } else {
+ text.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<String>(null, String.class);
+ text.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, text);
+
+ if (modelAccess.isCssClassValid()) {
+ text.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(text);
+ }
+ return text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), text);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter
+ * #internalGetObservableEndpoint(org.eclipse.osbp
+ * .ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YPASSWORD_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YPasswordField yField, PasswordField field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YPASSWORD_FIELD__VALUE, text));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return text != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (text != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) text.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(text);
+ }
+
+ // remove assocations
+ unassociateWidget(text);
+
+ text = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YPasswordField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YPasswordField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomPasswordField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomPasswordField extends PasswordField {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java
new file mode 100644
index 0000000..5ef0a0b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/PresenterFactory.java
@@ -0,0 +1,163 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.IDialogEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.presentation.IPresentationFactory;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IAbsoluteLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBeanReferenceFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBooleanSearchFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IBrowserEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IButtonEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICheckboxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IComboBoxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ICssLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IDateTimeEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IDecimalFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumComboBoxEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumListEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IEnumOptionsGroupEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IFormLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IGridLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IHorizontalLayoutEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IImageEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ILabelEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IListEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IMasterDetailEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.INumericFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.INumericSearchFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IOptionsGroupEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IPanelEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IPasswordFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IProgressBarEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISearchPanelEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISliderEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISplitPanelEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISuggestTextFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabSheetEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITableEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextAreaEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextSearchFieldEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITreeEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IVerticalLayoutEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+
+/**
+ * The presenter factory.
+ */
+public class PresenterFactory implements IPresentationFactory {
+
+ public PresenterFactory() {
+
+ }
+
+ @Override
+ public boolean isFor(IViewContext uiContext, IElementEditpart editpart) {
+ String presentationURI = uiContext.getPresentationURI();
+ return presentationURI != null && presentationURI.equals(VaadinRenderer.UI_KIT_URI);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <A extends IWidgetPresentation<?>> A createPresentation(IViewContext uiContext, IElementEditpart editpart)
+ throws IllegalArgumentException {
+ if (editpart instanceof IViewEditpart) {
+ return (A) new ViewPresentation((IViewEditpart) editpart);
+ } else if (editpart instanceof ITextFieldEditpart) {
+ return (A) new TextFieldPresentation(editpart);
+ } else if (editpart instanceof ILabelEditpart) {
+ return (A) new LabelPresentation(editpart);
+ } else if (editpart instanceof ITextAreaEditpart) {
+ return (A) new TextAreaPresentation(editpart);
+ } else if (editpart instanceof ICheckboxEditpart) {
+ return (A) new CheckBoxPresentation(editpart);
+ } else if (editpart instanceof IComboBoxEditpart) {
+ return (A) new ComboBoxPresentation(editpart);
+ } else if (editpart instanceof IListEditpart) {
+ return (A) new ListPresentation(editpart);
+ } else if (editpart instanceof ITableEditpart) {
+ return (A) new TablePresentation(editpart);
+ } else if (editpart instanceof ITreeEditpart) {
+ return (A) new TreePresentation(editpart);
+ } else if (editpart instanceof IOptionsGroupEditpart) {
+ return (A) new OptionsGroupPresentation(editpart);
+ } else if (editpart instanceof IButtonEditpart) {
+ return (A) new ButtonPresentation(editpart);
+ } else if (editpart instanceof IGridLayoutEditpart) {
+ return (A) new GridLayoutPresentation(editpart);
+ } else if (editpart instanceof IHorizontalLayoutEditpart) {
+ return (A) new HorizontalLayoutPresentation(editpart);
+ } else if (editpart instanceof IVerticalLayoutEditpart) {
+ return (A) new VerticalLayoutPresentation(editpart);
+ } else if (editpart instanceof IFormLayoutEditpart) {
+ return (A) new FormLayoutPresentation(editpart);
+ } else if (editpart instanceof ICssLayoutEditpart) {
+ return (A) new CssLayoutPresentation(editpart);
+ } else if (editpart instanceof IDecimalFieldEditpart) {
+ return (A) new DecimalFieldPresentation(editpart);
+ } else if (editpart instanceof INumericFieldEditpart) {
+ return (A) new NumericFieldPresentation(editpart);
+ } else if (editpart instanceof IDateTimeEditpart) {
+ return (A) new DateTimePresentation(editpart);
+ } else if (editpart instanceof IBrowserEditpart) {
+ return (A) new BrowserPresentation(editpart);
+ } else if (editpart instanceof IProgressBarEditpart) {
+ return (A) new ProgressBarPresentation(editpart);
+ } else if (editpart instanceof ITabSheetEditpart) {
+ return (A) new TabSheetPresentation(editpart);
+ } else if (editpart instanceof ITabEditpart) {
+ return (A) new TabPresentation(editpart);
+ } else if (editpart instanceof IMasterDetailEditpart) {
+ return (A) new MasterDetailPresentation(editpart);
+ } else if (editpart instanceof IImageEditpart) {
+ return (A) new ImagePresentation(editpart);
+ } else if (editpart instanceof IDialogEditpart) {
+ return (A) new DialogPresentation(editpart);
+ } else if (editpart instanceof ITextSearchFieldEditpart) {
+ return (A) new TextSearchFieldPresentation(editpart);
+ } else if (editpart instanceof INumericSearchFieldEditpart) {
+ return (A) new NumericSearchFieldPresentation(editpart);
+ } else if (editpart instanceof IBooleanSearchFieldEditpart) {
+ return (A) new BooleanSearchFieldPresentation(editpart);
+ } else if (editpart instanceof ISplitPanelEditpart) {
+ return (A) new SplitPanelPresentation(editpart);
+ } else if (editpart instanceof IPanelEditpart) {
+ return (A) new PanelPresentation(editpart);
+ } else if (editpart instanceof ISearchPanelEditpart) {
+ return (A) new SearchPanelPresentation(editpart);
+ } else if (editpart instanceof IBeanReferenceFieldEditpart) {
+ return (A) new BeanReferenceFieldPresentation(editpart);
+ } else if (editpart instanceof IEnumComboBoxEditpart) {
+ return (A) new EnumComboBoxPresentation(editpart);
+ } else if (editpart instanceof IEnumListEditpart) {
+ return (A) new EnumListPresentation(editpart);
+ } else if (editpart instanceof IEnumOptionsGroupEditpart) {
+ return (A) new EnumOptionsGroupPresentation(editpart);
+ } else if (editpart instanceof ISliderEditpart) {
+ return (A) new SliderPresentation(editpart);
+ } else if (editpart instanceof ISuggestTextFieldEditpart) {
+ return (A) new SuggestTextFieldPresentation(editpart);
+ } else if (editpart instanceof IAbsoluteLayoutEditpart) {
+ return (A) new AbsoluteLayoutPresentation(editpart);
+ } else if (editpart instanceof IPasswordFieldEditpart) {
+ return (A) new PasswordFieldPresentation(editpart);
+ }
+
+ throw new IllegalArgumentException(String.format("No presenter available for editpart %s[%s]", editpart.getClass().getName(),
+ editpart.getId()));
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ProgressBarPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ProgressBarPresentation.java
new file mode 100644
index 0000000..81dfe0c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ProgressBarPresentation.java
@@ -0,0 +1,318 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YProgressBar;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.IProgressBarEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.ProgressBar;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a progress bar on the given layout.
+ */
+public class ProgressBarPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The progress bar. */
+ private CustomField progressBar;
+
+ /** The property. */
+ private ObjectProperty<Float> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public ProgressBarPresentation(IElementEditpart editpart) {
+ super((IProgressBarEditpart) editpart);
+ this.modelAccess = new ModelAccess((YProgressBar) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (progressBar == null) {
+
+ progressBar = new CustomField();
+ progressBar.addStyleName(CSS_CLASS_CONTROL);
+ progressBar.setImmediate(true);
+ setupComponent(progressBar, getCastedModel());
+
+ associateWidget(progressBar, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ progressBar.setId(modelAccess.getCssID());
+ } else {
+ progressBar.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<Float>(0f, Float.class);
+ progressBar.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, progressBar);
+
+ if (modelAccess.isCssClassValid()) {
+ progressBar.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(progressBar);
+ }
+ return progressBar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), progressBar);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return progressBar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YPROGRESS_BAR__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YProgressBar yField, ProgressBar field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YPROGRESS_BAR__VALUE,
+ progressBar));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return progressBar;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return progressBar != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (progressBar != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) progressBar.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(progressBar);
+ }
+
+ // remove assocations
+ unassociateWidget(progressBar);
+
+ progressBar = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YProgressBar yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YProgressBar yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField.getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomField extends ProgressBar {
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SearchPanelPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SearchPanelPresentation.java
new file mode 100644
index 0000000..7988f2f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SearchPanelPresentation.java
@@ -0,0 +1,346 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSearchPanel;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISearchFieldEditpart;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.filter.Filters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.HorizontalLayout;
+
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class SearchPanelPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> implements
+ IFilterProvidingPresentation {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(SearchPanelPresentation.class);
+
+ private HorizontalLayout horizontalLayout;
+ private FormLayout leftForm;
+ private FormLayout rightForm;
+ private ModelAccess modelAccess;
+
+ private int currentChildIndex;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that editpart.
+ */
+ public SearchPanelPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess((YSearchPanel) editpart.getModel());
+ }
+
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the layout
+ * and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ leftForm.removeAllComponents();
+ rightForm.removeAllComponents();
+
+ // iterate all elements and build the child element
+ //
+ currentChildIndex = 0;
+ for (IEmbeddableEditpart child : getChildren()) {
+ addChild(child);
+ }
+ }
+
+ private void addChild(IEmbeddableEditpart child) {
+ currentChildIndex++;
+ if (currentChildIndex % 2 == 1) {
+ leftForm.addComponent((Component) child.render(leftForm));
+ } else {
+ rightForm.addComponent((Component) child.render(rightForm));
+ }
+ }
+
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (horizontalLayout == null) {
+
+ horizontalLayout = new HorizontalLayout();
+ setupComponent(horizontalLayout, getCastedModel());
+
+ associateWidget(horizontalLayout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ horizontalLayout.setId(modelAccess.getCssID());
+ } else {
+ horizontalLayout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isMargin()) {
+ horizontalLayout.addStyleName(IConstants.CSS_CLASS_MARGIN);
+ horizontalLayout.setMargin(true);
+ }
+
+ if (!modelAccess.isSpacing()) {
+ horizontalLayout.setSpacing(false);
+ } else {
+ horizontalLayout.addStyleName(IConstants.CSS_CLASS_SPACING);
+ horizontalLayout.setSpacing(true);
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ horizontalLayout.addStyleName(modelAccess.getCssClass());
+ } else {
+ horizontalLayout.addStyleName(CSS_CLASS_CONTROL);
+ }
+ horizontalLayout
+ .addStyleName(IConstants.CSS_CLASS_HORIZONTALLAYOUT);
+
+ leftForm = new FormLayout();
+ leftForm.setSizeFull();
+ horizontalLayout.addComponent(leftForm);
+
+ rightForm = new FormLayout();
+ rightForm.setSizeFull();
+ horizontalLayout.addComponent(rightForm);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, horizontalLayout, null);
+
+ // initialize all children
+ initializeChildren();
+
+ // and now render children
+ renderChildren(false);
+ }
+
+ return horizontalLayout;
+ }
+
+ @Override
+ public Object getFilter() {
+
+ Set<Filter> filters = new HashSet<Filter>();
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ ISearchFieldEditpart temp = (ISearchFieldEditpart) editpart;
+ Filter filter = (Filter) temp.getFilter();
+ if (filter != null) {
+ filters.add(filter);
+ }
+ }
+
+ if (filters.size() > 0) {
+ return new Filters()
+ .and(filters.toArray(new Filter[filters.size()]));
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ @Override
+ public ComponentContainer getWidget() {
+ return horizontalLayout;
+ }
+
+ @Override
+ public boolean isRendered() {
+ return horizontalLayout != null;
+ }
+
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ @Override
+ public void doUnrender() {
+ if (horizontalLayout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(horizontalLayout);
+
+ horizontalLayout.removeAllComponents();
+ horizontalLayout = null;
+ leftForm.removeAllComponents();
+ leftForm = null;
+ rightForm.removeAllComponents();
+ rightForm = null;
+ }
+ }
+
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ addChild(editpart);
+ }
+
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (horizontalLayout != null && child.isRendered()) {
+ // will happen during disposal since children already disposed.
+ horizontalLayout.removeComponent((Component) child.getWidget());
+ }
+
+ child.unrender();
+ }
+
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ @Override
+ public void notify(DesignEvent event) {
+ // nothing to do
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+ private final YSearchPanel yLayout;
+
+ public ModelAccess(YSearchPanel yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YSearchPanel#isSpacing()
+ */
+ public boolean isSpacing() {
+ return yLayout.isSpacing();
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YSearchPanel#isMargin()
+ */
+ public boolean isMargin() {
+ return yLayout.isMargin();
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SliderPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SliderPresentation.java
new file mode 100644
index 0000000..e1676a9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SliderPresentation.java
@@ -0,0 +1,391 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YOrientation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSlider;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISliderEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinProperties;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.shared.ui.slider.SliderOrientation;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Slider;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a slider field on the given layout.
+ */
+public class SliderPresentation extends AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The slider. */
+ private CustomSlider slider;
+
+ /** The property. */
+ private ObjectProperty<Double> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public SliderPresentation(IElementEditpart editpart) {
+ super((ISliderEditpart) editpart);
+ this.modelAccess = new ModelAccess((YSlider) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (slider == null) {
+
+ slider = new CustomSlider();
+ slider.addStyleName(CSS_CLASS_CONTROL);
+ slider.setImmediate(true);
+ setupComponent(slider, getCastedModel());
+
+ associateWidget(slider, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ slider.setId(modelAccess.getCssID());
+ } else {
+ slider.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<Double>(0d, Double.class);
+ slider.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, slider);
+
+ if (modelAccess.isCssClassValid()) {
+ slider.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(slider);
+ }
+ return slider;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), slider);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return slider;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for slider
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSLIDER__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YSlider yField, Slider field) {
+ // create the model binding from widget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSLIDER__VALUE, slider));
+
+ registerBinding(createBindingsByAccessor(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSLIDER__MAX_VALUE, slider,
+ "max"));
+
+ registerBinding(createBindingsByAccessor(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSLIDER__MIN_VALUE, slider,
+ "min"));
+
+ registerBinding(createBindingsByAccessor(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSLIDER__RESOLUTION, slider,
+ "resolution"));
+
+ registerBinding(createBindingsOrientation(castEObject(getModel()),
+ slider));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /**
+ * Bind the orientation field.
+ *
+ * @param model
+ * the model
+ * @param field
+ * the field
+ * @return the binding
+ */
+ protected Binding createBindingsOrientation(EObject model, Field<?> field) {
+ IBindingManager bindingManager = getViewContext()
+ .getService(
+ org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName());
+ if (bindingManager != null) {
+ // bind the value of yText to slider
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ model, ExtensionModelPackage.Literals.YSLIDER__RESOLUTION);
+ IObservableValue uiObservable = VaadinProperties.accessor(
+ Slider.class, "orientation").observe(field);
+ UpdateValueStrategy modelToTarget = new UpdateValueStrategy(
+ UpdateValueStrategy.POLICY_UPDATE)
+ .setConverter(new IConverter() {
+ @Override
+ public Object getToType() {
+ return SliderOrientation.class;
+ }
+
+ @Override
+ public Object getFromType() {
+ return YOrientation.class;
+ }
+
+ @Override
+ public Object convert(Object fromObject) {
+ SliderOrientation orientation = SliderOrientation.HORIZONTAL;
+ if (fromObject == YOrientation.VERTICAL) {
+ orientation = SliderOrientation.VERTICAL;
+ }
+ return orientation;
+ }
+ });
+
+ return bindingManager.bindValue(uiObservable, modelObservable,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ modelToTarget);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return slider;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return slider != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (slider != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) slider.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(slider);
+ }
+
+ // remove assocations
+ unassociateWidget(slider);
+
+ slider = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YSlider yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YSlider yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomSlider.
+ */
+ @SuppressWarnings("serial")
+ private class CustomSlider extends Slider {
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SplitPanelPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SplitPanelPresentation.java
new file mode 100644
index 0000000..3ff372e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SplitPanelPresentation.java
@@ -0,0 +1,299 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSplitPanel;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+import fi.jasoft.dragdroplayouts.DDHorizontalSplitPanel;
+import fi.jasoft.dragdroplayouts.DDVerticalSplitPanel;
+
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class SplitPanelPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(SplitPanelPresentation.class);
+
+ private AbstractSplitPanel splitPanel;
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public SplitPanelPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess((YSplitPanel) editpart.getModel());
+ }
+
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), splitPanel);
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ splitPanel.removeAllComponents();
+
+ // iterate all elements and build the child element
+ //
+ for (IEmbeddableEditpart child : getChildren()) {
+ addChild(child);
+ }
+ }
+
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (splitPanel == null) {
+
+ splitPanel = modelAccess.yLayout.isVertical() ? new DDVerticalSplitPanel()
+ : new DDHorizontalSplitPanel();
+ setupComponent(splitPanel, getCastedModel());
+ splitPanel.setSplitPosition(modelAccess.yLayout.getSplitPosition(),
+ Unit.PERCENTAGE);
+
+ associateWidget(splitPanel, modelAccess.yLayout);
+ if (modelAccess.isCssIdValid()) {
+ splitPanel.setId(modelAccess.getCssID());
+ } else {
+ splitPanel.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ splitPanel.addStyleName(modelAccess.getCssClass());
+ } else {
+ splitPanel.addStyleName(CSS_CLASS_CONTROL);
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, splitPanel, null);
+
+ // initialize all children
+ initializeChildren();
+
+ renderChildren(false);
+ }
+
+ return splitPanel;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ @Override
+ public ComponentContainer getWidget() {
+ return splitPanel;
+ }
+
+ @Override
+ public boolean isRendered() {
+ return splitPanel != null;
+ }
+
+ @Override
+ public void doUnrender() {
+ if (splitPanel != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(splitPanel);
+
+ splitPanel = null;
+ }
+ }
+
+ @Override
+ protected void internalDispose() {
+ try {
+ for (IEmbeddableEditpart child : new ArrayList<IEmbeddableEditpart>(
+ getChildren())) {
+ child.dispose();
+ }
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ addChild(editpart);
+ }
+
+ private void addChild(IEmbeddableEditpart editpart) {
+ int index = getChildren().indexOf(editpart);
+ if (index > 1) {
+ LOGGER.warn("More than two elements added to splitpanel.");
+ return;
+ }
+
+ if (index == 0) {
+ splitPanel.setFirstComponent((Component) editpart
+ .render(splitPanel));
+ } else {
+ splitPanel.setSecondComponent((Component) editpart
+ .render(splitPanel));
+ }
+ }
+
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (splitPanel != null && child.isRendered()) {
+ // will happen during disposal since children already disposed.
+ splitPanel.removeComponent((Component) child.getWidget());
+ }
+
+ child.unrender();
+ }
+
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+ private final YSplitPanel yLayout;
+
+ public ModelAccess(YSplitPanel yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return
+ */
+ public String getLabel() {
+ return yLayout.getDatadescription().getLabel();
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return
+ */
+ public String getLabelI18nKey() {
+ return yLayout.getDatadescription().getLabelI18nKey();
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java
new file mode 100644
index 0000000..4416115
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/SuggestTextFieldPresentation.java
@@ -0,0 +1,529 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.common.notification.IReloadRequestService;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSuggestTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSuggestTextFieldEvents;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ISuggestTextFieldEditpart;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+import org.eclipse.osbp.vaadin.addons.suggesttext.SuggestTextField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class SuggestTextFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(SuggestTextFieldPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The text. */
+ private SuggestTextField text;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /** The adapter. */
+ private Adapter adapter;
+
+ /** The value binding. */
+ private Binding valueBinding;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public SuggestTextFieldPresentation(IElementEditpart editpart) {
+ super((ISuggestTextFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YSuggestTextField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes", "serial" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (text == null) {
+
+ adapter = new Adapter();
+ modelAccess.yField.eAdapters().add(adapter);
+
+ text = new CustomTextField();
+ text.addStyleName(CSS_CLASS_CONTROL);
+ text.getTextField().setNullRepresentation("");
+ text.setImmediate(true);
+ text.setLimit(10);
+ text.setAutoHide(modelAccess.yField.isAutoHidePopup());
+ setupComponent(text, getCastedModel());
+
+ associateWidget(text, modelAccess.yField);
+ associateWidget(text.getTextField(), modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ text.setId(modelAccess.getCssID());
+ } else {
+ text.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<String>(null, String.class);
+ text.getTextField().setPropertyDataSource(property);
+
+ text.addSelectionChangedListener(new SuggestTextField.SelectionChangedListener() {
+ @Override
+ public void selectionChanged(
+ SuggestTextField.SelectionChangedEvent event) {
+ Object itemId = event.getItemId();
+ internalSetLastSuggestion(itemId);
+ }
+ });
+
+ if (modelAccess.yField.getType() != null) {
+ IBeanSearchServiceFactory factory = getViewContext()
+ .getService(IBeanSearchServiceFactory.class.getName());
+ if (factory != null) {
+ ISharedStateContext sharedState = getViewContext()
+ .getService(ISharedStateContext.class.getName());
+ BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer(
+ factory.createService(modelAccess.yField.getType()),
+ modelAccess.yField.getType(), sharedState);
+ text.setContainerDataSource(datasource);
+
+ text.setCaptionPropertyId(modelAccess.yField
+ .getItemCaptionProperty());
+ text.setFilterPropertyId(modelAccess.yField
+ .getItemFilterProperty());
+
+ String uuidProp = modelAccess.yField.getItemUUIDProperty();
+ if (uuidProp != null && !uuidProp.equals("")) {
+ text.setUniqueIdPropertyId(modelAccess.yField
+ .getItemUUIDProperty());
+ }
+ }
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, text);
+
+ if (modelAccess.isCssClassValid()) {
+ text.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(text.getTextField());
+ }
+ return text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), text);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return text != null ? text.getTextField() : null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter
+ * #internalGetObservableEndpoint(org.eclipse.osbp
+ * .ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YSuggestTextField yField,
+ SuggestTextField field) {
+ updateValueBinding(field);
+
+ super.createBindings(yField, field, null);
+ }
+
+ /**
+ * The value binding takes respect to the
+ * modelAccess.yField.isUseSuggestions(). If suggestions are used, value
+ * changes in the UI MUST NOT be updated to the model.
+ *
+ * @param field
+ * the field
+ */
+ protected void updateValueBinding(SuggestTextField field) {
+ if (valueBinding != null) {
+ unregisterBinding(valueBinding);
+ }
+
+ if (field == null) {
+ return;
+ }
+
+ field.setSuggestionEnabled(modelAccess.yField.isUseSuggestions());
+
+ if (modelAccess.yField.isUseSuggestions()) {
+ // in suggest mode do not update from UI to model
+ valueBinding = createBindingsValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE,
+ field.getTextField(), new UpdateValueStrategy(
+ UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ } else {
+ valueBinding = createBindingsValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__VALUE,
+ field.getTextField(), new UpdateValueStrategy(
+ UpdateValueStrategy.POLICY_UPDATE),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ }
+
+ // create the model binding from ridget to ECView-model
+ registerBinding(valueBinding);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return text != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (text != null) {
+
+ modelAccess.yField.eAdapters().remove(adapter);
+ adapter = null;
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) text.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(text);
+ }
+
+ // remove assocations
+ unassociateWidget(text);
+ unassociateWidget(text.getTextField());
+
+ text = null;
+ }
+ }
+
+ /**
+ * Sets the use suggestions.
+ *
+ * @param newBooleanValue
+ * the new use suggestions
+ */
+ public void setUseSuggestions(boolean newBooleanValue) {
+ updateValueBinding(text);
+ }
+
+ /**
+ * Executes the given event.
+ *
+ * @param event
+ */
+ protected void doExecuteEvent(YSuggestTextFieldEvents event) {
+ if (!isRendered()) {
+ return;
+ }
+
+ if (modelAccess.yField.isAutoHidePopup()) {
+ LOGGER.warn("Using events with autoHidePopup==true, may cause side effects, "
+ + "since a click to the UI outside the popup will close the popup automatically");
+ }
+
+ switch (event) {
+ case OPEN_POPUP:
+ text.openPopup();
+ break;
+ case CLOSE_POPUP:
+ text.closePopup();
+ break;
+ case NAVIGATE_NEXT:
+ text.navigateToNext();
+ break;
+ case NAVIGATE_PREV:
+ text.navigateToPrevious();
+ break;
+ case SELECT:
+ text.selectCurrent();
+ break;
+ case CLEAR:
+ text.setValue(null);
+ text.closePopup();
+ internalSetLastSuggestion(null);
+ break;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ protected void internalSetLastSuggestion(Object itemId) {
+ IReloadRequestService service = getViewContext()
+ .getService(IReloadRequestService.class.getName());
+ if (service != null && itemId != null) {
+ service.requestReload(getCastedModel(),
+ itemId);
+ }
+ modelAccess.yField.setLastSuggestion(itemId);
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YSuggestTextField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YSuggestTextField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getLabel();
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getLabelI18nKey();
+ }
+ }
+
+ /**
+ * The Class CustomTextField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomTextField extends SuggestTextField {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractComponent#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+
+ }
+
+ /**
+ * The Class Adapter.
+ */
+ private class Adapter extends AdapterImpl {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.
+ * eclipse.emf.common.notify.Notification)
+ */
+ @Override
+ public void notifyChanged(Notification msg) {
+ if (msg.getFeature() == ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__USE_SUGGESTIONS) {
+ setUseSuggestions(msg.getNewBooleanValue());
+ } else if (msg.getFeature() == ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__AUTO_HIDE_POPUP) {
+ text.setAutoHide(msg.getNewBooleanValue());
+ } else if (msg.getFeature() == ExtensionModelPackage.Literals.YSUGGEST_TEXT_FIELD__EVENT) {
+ YSuggestTextFieldEvents event = (YSuggestTextFieldEvents) msg
+ .getNewValue();
+ if (event != null) {
+ doExecuteEvent(event);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabPresentation.java
new file mode 100644
index 0000000..1512bf7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabPresentation.java
@@ -0,0 +1,218 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.emf.ElementEditpart;
+import org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTab;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.ITabPresentation;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractTabPresenter;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.Tab;
+
+/**
+ * This presenter is responsible to render a tab sheet on the given layout.
+ */
+public class TabPresentation extends AbstractTabPresenter<Component> implements
+ ITabPresentation<Component> {
+
+ private Tab tab;
+ private ModelAccess modelAccess;
+ private HorizontalLayout tabContent;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public TabPresentation(IElementEditpart editpart) {
+ super((ITabEditpart) editpart);
+ this.modelAccess = new ModelAccess((YTab) editpart.getModel());
+ }
+
+ @Override
+ public Component createWidget(Object parent) {
+ if (tab == null) {
+ TabSheet tabSheet = (TabSheet) parent;
+
+ YTab yTab = (YTab) getModel();
+ IEmbeddableEditpart childEditpart = ElementEditpart.getEditpart(
+ getViewContext(), yTab.getEmbeddable());
+
+ tabContent = new HorizontalLayout();
+ tabContent.setSizeFull();
+ if (childEditpart == null) {
+ tab = tabSheet.addTab(tabContent, "content missing");
+ return tabContent;
+ }
+ IWidgetPresentation<Component> childPresentation = childEditpart
+ .getPresentation();
+
+ Component childContent = childPresentation.createWidget(tabContent);
+ childContent.setSizeFull();
+ tabContent.addComponent(childContent);
+ tabContent.setExpandRatio(childContent, 1.0f);
+
+ tab = tabSheet.addTab(tabContent);
+
+ if (modelAccess.isCssIdValid()) {
+ tab.setId(modelAccess.getCssID());
+ } else {
+ tab.setId(getEditpart().getId());
+ }
+
+ registerAtLocaleChangedService();
+
+ applyCaptions();
+ }
+ return tab.getComponent();
+ }
+
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ II18nService service = getI18nService();
+ if (service != null && modelAccess.isLabelI18nKeyValid()) {
+ tab.setCaption(service.getValue(modelAccess.getLabelI18nKey(),
+ getLocale()));
+ } else {
+ if (modelAccess.isLabelValid()) {
+ tab.setCaption(modelAccess.getLabel());
+ }
+ }
+ }
+
+ @Override
+ public ComponentContainer getWidget() {
+ return tabContent;
+ }
+
+ @Override
+ public boolean isRendered() {
+ return tab != null;
+ }
+
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ @Override
+ public void unrender() {
+ if (tab != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ unregisterFromLocaleChangedService();
+
+ YTab yTab = (YTab) getModel();
+ IEmbeddableEditpart editpart = ElementEditpart.getEditpart(
+ getViewContext(), yTab.getEmbeddable());
+
+ IWidgetPresentation<Component> childPresentation = editpart
+ .getPresentation();
+ childPresentation.unrender();
+
+ tab = null;
+ tabContent = null;
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+ private final YTab yTab;
+
+ public ModelAccess(YTab yTab) {
+ super();
+ this.yTab = yTab;
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yTab.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns true, if the label is valid.
+ *
+ * @return
+ */
+ public boolean isLabelValid() {
+ return yTab.getDatadescription() != null
+ && yTab.getDatadescription().getLabel() != null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return
+ */
+ public String getLabel() {
+ return yTab.getDatadescription().getLabel();
+ }
+
+ /**
+ * Returns true, if the label is valid.
+ *
+ * @return
+ */
+ public boolean isLabelI18nKeyValid() {
+ return yTab.getDatadescription() != null
+ && yTab.getDatadescription().getLabelI18nKey() != null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return
+ */
+ public String getLabelI18nKey() {
+ return yTab.getDatadescription().getLabelI18nKey();
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabSheetPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabSheetPresentation.java
new file mode 100644
index 0000000..ee092ec
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TabSheetPresentation.java
@@ -0,0 +1,338 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTabSheet;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITabSheetEditpart;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation.ITabSheetPresentation;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractTabSheetPresenter;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.TabSheet;
+
+import fi.jasoft.dragdroplayouts.DDTabSheet;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a tab sheet on the given layout.
+ */
+public class TabSheetPresentation extends
+ AbstractTabSheetPresenter<ComponentContainer> implements
+ ITabSheetPresentation<ComponentContainer>, IDesignListener {
+
+ /** The component base. */
+ private CssLayout componentBase;
+
+ /** The tab sheet. */
+ private DDTabSheet tabSheet;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /** The rendered tabs. */
+ private List<ITabEditpart> renderedTabs = new ArrayList<ITabEditpart>();
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that editpart.
+ */
+ public TabSheetPresentation(IElementEditpart editpart) {
+ super((ITabSheetEditpart) editpart);
+ this.modelAccess = new ModelAccess((YTabSheet) editpart.getModel());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ if (!isRendered()) {
+ return;
+ }
+
+ unrenderTabs();
+ tabSheet.removeAllComponents();
+
+ // iterate all elements and build the tab element
+ //
+ for (ITabEditpart editPart : getEditpart().getTabs()) {
+ addTab(editPart);
+ }
+ }
+
+ /**
+ * Is called to create the tab component and apply layouting defaults to it.
+ *
+ * @param editpart
+ * the editpart
+ */
+ protected void addTab(ITabEditpart editpart) {
+ editpart.render(tabSheet);
+ renderedTabs.add(editpart);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (componentBase == null) {
+ componentBase = new CssLayout();
+ setupComponent(componentBase, getCastedModel());
+ componentBase.setSizeFull();
+
+ componentBase.addStyleName(CSS_CLASS_CONTROL_BASE);
+ if (modelAccess.isCssIdValid()) {
+ componentBase.setId(modelAccess.getCssID());
+ } else {
+ componentBase.setId(getEditpart().getId());
+ }
+
+ associateWidget(componentBase, modelAccess.yLayout);
+
+ tabSheet = new DDTabSheet();
+ componentBase.addComponent(tabSheet);
+ tabSheet.setSizeFull();
+
+ associateWidget(tabSheet, modelAccess.yLayout);
+
+ if (modelAccess.isCssClassValid()) {
+ tabSheet.addStyleName(modelAccess.getCssClass());
+ } else {
+ tabSheet.addStyleName(CSS_CLASS_CONTROL);
+ }
+
+ initialize(tabSheet, getCastedModel());
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, tabSheet);
+
+ renderTabs(false);
+ }
+
+ return componentBase;
+ }
+
+ protected void createBindings(YTabSheet yField, TabSheet field) {
+ super.createBindings(yField, field, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return componentBase;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return componentBase != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (componentBase != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ ComponentContainer parent = ((ComponentContainer) componentBase
+ .getParent());
+ if (parent != null) {
+ parent.removeComponent(componentBase);
+ }
+
+ // remove assocations
+ unassociateWidget(componentBase);
+ unassociateWidget(tabSheet);
+
+ componentBase = null;
+ tabSheet = null;
+
+ // unrender the tabs
+ unrenderTabs();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.ui.core.editparts.extension.presentation
+ * .ITabSheetPresentation#renderTabs(boolean)
+ */
+ @Override
+ public void renderTabs(boolean force) {
+ if (force) {
+ unrenderTabs();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Unrender tab.
+ *
+ * @param editpart
+ * the editpart
+ */
+ public void unrenderTab(ITabEditpart editpart) {
+ if (editpart.isRendered()) {
+ Component c = (Component) editpart.getWidget();
+ tabSheet.removeTab(tabSheet.getTab(c));
+ editpart.unrender();
+
+ renderedTabs.remove(editpart);
+ }
+ }
+
+ /**
+ * Will unrender all tabs.
+ */
+ protected void unrenderTabs() {
+ try {
+ for (ITabEditpart editpart : renderedTabs) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ } finally {
+ renderedTabs.clear();
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YTabSheet yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YTabSheet yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java
new file mode 100644
index 0000000..1875af6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TablePresentation.java
@@ -0,0 +1,982 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.osbp.ecview.core.common.editpart.IConverterEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.emf.ElementEditpart;
+import org.eclipse.osbp.ecview.core.common.filter.IFilterablePresentation;
+import org.eclipse.osbp.ecview.core.common.filter.IRefreshRowsPresentation;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YFlatAlignment;
+import org.eclipse.osbp.ecview.core.common.model.datatypes.YDatadescription;
+import org.eclipse.osbp.ecview.core.common.presentation.DelegatingConverterFactory;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YColumn;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSortColumn;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTable;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITableEditpart;
+import org.eclipse.osbp.runtime.common.annotations.DtoUtils;
+import org.eclipse.osbp.runtime.common.annotations.PropertiesUtil;
+import org.eclipse.osbp.runtime.common.i18n.I18nUtil;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.common.converter.StringToFormattedNumberConverter;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItemContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.INestedPropertyAble;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.Container.Filterable;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.data.util.converter.ConverterUtil;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.Align;
+import com.vaadin.ui.Table.RowHeaderMode;
+import com.vaadin.ui.UI;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a table on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class TablePresentation extends AbstractFieldWidgetPresenter<Component>
+ implements IFilterablePresentation, IRefreshRowsPresentation {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The table. */
+ private Table table;
+
+ /** The property. */
+ @SuppressWarnings("rawtypes")
+ private ObjectProperty property;
+
+ /** The apply columns. */
+ private boolean applyColumns;
+
+ private boolean containerReadonly;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public TablePresentation(IElementEditpart editpart) {
+ super((ITableEditpart) editpart);
+ this.modelAccess = new ModelAccess((YTable) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (table == null) {
+
+ table = new CustomTable();
+ table.addStyleName(CSS_CLASS_CONTROL);
+ table.setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI);
+ table.setSelectable(true);
+ table.setImmediate(true);
+ setupComponent(table, getCastedModel());
+
+ associateWidget(table, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ table.setId(modelAccess.getCssID());
+ } else {
+ table.setId(getEditpart().getId());
+ }
+
+ if (table.isMultiSelect()) {
+ property = new ObjectProperty(new HashSet(), Set.class);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ } else {
+ property = new ObjectProperty(null, Object.class);
+ }
+ }
+ table.setPropertyDataSource(property);
+
+ applyColumns = false;
+ if (modelAccess.yField.getType() == String.class) {
+ IndexedContainer datasource = new IndexedContainer();
+ table.setContainerDataSource(datasource);
+ table.setItemCaptionMode(ItemCaptionMode.ID);
+ } else {
+ if (modelAccess.yField.getType() != null) {
+ IBeanSearchService<?> service = null;
+ IBeanSearchServiceFactory factory = getViewContext()
+ .getService(
+ IBeanSearchServiceFactory.class.getName());
+ if (factory != null) {
+ service = factory.createService(modelAccess.yField
+ .getType());
+ }
+ if (modelAccess.yField.isUseBeanService()
+ && service != null) {
+ ISharedStateContext sharedState = getViewContext()
+ .getService(ISharedStateContext.class.getName());
+ BeanServiceLazyLoadingContainer<?> datasource = new BeanServiceLazyLoadingContainer(
+ service, modelAccess.yField.getType(),
+ sharedState);
+ table.setContainerDataSource(datasource);
+ containerReadonly = true;
+ } else {
+ DeepResolvingBeanItemContainer datasource = new DeepResolvingBeanItemContainer(
+ modelAccess.yField.getType());
+ table.setContainerDataSource(datasource);
+ }
+ applyColumns = true;
+ } else {
+ IndexedContainer container = new IndexedContainer();
+ container.addContainerProperty("for", String.class, null);
+ container.addContainerProperty("preview", String.class,
+ null);
+ container.addItem(new String[] { "Some value", "other" });
+ table.setContainerDataSource(container);
+ }
+ }
+
+ String itemImageProperty = modelAccess.yField
+ .getItemImageProperty();
+ if (itemImageProperty != null && !itemImageProperty.equals("")) {
+ table.setItemIconPropertyId(itemImageProperty);
+ table.setRowHeaderMode(RowHeaderMode.EXPLICIT);
+ }
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, table);
+
+ if (modelAccess.isCssClassValid()) {
+ table.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(table);
+ }
+ return table;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.filter.IRefreshRowsPresentation#
+ * refreshRows()
+ */
+ @Override
+ public void refreshRows() {
+ if (isRendered()) {
+ table.refreshRowCache();
+ }
+ }
+
+ /**
+ * Applies the column setting to the table.
+ */
+ @SuppressWarnings({ "serial", "unchecked" })
+ protected void applyColumns() {
+ Class<?> type = modelAccess.yField.getType();
+
+ // set the visible columns and icons
+ List<String> columns = new ArrayList<String>();
+ Collection<?> propertyIds = table.getContainerDataSource()
+ .getContainerPropertyIds();
+
+ if (!modelAccess.yField.getColumns().isEmpty()) {
+ for (YColumn yColumn : modelAccess.yField.getColumns()) {
+ if (yColumn.isVisible()
+ && propertyIds.contains(yColumn.getPropertyPath())
+ || isNestedColumn(yColumn)) {
+ columns.add(yColumn.getPropertyPath());
+ }
+ }
+
+ // add nested properties
+ if (table.getContainerDataSource() instanceof INestedPropertyAble) {
+ INestedPropertyAble<?> container = (INestedPropertyAble<?>) table
+ .getContainerDataSource();
+ for (String property : columns) {
+ if (property.contains(".")) {
+ container.addNestedContainerProperty(property);
+ }
+ }
+ }
+
+ table.setVisibleColumns(columns.toArray(new Object[columns.size()]));
+ table.setColumnCollapsingAllowed(true);
+
+ II18nService i18nService = getViewContext().getService(
+ II18nService.class.getName());
+ IResourceProvider resourceProvider = (IResourceProvider) getViewContext()
+ .getService(IResourceProvider.class.getName());
+ // traverse the columns again and set other properties
+ for (YColumn yColumn : modelAccess.yField.getColumns()) {
+ if (yColumn.isVisible()
+ && (propertyIds.contains(yColumn.getPropertyPath()) || isNestedColumn(yColumn))) {
+ String columnId = yColumn.getPropertyPath();
+
+ table.setColumnHeader(columnId, getColumnHeader(yColumn));
+ table.setColumnAlignment(columnId,
+ toAlign(yColumn.getAlignment()));
+ table.setColumnCollapsed(columnId, yColumn.isCollapsed());
+ table.setColumnCollapsible(columnId,
+ yColumn.isCollapsible());
+ if (yColumn.getExpandRatio() >= 0) {
+ table.setColumnExpandRatio(columnId,
+ yColumn.getExpandRatio());
+ }
+ // Boolean check to display a checkbox instead of the
+ // boolean value as String.
+ if (yColumn.getType() == Boolean.class) {
+ // check to avoid an IllegalArgumentException adding an
+ // already existing ColumnGenerator.
+ if (table.getColumnGenerator(columnId) == null) {
+ table.addGeneratedColumn(columnId,
+ new Table.ColumnGenerator() {
+ public Component generateCell(
+ Table source, Object itemId,
+ Object columnId) {
+ Item item = table.getItem(itemId);
+ CheckBox box = new CheckBox();
+ box.setEnabled(false);
+ Boolean value = (Boolean) item
+ .getItemProperty(columnId)
+ .getValue();
+ box.setValue(value);
+ return box;
+ }
+ });
+ }
+ }
+ // --------------
+ if (yColumn.getIcon() != null
+ && !yColumn.getIcon().equals("")) {
+ if (i18nService != null) {
+ String translation = i18nService.getValue(yColumn
+ .getIcon(), UI.getCurrent().getLocale());
+ if (translation != null && !translation.equals("")) {
+ Resource icon = resourceProvider
+ .getResource(translation);
+ if (icon != null) {
+ table.setColumnIcon(columnId, icon);
+ }
+ }
+ } else {
+ table.setColumnIcon(columnId, resourceProvider
+ .getResource(yColumn.getIcon()));
+ }
+ }
+ }
+ }
+
+ // apply the converters
+ //
+ for (YColumn yColumn : modelAccess.yField.getColumns()) {
+ if (yColumn.getConverter() == null) {
+ // try to derive the converter from the datatype property at
+ // field level
+ String columnId = yColumn.getPropertyPath();
+ Class<?> resultClass = table.getContainerDataSource()
+ .getType(columnId);
+ if (Number.class.isAssignableFrom(resultClass)
+ && PropertiesUtil.hasKey(type, columnId,
+ "decimalformat")) {
+ String format = PropertiesUtil.getValue(type, columnId,
+ "decimalformat");
+ if (format != null && !format.isEmpty()) {
+ table.setConverter(
+ columnId,
+ new StringToFormattedNumberConverter(
+ format,
+ (Class<? extends Number>) resultClass));
+ }
+ }
+ } else {
+ @SuppressWarnings("rawtypes")
+ Converter converter = (Converter) DelegatingConverterFactory
+ .getInstance().createConverter(
+ getViewContext(),
+ (IConverterEditpart) ElementEditpart
+ .getEditpart(getViewContext(),
+ yColumn.getConverter()));
+ if (converter != null) {
+ String columnId = yColumn.getPropertyPath();
+ table.setConverter(columnId, converter);
+ }
+ }
+ }
+ }
+
+ // apply the sort order
+ applySortOrder();
+
+ applyCellStyles();
+
+ // apply the dirty flag
+ // applyDirtyFlag(type);
+ }
+
+ @SuppressWarnings("serial")
+ protected void applyCellStyles() {
+ table.setCellStyleGenerator(new Table.CellStyleGenerator() {
+
+ @Override
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
+ if (itemId == null || propertyId == null) {
+ return "";
+ }
+ if (Number.class.isAssignableFrom(source
+ .getContainerDataSource().getType(propertyId))) {
+ return " v-align-right";
+ }
+ return "";
+ }
+ });
+ }
+
+ // protected void applyDirtyFlag(Class<?> type) {
+ // final String dirtyProperty = getDirtyProperty(type);
+ // // if a dirty property is available, we use it
+ // if (dirtyProperty != null) {
+ // table.setCellStyleGenerator(new Table.CellStyleGenerator() {
+ // private static final long serialVersionUID = -2462674164411654020L;
+ // @Override
+ // public String getStyle(Table source, Object itemId,
+ // Object propertyId) {
+ // if (propertyId == null) {
+ // return null;
+ // }
+ // if (propertyId.equals(dirtyProperty)) {
+ // try {
+ // boolean dirty = DtoUtils.invokeDirtyGetter(itemId);
+ // return dirty ? "dirty" : null;
+ // } catch (IllegalAccessException e) {
+ // }
+ // } else {
+ // Class<?> propertyType = source.getContainerDataSource()
+ // .getType(propertyId);
+ // if (Number.class.isAssignableFrom(propertyType)) {
+ // return "v-align-right";
+ // }
+ // }
+ // }
+ // table.setCellStyleGenerator(new Table.CellStyleGenerator() {
+ // @Override
+ // public String getStyle(Table source, Object itemId,
+ // Object propertyId) {
+ // if (propertyId == null) {
+ // return null;
+ // }
+ // });
+ // }
+
+ protected void applySortOrder() {
+ if (!modelAccess.yField.getSortOrder().isEmpty()
+ && table.getContainerDataSource() instanceof Container.Sortable) {
+ List<String> sortCol = new ArrayList<>();
+ List<Boolean> sortDirection = new ArrayList<>();
+ for (YSortColumn yColumn : modelAccess.yField.getSortOrder()) {
+ // add the nested sort columns to the container
+ if (isNestedColumn(yColumn)) {
+ if (table.getContainerDataSource() instanceof INestedPropertyAble) {
+ INestedPropertyAble<?> container = (INestedPropertyAble<?>) table
+ .getContainerDataSource();
+ container.addNestedContainerProperty(yColumn
+ .getPropertyPath());
+ }
+ }
+
+ sortCol.add(yColumn.getPropertyPath());
+ sortDirection.add(yColumn.isAsc());
+ }
+ Container.Sortable sortable = (Container.Sortable) table
+ .getContainerDataSource();
+
+ boolean[] asc = new boolean[sortDirection.size()];
+ for (int i = 0; i < sortDirection.size(); i++) {
+ asc[i] = sortDirection.get(i);
+ }
+
+ sortable.sort(sortCol.toArray(new String[sortCol.size()]), asc);
+
+ if (!sortCol.isEmpty()) {
+ table.setSortContainerPropertyId(sortCol.get(0));
+ table.setSortAscending(asc[0]);
+ }
+ }
+ }
+
+ /**
+ * Gets the dirty property.
+ *
+ * @param type
+ * the type
+ * @return the dirty property
+ */
+ protected String getDirtyProperty(Class<?> type) {
+ String temp = null;
+ java.lang.reflect.Field dirtyField = DtoUtils.getDirtyField(type);
+ if (dirtyField != null) {
+ temp = dirtyField.getName();
+ }
+ return temp;
+ }
+
+ /**
+ * Checks if is nested column.
+ *
+ * @param yColumn
+ * the y column
+ * @return true, if is nested column
+ */
+ protected boolean isNestedColumn(YColumn yColumn) {
+ return yColumn.getPropertyPath() != null
+ && yColumn.getPropertyPath().contains(".");
+ }
+
+ /**
+ * Checks if is nested column.
+ *
+ * @param yColumn
+ * the y column
+ * @return true, if is nested column
+ */
+ protected boolean isNestedColumn(YSortColumn yColumn) {
+ return yColumn.getPropertyPath() != null
+ && yColumn.getPropertyPath().contains(".");
+ }
+
+ /**
+ * Returns the column header.
+ *
+ * @param yColumn
+ * the y column
+ * @return the column header
+ */
+ private String getColumnHeader(YColumn yColumn) {
+ YDatadescription yDt = yColumn.getDatadescription();
+ if (yDt == null) {
+ return yColumn.getPropertyPath();
+ }
+
+ String result = null;
+ II18nService service = getI18nService();
+ if (service != null && yDt.getLabelI18nKey() != null) {
+ result = service.getValue(yDt.getLabelI18nKey(), getLocale());
+ }
+
+ if (result == null || result.equals("")) {
+ result = yDt.getLabel();
+ }
+
+ if (result == null || result.equals("")) {
+ result = yColumn.getPropertyPath();
+ }
+
+ return result;
+ }
+
+ /**
+ * To align.
+ *
+ * @param alignment
+ * the alignment
+ * @return the align
+ */
+ private Align toAlign(YFlatAlignment alignment) {
+ switch (alignment) {
+ case LEFT:
+ return Align.LEFT;
+ case CENTER:
+ return Align.CENTER;
+ case RIGHT:
+ return Align.RIGHT;
+ }
+ return Align.LEFT;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+
+ // applies the column properties
+ if (applyColumns) {
+ applyColumns();
+ }
+
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), table);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.ecview.core.common.filter.IFilterablePresentation#
+ * applyFilter(java.lang.Object)
+ */
+ @Override
+ public void applyFilter(Object filter) {
+ Container container = table.getContainerDataSource();
+ if (container instanceof Container.Filterable) {
+ Container.Filterable filterable = (Filterable) container;
+ filterable.removeAllContainerFilters();
+ if (filter != null) {
+ filterable.addContainerFilter((Filter) filter);
+ } else {
+ if (container instanceof ILazyRefreshFilterable) {
+ ILazyRefreshFilterable lazyFilterable = (ILazyRefreshFilterable) container;
+ lazyFilterable.refreshFilters();
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return table;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter
+ * #internalGetObservableEndpoint(org.eclipse.osbp
+ * .ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ } else if (bindableValue instanceof YEmbeddableMultiSelectionEndpoint) {
+ return internalGetMultiSelectionEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YTABLE__COLLECTION).observe(
+ getModel());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YTABLE__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetMultiSelectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YTABLE__MULTI_SELECTION)
+ .observe(getModel());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YTable yField, Table field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsContainerContents(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTABLE__COLLECTION, field,
+ yField.getType(), containerReadonly));
+
+ // create the model binding from ridget to ECView-model
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsMultiSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTABLE__MULTI_SELECTION,
+ field, yField.getType()));
+ } else {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTABLE__SELECTION, field,
+ yField.getType()));
+
+ }
+
+ super.createBindings(yField, field, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return table;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return table != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (table != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) table.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(table);
+ }
+
+ // remove assocations
+ unassociateWidget(table);
+
+ table = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YTable yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YTable yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * Converts the string value of the item icon property to
+ * {@link ThemeResource}.
+ */
+ @SuppressWarnings("serial")
+ private class CustomTable extends Table {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ // super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ if (icon instanceof String) {
+ return new ThemeResource((String) icon);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.Table#formatPropertyValue(java.lang.Object,
+ * java.lang.Object, com.vaadin.data.Property)
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected String formatPropertyValue(Object rowId, Object colId,
+ Property<?> property) {
+ if (property == null) {
+ return "";
+ }
+ Converter<String, Object> converter = null;
+
+ if (hasConverter(colId)) {
+ converter = getConverter(colId);
+ } else {
+ converter = (Converter) ConverterUtil.getConverter(
+ String.class, property.getType(), getSession());
+ }
+ Object value = property.getValue();
+ if (converter != null) {
+ return converter.convertToPresentation(value, String.class,
+ getLocale());
+ } else {
+ if (value instanceof Enum<?>) {
+ return I18nUtil.translateEnum(getI18nService(), value,
+ getLocale());
+ } else if (value instanceof Boolean) {
+ return I18nUtil.translateBoolean(getI18nService(),
+ (Boolean) value, getLocale());
+ } else if (value instanceof Number) {
+ return I18nUtil.translateNumber(getI18nService(),
+ (Number) value, getLocale());
+ }
+ }
+ return (null != value) ? value.toString() : "";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#focus()
+ */
+ @Override
+ public void focus() {
+ super.focus();
+
+ setValue(getCurrentPageFirstItemId());
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java
new file mode 100644
index 0000000..8bdf4a7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextAreaPresentation.java
@@ -0,0 +1,328 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextArea;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextAreaEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.TextArea;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text area on the given layout.
+ */
+public class TextAreaPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The text area. */
+ private CustomField textArea;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public TextAreaPresentation(IElementEditpart editpart) {
+ super((ITextAreaEditpart) editpart);
+ this.modelAccess = new ModelAccess((YTextArea) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (textArea == null) {
+
+ textArea = new CustomField();
+ int rows = modelAccess.yField.getRows();
+ if (rows > 0) {
+ textArea.setRows(modelAccess.yField.getRows());
+ }
+ textArea.setSizeFull();
+ textArea.addStyleName(CSS_CLASS_CONTROL);
+ textArea.setImmediate(true);
+ textArea.setNullRepresentation("");
+ setupComponent(textArea, getCastedModel());
+
+ associateWidget(textArea, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ textArea.setId(modelAccess.getCssID());
+ } else {
+ textArea.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<String>(null, String.class);
+ textArea.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, textArea);
+
+ if (modelAccess.isCssClassValid()) {
+ textArea.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(textArea);
+
+ textArea.setRows(modelAccess.yField.getRows());
+ textArea.setWordwrap(modelAccess.yField.isWordWrap());
+ }
+ return textArea;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), textArea);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return textArea;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_AREA__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YTextArea yField, TextArea field) {
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_AREA__VALUE, textArea));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return textArea;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return textArea != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (textArea != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) textArea.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(textArea);
+ }
+
+ // remove assocations
+ unassociateWidget(textArea);
+
+ textArea = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YTextArea yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YTextArea yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomField extends TextArea {
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if (isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java
new file mode 100644
index 0000000..8a465e5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextFieldPresentation.java
@@ -0,0 +1,330 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextFieldEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.Validator;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.TextField;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class TextFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The text. */
+ private CustomTextField text;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public TextFieldPresentation(IElementEditpart editpart) {
+ super((ITextFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess((YTextField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (text == null) {
+
+ text = new CustomTextField();
+ text.addStyleName(CSS_CLASS_CONTROL);
+ text.setNullRepresentation("");
+ text.setImmediate(true);
+ setupComponent(text, getCastedModel());
+
+ associateWidget(text, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ text.setId(modelAccess.getCssID());
+ } else {
+ text.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<String>(null, String.class);
+ text.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, text);
+
+ if (modelAccess.isCssClassValid()) {
+ text.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(text);
+ }
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), text);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YTextField yField, TextField field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_FIELD__VALUE, text));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return text != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (text != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) text.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(text);
+ }
+
+ // remove assocations
+ unassociateWidget(text);
+
+ text = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YTextField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YTextField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+
+ /**
+ * The Class CustomTextField.
+ */
+ @SuppressWarnings("serial")
+ private class CustomTextField extends TextField {
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getErrorMessage()
+ */
+ @Override
+ public ErrorMessage getErrorMessage() {
+ if(isDisposed()) {
+ // after disposal, Vaadin will call this method once.
+ return null;
+ }
+
+ ErrorMessage message = super.getErrorMessage();
+ reportValidationError(message);
+ return message;
+ }
+
+ protected void validate(String fieldValue)
+ throws Validator.InvalidValueException {
+ if(fieldValue != null && fieldValue.equals(getNullRepresentation())) {
+ super.validate(null);
+ }else {
+ super.validate(fieldValue);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextSearchFieldPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextSearchFieldPresentation.java
new file mode 100644
index 0000000..31b1154
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TextSearchFieldPresentation.java
@@ -0,0 +1,329 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableValueEndpoint;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextSearchField;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITextSearchFieldEditpart;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.TextSearchField;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class TextSearchFieldPresentation extends
+ AbstractFieldWidgetPresenter<Component> implements
+ IFilterProvidingPresentation {
+
+ /** The Constant LOGGER. */
+ @SuppressWarnings("unused")
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(TextSearchFieldPresentation.class);
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The field. */
+ private TextSearchField field;
+
+ /** The property. */
+ private ObjectProperty<String> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public TextSearchFieldPresentation(IElementEditpart editpart) {
+ super((ITextSearchFieldEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YTextSearchField) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (field == null) {
+ IBindingManager bm = getViewContext().getService(
+ IECViewBindingManager.class.getName());
+ field = new TextSearchField(getEditpart().getId(),
+ modelAccess.yField.getPropertyPath(),
+ bm.getDatabindingContext());
+ field.addStyleName(CSS_CLASS_CONTROL);
+ field.addStyleName(IConstants.CSS_CLASS_SEARCHFIELD);
+
+ field.setNullRepresentation("");
+ field.setImmediate(true);
+ setupComponent(field, getCastedModel());
+
+ associateWidget(field, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ field.setId(modelAccess.getCssID());
+ } else {
+ field.setId(getEditpart().getId());
+ }
+
+ property = new ObjectProperty<String>(null, String.class);
+ field.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, field);
+
+ if (modelAccess.isCssClassValid()) {
+ field.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(field);
+ }
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.filter.IFilterProvidingPresentation#getFilter()
+ */
+ @Override
+ public Object getFilter() {
+ return field != null ? field.getFilter() : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ II18nService service = getI18nService();
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), field);
+
+ field.setDescription(service.getValue(
+ IConstants.I18N_TOOLTIP_TEXTSEARCHFIELD, getLocale()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableValueEndpoint) {
+ return internalGetValueEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe value.
+ *
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetValueEndpoint() {
+ // return the observable value for text
+ return EMFObservables.observeValue(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_SEARCH_FIELD__VALUE);
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YTextSearchField yField, TextSearchField field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_Value(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTEXT_SEARCH_FIELD__VALUE, field));
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return field;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return field != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (field != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) field.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(field);
+ }
+
+ // remove assocations
+ unassociateWidget(field);
+
+ field.dispose();
+ field = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YTextSearchField yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YTextSearchField yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TreePresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TreePresentation.java
new file mode 100644
index 0000000..d7cfd81
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/TreePresentation.java
@@ -0,0 +1,364 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFProperties;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableCollectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableMultiSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableSelectionEndpoint;
+import org.eclipse.osbp.ecview.core.databinding.emf.model.ECViewModelBindable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.ExtensionModelPackage;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YSelectionType;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTree;
+import org.eclipse.osbp.ecview.core.ui.core.editparts.extension.ITreeEditpart;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util.Util;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.Tree;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a tree on the given layout.
+ */
+@SuppressWarnings("restriction")
+public class TreePresentation extends AbstractFieldWidgetPresenter<Component> {
+
+ /** The model access. */
+ private final ModelAccess modelAccess;
+
+ /** The tree. */
+ private Tree tree;
+
+ /** The property. */
+ private ObjectProperty<?> property;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart of that presenter
+ */
+ public TreePresentation(IElementEditpart editpart) {
+ super((ITreeEditpart) editpart);
+ this.modelAccess = new ModelAccess((YTree) editpart.getModel());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public Component doCreateWidget(Object parent) {
+ if (tree == null) {
+
+ tree = new Tree();
+ tree.addStyleName(CSS_CLASS_CONTROL);
+ tree.setMultiSelect(modelAccess.yField.getSelectionType() == YSelectionType.MULTI);
+ tree.setImmediate(true);
+ setupComponent(tree, getCastedModel());
+
+ associateWidget(tree, modelAccess.yField);
+ if (modelAccess.isCssIdValid()) {
+ tree.setId(modelAccess.getCssID());
+ } else {
+ tree.setId(getEditpart().getId());
+ }
+
+ if (tree.isMultiSelect()) {
+ property = new ObjectProperty(new HashSet(), Set.class);
+ } else {
+ property = new ObjectProperty(null,
+ modelAccess.yField.getType());
+ }
+ tree.setPropertyDataSource(property);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yField, tree);
+
+ if (modelAccess.isCssClassValid()) {
+ tree.addStyleName(modelAccess.getCssClass());
+ }
+
+ applyCaptions();
+
+ initializeField(tree);
+ }
+ return tree;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
+ modelAccess.getLabelI18nKey(), getLocale(), tree);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractFieldWidgetPresenter#doGetField()
+ */
+ @Override
+ protected Field<?> doGetField() {
+ return tree;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractVaadinWidgetPresenter#internalGetObservableEndpoint(org.eclipse.osbp.ecview.core.common.model.core.YEmbeddableBindingEndpoint)
+ */
+ @Override
+ protected IObservable internalGetObservableEndpoint(
+ YEmbeddableBindingEndpoint bindableValue) {
+ if (bindableValue == null) {
+ throw new IllegalArgumentException(
+ "BindableValue must not be null!");
+ }
+
+ if (bindableValue instanceof YEmbeddableCollectionEndpoint) {
+ return internalGetCollectionEndpoint();
+ } else if (bindableValue instanceof YEmbeddableSelectionEndpoint) {
+ return internalGetSelectionEndpoint((YEmbeddableSelectionEndpoint) bindableValue);
+ } else if (bindableValue instanceof YEmbeddableMultiSelectionEndpoint) {
+ return internalGetMultiSelectionEndpoint();
+ }
+ throw new IllegalArgumentException("Not a valid input: "
+ + bindableValue);
+ }
+
+ /**
+ * Returns the observable to observe the collection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetCollectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YTREE__COLLECTION).observe(
+ getModel());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @return the i observable list
+ */
+ protected IObservableList internalGetMultiSelectionEndpoint() {
+ // return the observable value for text
+ return EMFProperties.list(
+ ExtensionModelPackage.Literals.YTREE__MULTI_SELECTION).observe(
+ getModel());
+ }
+
+ /**
+ * Returns the observable to observe the selection.
+ *
+ * @param yEndpoint
+ * the y endpoint
+ * @return the i observable value
+ */
+ protected IObservableValue internalGetSelectionEndpoint(
+ YEmbeddableSelectionEndpoint yEndpoint) {
+
+ String attributePath = ECViewModelBindable.getAttributePath(
+ ExtensionModelPackage.Literals.YTREE__SELECTION,
+ yEndpoint.getAttributePath());
+
+ // return the observable value for text
+ return ECViewModelBindable.observeValue(castEObject(getModel()),
+ attributePath, modelAccess.yField.getType(),
+ modelAccess.yField.getEmfNsURI());
+ }
+
+ /**
+ * Creates the bindings for the given values.
+ *
+ * @param yField
+ * the y field
+ * @param field
+ * the field
+ */
+ protected void createBindings(YTree yField, Tree field) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindings_ContainerContents(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTREE__COLLECTION, field,
+ yField.getType()));
+
+ // create the model binding from ridget to ECView-model
+ if (modelAccess.yField.getSelectionType() == YSelectionType.MULTI) {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsMultiSelection(
+ castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTREE__MULTI_SELECTION,
+ field, yField.getType()));
+ } else {
+ // create the model binding from ridget to ECView-model
+ registerBinding(createBindingsSelection(castEObject(getModel()),
+ ExtensionModelPackage.Literals.YTREE__SELECTION, field,
+ yField.getType()));
+
+ }
+
+ super.createBindings(yField, field, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return tree;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return tree != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doUnrender() {
+ if (tree != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ Component parent = ((Component) tree.getParent());
+ if (parent != null && parent instanceof ComponentContainer) {
+ ((ComponentContainer) parent).removeComponent(tree);
+ }
+
+ // remove assocations
+ unassociateWidget(tree);
+
+ tree = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /**
+ * A helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y field. */
+ private final YTree yField;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yField
+ * the y field
+ */
+ public ModelAccess(YTree yField) {
+ super();
+ this.yField = yField;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yField.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yField.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label
+ */
+ public String getLabel() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabel() : null;
+ }
+
+ /**
+ * Returns the label.
+ *
+ * @return the label i18n key
+ */
+ public String getLabelI18nKey() {
+ return yField.getDatadescription() != null ? yField
+ .getDatadescription().getLabelI18nKey() : null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ValidatorAdapter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ValidatorAdapter.java
new file mode 100644
index 0000000..6832b61
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ValidatorAdapter.java
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.osbp.ecview.core.common.validation.IValidator;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.common.validation.IStatus;
+import org.eclipse.osbp.runtime.common.validation.Status;
+
+import com.vaadin.data.validator.AbstractValidator;
+
+@SuppressWarnings({ "serial", "rawtypes" })
+public class ValidatorAdapter extends AbstractValidator implements IValidator {
+
+ private final IValidator wrappedValidator;
+ private IStatus status;
+
+ public ValidatorAdapter(IValidator wrappedValidator) {
+ super("");
+ this.wrappedValidator = wrappedValidator;
+ }
+
+ @Override
+ protected boolean isValidValue(Object value) {
+ status = wrappedValidator.validateValue(value);
+ return status != null ? status.isOK() : true;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return wrappedValidator.getType();
+ }
+
+ @Override
+ public boolean isCheckValidType() {
+ return wrappedValidator.isCheckValidType();
+ }
+
+ @Override
+ public void updateParameter(Object model) {
+ wrappedValidator.updateParameter(model);
+ }
+
+ @Override
+ public IStatus validateValue(Object value) {
+ return wrappedValidator.validateValue(value);
+ }
+
+ protected boolean isValidType(Object value) {
+
+ if (!wrappedValidator.isCheckValidType()) {
+ // some validator do not require type check
+ return true;
+ }
+
+ boolean result = super.isValidType(value);
+ if (!result) {
+ status = Status.createStatus("LUN_VALID_TYPE", wrappedValidator.getClass(),
+ IStatus.Severity.ERROR, "Required type {0}");
+ } else {
+ status = null;
+ }
+
+ return result;
+ }
+
+ public String getErrorMessage() {
+ return status != null ? status.getMessage() : "";
+ }
+
+ @Override
+ public Set<IStatus> getCurrentStatus() {
+ return wrappedValidator.getCurrentStatus();
+ }
+
+ @Override
+ public boolean isDisposed() {
+ return false;
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+ @Override
+ public void addDisposeListener(Listener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeDisposeListener(Listener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ wrappedValidator.setLocale(locale);
+ }
+
+ @Override
+ public void setI18nService(II18nService i18nService) {
+ wrappedValidator.setI18nService(i18nService);
+ }
+
+ @Override
+ public boolean isDisposing() {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/VerticalLayoutPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/VerticalLayoutPresentation.java
new file mode 100644
index 0000000..883c8fc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/VerticalLayoutPresentation.java
@@ -0,0 +1,643 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.ILayoutEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YAlignment;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayoutCellStyle;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.AbstractLayoutPresenter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.ComponentContainer;
+
+import fi.jasoft.dragdroplayouts.DDVerticalLayout;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class VerticalLayoutPresentation extends
+ AbstractLayoutPresenter<ComponentContainer> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(VerticalLayoutPresentation.class);
+
+ /** The vertical layout. */
+ private DDVerticalLayout verticalLayout;
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /**
+ * The constructor.
+ *
+ * @param editpart
+ * The editpart of that presentation.
+ */
+ public VerticalLayoutPresentation(IElementEditpart editpart) {
+ super((ILayoutEditpart) editpart);
+ this.modelAccess = new ModelAccess(
+ (YVerticalLayout) editpart.getModel());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUpdateLocale(java.util.Locale)
+ */
+ @Override
+ protected void doUpdateLocale(Locale locale) {
+ // no need to set the locale to the ui elements. Is handled by vaadin
+ // internally.
+
+ // update the captions
+ applyCaptions();
+ }
+
+ /**
+ * Applies the labels to the widgets.
+ */
+ protected void applyCaptions() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #updateCellStyle(org.eclipse.osbp.ecview.core.common
+ * .model.core.YEmbeddable)
+ */
+ public void updateCellStyle(YEmbeddable child) {
+ // refresh the whole ui
+ refreshUI();
+ }
+
+ /**
+ * Is called to refresh the UI. The element will be removed from the grid
+ * layout and added to it again afterwards.
+ */
+ protected void refreshUI() {
+ verticalLayout.removeAllComponents();
+
+ // create a map containing the style for the embeddable
+ //
+ Map<YEmbeddable, YVerticalLayoutCellStyle> yStyles = new HashMap<YEmbeddable, YVerticalLayoutCellStyle>();
+ for (YVerticalLayoutCellStyle style : modelAccess.getCellStyles()) {
+ if (yStyles.containsKey(style.getTarget())) {
+ LOGGER.warn("Multiple style for element {}", style.getTarget());
+ }
+ yStyles.put(style.getTarget(), style);
+ }
+
+ // iterate all elements and build the child element
+ //
+ List<Cell> cells = new ArrayList<Cell>();
+ for (IEmbeddableEditpart childPresentation : getChildren()) {
+ YEmbeddable yChild = (YEmbeddable) childPresentation.getModel();
+ cells.add(addChildComponent(childPresentation, yStyles.get(yChild)));
+ }
+
+ for (Cell cell : cells) {
+ if (cell.isExpandVertical()) {
+ // expandVerticalFound = true;
+ verticalLayout.setExpandRatio(cell.getComponent(), 1.0f);
+ }
+ }
+
+ }
+
+ /**
+ * Is called to create the child component and apply layouting defaults to
+ * it.
+ *
+ * @param editpart
+ * the editpart
+ * @param yStyle
+ * the y style
+ * @return the cell
+ */
+ protected Cell addChildComponent(IEmbeddableEditpart editpart,
+ YVerticalLayoutCellStyle yStyle) {
+
+ Component child = (Component) editpart.render(verticalLayout);
+
+ // calculate and apply the alignment to be used
+ //
+ YAlignment yAlignment = yStyle != null && yStyle.getAlignment() != null ? yStyle
+ .getAlignment() : YAlignment.TOP_LEFT;
+
+ verticalLayout.addComponent(child);
+ applyAlignment(child, yAlignment);
+
+ return new Cell(child, yAlignment);
+ }
+
+ /**
+ * Sets the alignment to the component.
+ *
+ * @param child
+ * the child
+ * @param yAlignment
+ * the y alignment
+ */
+ protected void applyAlignment(Component child, YAlignment yAlignment) {
+
+ if (yAlignment != null) {
+ child.setSizeUndefined();
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_CENTER);
+ break;
+ case BOTTOM_FILL:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_LEFT);
+ child.setWidth("100%");
+ break;
+ case BOTTOM_LEFT:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_LEFT);
+ break;
+ case BOTTOM_RIGHT:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.BOTTOM_RIGHT);
+ break;
+ case MIDDLE_CENTER:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_CENTER);
+ break;
+ case MIDDLE_FILL:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_LEFT);
+ child.setWidth("100%");
+ break;
+ case MIDDLE_LEFT:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_LEFT);
+ break;
+ case MIDDLE_RIGHT:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.MIDDLE_RIGHT);
+ break;
+ case TOP_CENTER:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.TOP_CENTER);
+ break;
+ case TOP_FILL:
+ verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setWidth("100%");
+ break;
+ case TOP_LEFT:
+ verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ break;
+ case TOP_RIGHT:
+ verticalLayout
+ .setComponentAlignment(child, Alignment.TOP_RIGHT);
+ break;
+ case FILL_CENTER:
+ verticalLayout.setComponentAlignment(child,
+ Alignment.TOP_CENTER);
+ child.setHeight("100%");
+ break;
+ case FILL_FILL:
+ verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setWidth("100%");
+ child.setHeight("100%");
+ break;
+ case FILL_LEFT:
+ verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setHeight("100%");
+ break;
+ case FILL_RIGHT:
+ verticalLayout
+ .setComponentAlignment(child, Alignment.TOP_RIGHT);
+ child.setHeight("100%");
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doCreateWidget(java.lang.Object)
+ */
+ @Override
+ public ComponentContainer doCreateWidget(Object parent) {
+ if (verticalLayout == null) {
+ verticalLayout = new DDVerticalLayout();
+ setupComponent(verticalLayout, getCastedModel());
+
+ associateWidget(verticalLayout, modelAccess.yLayout);
+
+ if (modelAccess.isCssIdValid()) {
+ verticalLayout.setId(modelAccess.getCssID());
+ } else {
+ verticalLayout.setId(getEditpart().getId());
+ }
+
+ if (modelAccess.isMargin()) {
+ verticalLayout.addStyleName(IConstants.CSS_CLASS_MARGIN);
+ verticalLayout.setMargin(true);
+ }
+
+ if (!modelAccess.isSpacing()) {
+ verticalLayout.setSpacing(false);
+ } else {
+ verticalLayout.addStyleName(IConstants.CSS_CLASS_SPACING);
+ verticalLayout.setSpacing(true);
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ verticalLayout.addStyleName(modelAccess.getCssClass());
+ } else {
+ verticalLayout.addStyleName(CSS_CLASS_CONTROL);
+ }
+ verticalLayout.addStyleName(IConstants.CSS_CLASS_VERTICALLAYOUT);
+
+ // creates the binding for the field
+ createBindings(modelAccess.yLayout, verticalLayout, null);
+
+ // initialize all children
+ initializeChildren();
+
+ // and now render children
+ renderChildren(false);
+ }
+
+ return verticalLayout;
+ }
+
+ /**
+ * Adds the children to the superclass and prevents rendering.
+ */
+ private void initializeChildren() {
+ setRenderLock(true);
+ try {
+ for (IEmbeddableEditpart editPart : getEditpart().getElements()) {
+ super.add(editPart);
+ }
+ } finally {
+ setRenderLock(false);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * getWidget()
+ */
+ @Override
+ public ComponentContainer getWidget() {
+ return verticalLayout;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#
+ * isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return verticalLayout != null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter#internalDispose()
+ */
+ @Override
+ protected void internalDispose() {
+ try {
+ for (IEmbeddableEditpart child : new ArrayList<IEmbeddableEditpart>(
+ getChildren())) {
+ child.dispose();
+ }
+ unrender();
+ } finally {
+ super.internalDispose();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractVaadinWidgetPresenter#doUnrender()
+ */
+ @Override
+ public void doUnrender() {
+ if (verticalLayout != null) {
+
+ // unbind all active bindings
+ unbind();
+
+ // remove assocations
+ unassociateWidget(verticalLayout);
+
+ // unrender the children
+ unrenderChildren();
+
+ verticalLayout.removeAllComponents();
+ verticalLayout = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalAdd(org.eclipse.osbp.ecview.core.common.editpart
+ * .IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalAdd(IEmbeddableEditpart editpart) {
+ YEmbeddable yChild = (YEmbeddable) editpart.getModel();
+ addChildComponent(editpart, modelAccess.getCellStyle(yChild));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalRemove(org.eclipse.osbp.ecview.core.common
+ * .editpart.IEmbeddableEditpart)
+ */
+ @Override
+ protected void internalRemove(IEmbeddableEditpart child) {
+ if (verticalLayout != null && child.isRendered()) {
+ verticalLayout.removeComponent((Component) child.getWidget());
+ }
+
+ child.unrender();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalInsert(org.eclipse.osbp.ecview.core.common
+ * .editpart.IEmbeddableEditpart, int)
+ */
+ @Override
+ protected void internalInsert(IEmbeddableEditpart editpart, int index) {
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.common.
+ * AbstractLayoutPresenter
+ * #internalMove(org.eclipse.osbp.ecview.core.common.editpart
+ * .IEmbeddableEditpart, int, int)
+ */
+ @Override
+ protected void internalMove(IEmbeddableEditpart editpart, int oldIndex,
+ int newIndex) {
+ refreshUI();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.ecview.core.common.presentation.ILayoutPresentation#
+ * renderChildren(boolean)
+ */
+ @Override
+ public void renderChildren(boolean force) {
+ if (force) {
+ unrenderChildren();
+ }
+
+ refreshUI();
+ }
+
+ /**
+ * Will unrender all children.
+ */
+ protected void unrenderChildren() {
+ for (IEmbeddableEditpart editpart : getChildren()) {
+ if (editpart.isRendered()) {
+ editpart.unrender();
+ }
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y layout. */
+ private final YVerticalLayout yLayout;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yLayout
+ * the y layout
+ */
+ public ModelAccess(YVerticalLayout yLayout) {
+ super();
+ this.yLayout = yLayout;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yLayout.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Checks if is spacing.
+ *
+ * @return true, if is spacing
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YVerticalLayout#isSpacing()
+ */
+ public boolean isSpacing() {
+ return yLayout.isSpacing();
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yLayout.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Checks if is margin.
+ *
+ * @return true, if is margin
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YVerticalLayout#isMargin()
+ */
+ public boolean isMargin() {
+ return yLayout.isMargin();
+ }
+
+ /**
+ * Gets the cell styles.
+ *
+ * @return the cell styles
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YVerticalLayout#getCellStyles()
+ */
+ public EList<YVerticalLayoutCellStyle> getCellStyles() {
+ return yLayout.getCellStyles();
+ }
+
+ /**
+ * Gets the cell style.
+ *
+ * @param element
+ * the element
+ * @return the cell style
+ */
+ public YVerticalLayoutCellStyle getCellStyle(YEmbeddable element) {
+ return yLayout.getCellStyle(element);
+ }
+
+ }
+
+ /**
+ * The Class Cell.
+ */
+ public static class Cell {
+
+ /** The component. */
+ private final Component component;
+
+ /** The alignment. */
+ private final YAlignment alignment;
+
+ /**
+ * Instantiates a new cell.
+ *
+ * @param component
+ * the component
+ * @param alignment
+ * the alignment
+ */
+ public Cell(Component component, YAlignment alignment) {
+ super();
+ this.component = component;
+ this.alignment = alignment;
+ }
+
+ /**
+ * Gets the component.
+ *
+ * @return the component
+ */
+ protected Component getComponent() {
+ return component;
+ }
+
+ /**
+ * Gets the alignment.
+ *
+ * @return the alignment
+ */
+ protected YAlignment getAlignment() {
+ return alignment;
+ }
+
+ /**
+ * Checks if is expand vertical.
+ *
+ * @return true, if is expand vertical
+ */
+ protected boolean isExpandVertical() {
+ switch (alignment) {
+ case FILL_CENTER:
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Checks if is expand horizontal.
+ *
+ * @return true, if is expand horizontal
+ */
+ protected boolean isExpandHorizontal() {
+ switch (alignment) {
+ case BOTTOM_FILL:
+ case FILL_FILL:
+ case MIDDLE_FILL:
+ case TOP_FILL:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java
new file mode 100644
index 0000000..7d0d296
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/ViewPresentation.java
@@ -0,0 +1,798 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.editpart.IDialogEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.IViewEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.binding.IBindableEndpointEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent;
+import org.eclipse.osbp.ecview.core.common.model.core.YAlignment;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation;
+import org.eclipse.osbp.ecview.core.common.services.IUiKitBasedService;
+import org.eclipse.osbp.ecview.core.common.services.IWidgetAssocationsService;
+import org.eclipse.osbp.ecview.core.common.tooling.IWidgetMouseClickService;
+import org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler;
+import org.eclipse.osbp.ecview.core.util.emf.ModelUtil;
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.designer.api.IWidgetDesignConfigurator;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.DesignEvent;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.EventType;
+import org.eclipse.osbp.runtime.designer.api.IDesignerService.IDesignListener;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IConstants;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services.WidgetAssocationsService;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services.WidgetMouseClickService;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.event.MouseEvents.ClickEvent;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Component.Focusable;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This presenter is responsible to render a text field on the given layout.
+ */
+public class ViewPresentation extends AbstractDisposable implements
+ IViewPresentation<Component>, ILocaleChangedService.LocaleListener,
+ IDesignListener {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(ViewPresentation.class);
+
+ /** The model access. */
+ private ModelAccess modelAccess;
+
+ /** The editpart. */
+ private final IViewEditpart editpart;
+
+ /** The component base. */
+ private CssLayout componentBase;
+
+ /** The component. */
+ private GridLayout component;
+
+ /** The content. */
+ private IEmbeddableEditpart content;
+
+ /** The content component. */
+ private Component contentComponent;
+
+ /**
+ * Constructor.
+ *
+ * @param editpart
+ * The editpart for that presentation.
+ */
+ public ViewPresentation(IViewEditpart editpart) {
+ this.editpart = editpart;
+ this.modelAccess = new ModelAccess((YView) editpart.getModel());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getModel()
+ */
+ @Override
+ public Object getModel() {
+ return editpart.getModel();
+ }
+
+ /**
+ * Returns the editpart the presenter will render for.
+ *
+ * @return editpart
+ */
+ public IViewEditpart getEditpart() {
+ checkDisposed();
+ return editpart;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#render(java.util.Map)
+ */
+ @Override
+ public void render(Map<String, Object> options) {
+ checkDisposed();
+ this.content = editpart.getContent();
+ ComponentContainer parent = (ComponentContainer) editpart.getContext()
+ .getRootLayout();
+ createWidget(parent);
+ }
+
+ /**
+ * Is called to render the content.
+ */
+ protected void renderContent() {
+ if (!isRendered()) {
+ return;
+ }
+
+ component.removeAllComponents();
+
+ if (content != null) {
+ contentComponent = (Component) content.render(component);
+ component.addComponent(contentComponent);
+
+ applyAlignment(contentComponent,
+ modelAccess.yView.getContentAlignment());
+ } else {
+ LOGGER.warn("Content is null");
+ }
+
+ componentBase.setSizeFull();
+ component.setSizeFull();
+
+ // if (!isFillVertical(modelAccess.yView.getContentAlignment())) {
+ // int packingHelperRowIndex = component.getRows();
+ // component.setRows(packingHelperRowIndex + 1);
+ // component.setRowExpandRatio(packingHelperRowIndex, 1.0f);
+ // } else {
+ // componentBase.setHeight("100%");
+ // component.setHeight("100%");
+ // }
+ //
+ // if (!isFillHorizontal(modelAccess.yView.getContentAlignment())) {
+ // int packingHelperColumnIndex = component.getColumns();
+ // component.setColumns(packingHelperColumnIndex + 1);
+ // component.setColumnExpandRatio(packingHelperColumnIndex, 1.0f);
+ // } else {
+ // componentBase.setWidth("100%");
+ // component.setWidth("100%");
+ // }
+ }
+
+ // private boolean isFillVertical(YAlignment alignment) {
+ // switch (alignment) {
+ // case FILL_CENTER:
+ // case FILL_FILL:
+ // case FILL_LEFT:
+ // case FILL_RIGHT:
+ // return true;
+ // default:
+ // return false;
+ // }
+ // }
+ //
+ // private boolean isFillHorizontal(YAlignment contentAlignment) {
+ // switch (contentAlignment) {
+ // case MIDDLE_FILL:
+ // case FILL_FILL:
+ // case BOTTOM_FILL:
+ // case TOP_FILL:
+ // return true;
+ // default:
+ // return false;
+ // }
+ // }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Component createWidget(Object parent) {
+ if (componentBase == null) {
+ // create component base with grid layout to enable margins
+ //
+ componentBase = new CssLayout();
+ componentBase.setSizeFull();
+ componentBase.addStyleName(IConstants.CSS_CLASS_CONTROL_BASE);
+ componentBase.addStyleName(IConstants.CSS_CLASS_YVIEW_PROVIDER);
+
+ // register shared state
+ ISharedStateContext sharedState = getViewContext().getService(
+ ISharedStateContext.class.getName());
+ if (sharedState != null) {
+ Map<Object, Object> viewData = new HashMap<Object, Object>();
+ viewData.put(ISharedStateContext.class, sharedState);
+ componentBase.setData(viewData);
+ }
+
+ ComponentContainer parentContainer = (ComponentContainer) parent;
+ parentContainer.addComponent(componentBase);
+
+ // create the component
+ component = new GridLayout(1, 1);
+ component.addStyleName(IConstants.CSS_CLASS_CONTROL);
+ componentBase.addComponent(component);
+ component.setSizeFull();
+
+ if (modelAccess.isCssIdValid()) {
+ component.setId(modelAccess.getCssID());
+ } else {
+ component.setId(editpart.getId());
+ }
+
+ if (modelAccess.isCssClassValid()) {
+ component.addStyleName(modelAccess.getCssClass());
+ }
+
+ if (modelAccess.isMargin()) {
+ component.addStyleName(IConstants.CSS_CLASS_MARGIN);
+ }
+
+ setupDesignListener();
+
+ // render the content
+ //
+ renderContent();
+
+ // register as an locale change listener
+ IViewContext context = ModelUtil.getViewContext(modelAccess.yView);
+ ILocaleChangedService service = context
+ .getService(ILocaleChangedService.ID);
+ if (service != null) {
+ service.addLocaleListener(this);
+ }
+
+ }
+ return componentBase;
+ }
+
+ /**
+ * Setup a listener to observe design events.
+ */
+ protected void setupDesignListener() {
+ IDesignerService designService = getViewContext().getService(
+ IDesignerService.class.getName());
+ if (designService != null) {
+ designService.addListener((IDesignListener) this);
+
+ IWidgetDesignConfigurator cService = getViewContext().getService(
+ IWidgetDesignConfigurator.class.getName());
+ if (cService != null && getWidget() != null) {
+ cService.configure(getWidget(), (YView) getModel(),
+ designService.isDesignMode());
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getWidget()
+ */
+ @Override
+ public Component getWidget() {
+ return componentBase;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#isRendered()
+ */
+ @Override
+ public boolean isRendered() {
+ return componentBase != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getUIBindings()
+ */
+ @Override
+ public Set<Binding> getUIBindings() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void unrender() {
+ if (componentBase != null) {
+ // unregister as an locale change listener
+ IViewContext context = ModelUtil.getViewContext(modelAccess.yView);
+ ILocaleChangedService service = context
+ .getService(ILocaleChangedService.ID);
+ if (service != null) {
+ service.removeLocaleListener(this);
+ }
+ // unregister the design listener
+ IDesignerService designService = context
+ .getService(IDesignerService.class.getName());
+ if (designService != null) {
+ designService.removeListener((IDesignListener) this);
+
+ IWidgetDesignConfigurator cService = context
+ .getService(IWidgetDesignConfigurator.class.getName());
+ if (cService != null && getWidget() != null) {
+ cService.configure(getWidget(), (YView) getModel(), false);
+ }
+ }
+
+ ComponentContainer parent = ((ComponentContainer) componentBase
+ .getParent());
+ if (parent != null) {
+ parent.removeComponent(componentBase);
+ }
+ componentBase = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void internalDispose() {
+ if (componentBase != null) {
+ unrender();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#setContent(org.eclipse.osbp.ecview.core.common.editpart.IEmbeddableEditpart)
+ */
+ @Override
+ public void setContent(IEmbeddableEditpart editpart) {
+ this.content = editpart;
+ renderContent();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#requestFocus(org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart)
+ */
+ @Override
+ public void requestFocus(IElementEditpart toFocus) {
+ if (toFocus instanceof IEmbeddableEditpart) {
+ Component component = (Component) ((IEmbeddableEditpart) toFocus)
+ .getWidget();
+ if (component instanceof Focusable) {
+ ((Focusable) component).focus();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#getContent()
+ */
+ @Override
+ public IEmbeddableEditpart getContent() {
+ return content;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getViewContext()
+ */
+ @Override
+ public IViewContext getViewContext() {
+ return getEditpart().getContext();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#getObservableValue(java.lang.Object)
+ */
+ @Override
+ public IObservable getObservableValue(Object model) {
+ throw new UnsupportedOperationException("Must be overridden!");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#exec(java.lang.Runnable)
+ */
+ @Override
+ public void exec(Runnable runnable) {
+
+ UI ui = componentBase.getUI();
+ if (ui == null) {
+ ui = UI.getCurrent();
+ }
+
+ if (ui == null) {
+ throw new IllegalStateException(
+ "The view is not attached to the UI nor are we running in a proper vaadin session thread!");
+ }
+
+ VaadinObservables.activateRealm(ui);
+ ui.accessSynchronously(runnable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#execAsync(java.lang.Runnable)
+ */
+ @Override
+ public Future<?> execAsync(Runnable runnable) {
+ UI ui = componentBase.getUI();
+ if (ui == null) {
+ ui = UI.getCurrent();
+ }
+
+ if (ui == null) {
+ throw new IllegalStateException(
+ "The view is not attached to the UI nor are we running in a proper vaadin session thread!");
+ }
+ return ui.access(runnable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.IVisibilityProcessable#apply(org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler)
+ */
+ @Override
+ public void apply(IVisibilityHandler handler) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#updateContentAlignment()
+ */
+ public void updateContentAlignment() {
+ applyAlignment(contentComponent,
+ modelAccess.yView.getContentAlignment());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#updateSpacings()
+ */
+ @Override
+ public void updateSpacings() {
+ if (component != null) {
+ component.setMargin(modelAccess.yView.isMargin());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.editpart.visibility.IVisibilityProcessable#resetVisibilityProperties()
+ */
+ @Override
+ public void resetVisibilityProperties() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IWidgetPresentation#notifyDatatypeChanged(org.eclipse.osbp.ecview.core.common.editpart.datatypes.IDatatypeEditpart.DatatypeChangeEvent)
+ */
+ @Override
+ public void notifyDatatypeChanged(DatatypeChangeEvent event) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.context.ILocaleChangedService.LocaleListener#localeChanged(java.util.Locale)
+ */
+ @Override
+ public void localeChanged(Locale locale) {
+ // pass the locale to the root element
+ component.setLocale(locale);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#createService(java.lang.Class)
+ */
+ @SuppressWarnings({ "unchecked" })
+ @Override
+ public <A extends IUiKitBasedService> A createService(Class<A> serviceClass) {
+ if (serviceClass == IWidgetMouseClickService.class) {
+ final WidgetMouseClickService service = new WidgetMouseClickService(
+ getViewContext());
+ service.activate();
+ return (A) service;
+ } else if (serviceClass == IWidgetAssocationsService.class) {
+ WidgetAssocationsService service = new WidgetAssocationsService();
+ return (A) service;
+ }
+
+ throw new IllegalArgumentException(String.format(
+ "%s is not a supported service.", serviceClass.getName()));
+ }
+
+ /**
+ * Click.
+ *
+ * @param event
+ * the event
+ */
+ public void click(ClickEvent event) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#openDialog(org.eclipse.osbp.ecview.core.common.editpart.IDialogEditpart, org.eclipse.osbp.ecview.core.common.editpart.binding.IBindableEndpointEditpart)
+ */
+ @Override
+ public void openDialog(IDialogEditpart dialogEditpart,
+ IBindableEndpointEditpart inputData) {
+ if (!isRendered()) {
+ return;
+ }
+
+ // VaadinObservables.activateRealm(navigationView.getUI());
+ // set the input data to the child nav page
+ dialogEditpart.setInputDataBindingEndpoint(inputData);
+ Window dialog = (Window) dialogEditpart.render(null);
+ componentBase.getUI().addWindow(dialog);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.presentation.IViewPresentation#closeDialog(org.eclipse.osbp.ecview.core.common.editpart.IDialogEditpart)
+ */
+ @Override
+ public void closeDialog(IDialogEditpart dialogEditpart) {
+ if (!isRendered()) {
+ return;
+ }
+
+ Window dialog = (Window) dialogEditpart.getWidget();
+ if (dialog != null) {
+ componentBase.getUI().removeWindow(dialog);
+ dialogEditpart.unrender();
+ }
+ }
+
+ /**
+ * Sets the alignment to the component.
+ *
+ * @param child
+ * the child
+ * @param yAlignment
+ * the y alignment
+ */
+ protected void applyAlignment(Component child, YAlignment yAlignment) {
+ if (child == null) {
+ return;
+ }
+
+ if (yAlignment != null) {
+ child.setSizeUndefined();
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ component.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
+ break;
+ case BOTTOM_FILL:
+ component.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
+ child.setWidth("100%");
+ break;
+ case BOTTOM_LEFT:
+ component.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
+ break;
+ case BOTTOM_RIGHT:
+ component.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
+ break;
+ case MIDDLE_CENTER:
+ component.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
+ break;
+ case MIDDLE_FILL:
+ component.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
+ child.setWidth("100%");
+ break;
+ case MIDDLE_LEFT:
+ component.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
+ break;
+ case MIDDLE_RIGHT:
+ component.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
+ break;
+ case TOP_CENTER:
+ component.setComponentAlignment(child, Alignment.TOP_CENTER);
+ break;
+ case TOP_FILL:
+ component.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setWidth("100%");
+ break;
+ case TOP_LEFT:
+ component.setComponentAlignment(child, Alignment.TOP_LEFT);
+ break;
+ case TOP_RIGHT:
+ component.setComponentAlignment(child, Alignment.TOP_RIGHT);
+ break;
+ case FILL_CENTER:
+ component.setComponentAlignment(child, Alignment.TOP_CENTER);
+ child.setHeight("100%");
+ break;
+ case FILL_FILL:
+ component.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setSizeFull();
+ break;
+ case FILL_LEFT:
+ component.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setHeight("100%");
+ break;
+ case FILL_RIGHT:
+ component.setComponentAlignment(child, Alignment.TOP_RIGHT);
+ child.setHeight("100%");
+ break;
+ default:
+ break;
+ }
+ } else {
+ component.setComponentAlignment(child, Alignment.TOP_LEFT);
+ child.setSizeFull();
+ }
+ }
+
+ /**
+ * Maps the vertical part of the alignment to FILL.
+ *
+ * @param yAlignment
+ * the alignment
+ * @return alignment the mapped alignment
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ protected YAlignment mapToVerticalFill(YAlignment yAlignment) {
+ // END SUPRESS CATCH EXCEPTION
+ if (yAlignment != null) {
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ case MIDDLE_CENTER:
+ case TOP_CENTER:
+ return YAlignment.FILL_CENTER;
+ case BOTTOM_FILL:
+ case MIDDLE_FILL:
+ case TOP_FILL:
+ return YAlignment.FILL_FILL;
+ case BOTTOM_LEFT:
+ case MIDDLE_LEFT:
+ case TOP_LEFT:
+ return YAlignment.FILL_LEFT;
+ case BOTTOM_RIGHT:
+ case MIDDLE_RIGHT:
+ case TOP_RIGHT:
+ return YAlignment.FILL_RIGHT;
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ case FILL_CENTER:
+ return YAlignment.FILL_FILL;
+ default:
+ break;
+ }
+ }
+ return YAlignment.FILL_FILL;
+ }
+
+ /**
+ * Maps the horizontal part of the alignment to FILL.
+ *
+ * @param yAlignment
+ * the alignment
+ * @return alignment the mapped alignment
+ */
+ // BEGIN SUPRESS CATCH EXCEPTION
+ protected YAlignment mapToHorizontalFill(YAlignment yAlignment) {
+ // END SUPRESS CATCH EXCEPTION
+ if (yAlignment != null) {
+ switch (yAlignment) {
+ case BOTTOM_CENTER:
+ case BOTTOM_FILL:
+ case BOTTOM_LEFT:
+ case BOTTOM_RIGHT:
+ return YAlignment.BOTTOM_FILL;
+ case MIDDLE_CENTER:
+ case MIDDLE_FILL:
+ case MIDDLE_LEFT:
+ case MIDDLE_RIGHT:
+ return YAlignment.MIDDLE_FILL;
+ case TOP_CENTER:
+ case TOP_FILL:
+ case TOP_LEFT:
+ case TOP_RIGHT:
+ return YAlignment.TOP_FILL;
+ case FILL_FILL:
+ case FILL_LEFT:
+ case FILL_RIGHT:
+ case FILL_CENTER:
+ return YAlignment.FILL_FILL;
+ default:
+ break;
+ }
+ }
+ return YAlignment.FILL_FILL;
+ }
+
+ /**
+ * Must be called by subclasses.
+ *
+ * @param event
+ * the event
+ */
+ public void notify(DesignEvent event) {
+ configureForDesignMode(event);
+ }
+
+ /**
+ * Configure / deconfigure the widget for the design mode.
+ *
+ * @param event
+ * the event
+ */
+ protected void configureForDesignMode(DesignEvent event) {
+ IWidgetDesignConfigurator service = getViewContext().getService(
+ IWidgetDesignConfigurator.class.getName());
+ if (service != null && getWidget() != null) {
+ service.configure(getWidget(), (YView) getModel(),
+ event.getType() == EventType.ENABLED);
+ }
+ }
+
+ /**
+ * An internal helper class.
+ */
+ private static class ModelAccess {
+
+ /** The y view. */
+ private final YView yView;
+
+ /**
+ * Instantiates a new model access.
+ *
+ * @param yView
+ * the y view
+ */
+ public ModelAccess(YView yView) {
+ super();
+ this.yView = yView;
+ }
+
+ /**
+ * Gets the css class.
+ *
+ * @return the css class
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssClass()
+ */
+ public String getCssClass() {
+ return yView.getCssClass();
+ }
+
+ /**
+ * Returns true, if the css class is not null and not empty.
+ *
+ * @return true, if is css class valid
+ */
+ public boolean isCssClassValid() {
+ return getCssClass() != null && !getCssClass().equals("");
+ }
+
+ /**
+ * Gets the css id.
+ *
+ * @return the css id
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.core.YCssAble#getCssID()
+ */
+ public String getCssID() {
+ return yView.getCssID();
+ }
+
+ /**
+ * Returns true, if the css id is not null and not empty.
+ *
+ * @return true, if is css id valid
+ */
+ public boolean isCssIdValid() {
+ return getCssID() != null && !getCssID().equals("");
+ }
+
+ /**
+ * Checks if is margin.
+ *
+ * @return true, if is margin
+ * @see org.eclipse.osbp.ecview.core.ui.core.model.extension.YGridLayout#isMargin()
+ */
+ public boolean isMargin() {
+ return yView.isMargin();
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManager.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManager.java
new file mode 100644
index 0000000..e2f37d5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManager.java
@@ -0,0 +1,206 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateListStrategy;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeansObservables;
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.databinding.EMFObservables;
+import org.eclipse.emf.databinding.EMFUpdateListStrategy;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
+import org.eclipse.osbp.ecview.core.common.model.core.YEditable;
+import org.eclipse.osbp.ecview.core.common.model.core.YEnable;
+import org.eclipse.osbp.ecview.core.common.model.core.YVisibleable;
+import org.eclipse.osbp.ecview.core.databinding.emf.common.ECViewDatabindingContext;
+import org.eclipse.osbp.ecview.core.databinding.emf.common.ECViewUpdateValueStrategy;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
+
+import com.vaadin.data.Property;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Is used to bind values.
+ */
+public class BindingManager extends
+ org.eclipse.osbp.ecview.core.common.binding.AbstractBindingManager
+ implements IBindingManager {
+
+ /**
+ * Instantiates a new binding manager.
+ *
+ * @param viewContext
+ * the view context
+ * @param validationRealm
+ * the validation realm
+ */
+ public BindingManager(IViewContext viewContext, Realm validationRealm) {
+ super(validationRealm);
+ }
+
+ /**
+ * Casts element to EObject.
+ *
+ * @param element
+ * the element
+ * @return the e object
+ */
+ protected EObject castEObject(Object element) {
+ return (EObject) element;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.binding.AbstractBindingManager#createDatabindingContext(org.eclipse.core.databinding.observable.Realm)
+ */
+ @Override
+ protected DataBindingContext createDatabindingContext(Realm validationRealm) {
+ return new ECViewDatabindingContext(validationRealm);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.binding.AbstractBindingManager#bindValue(org.eclipse.core.databinding.observable.value.IObservableValue, org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ @Override
+ public Binding bindValue(IObservableValue target, IObservableValue model) {
+ return bindValue(
+ target,
+ model,
+ new ECViewUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE),
+ new ECViewUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.binding.AbstractBindingManager#bindList(org.eclipse.core.databinding.observable.list.IObservableList, org.eclipse.core.databinding.observable.list.IObservableList)
+ */
+ @Override
+ public Binding bindList(IObservableList target, IObservableList model) {
+ return getDatabindingContext().bindList(target, model,
+ new EMFUpdateListStrategy(UpdateListStrategy.POLICY_UPDATE),
+ new EMFUpdateListStrategy(UpdateListStrategy.POLICY_UPDATE));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager#bindVisible(org.eclipse.osbp.ecview.core.common.model.core.YVisibleable, com.vaadin.ui.AbstractComponent)
+ */
+ @Override
+ public Binding bindVisible(YVisibleable yVisibleAble,
+ AbstractComponent abstractComponent) {
+ IVaadinObservableValue uiObservable = VaadinObservables
+ .observeVisible(abstractComponent);
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ castEObject(yVisibleAble),
+ CoreModelPackage.eINSTANCE.getYVisibleable_Visible());
+ return getDatabindingContext().bindValue(uiObservable, modelObservable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager#bindEnabled(org.eclipse.osbp.ecview.core.common.model.core.YEnable, com.vaadin.ui.AbstractComponent)
+ */
+ @Override
+ public Binding bindEnabled(YEnable yEnable,
+ AbstractComponent abstractComponent) {
+ IVaadinObservableValue uiObservable = VaadinObservables
+ .observeEnabled(abstractComponent);
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ castEObject(yEnable),
+ CoreModelPackage.eINSTANCE.getYEnable_Enabled());
+ return getDatabindingContext().bindValue(uiObservable, modelObservable);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager#bindReadonly(org.eclipse.osbp.ecview.core.common.model.core.YEditable, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier)
+ */
+ @Override
+ public Binding bindReadonly(YEditable yEditable,
+ Property.ReadOnlyStatusChangeNotifier field) {
+ IVaadinObservableValue uiObservable = VaadinObservables
+ .observeReadonly(field);
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ castEObject(yEditable),
+ CoreModelPackage.eINSTANCE.getYEditable_Editable());
+ return getDatabindingContext()
+ .bindValue(
+ uiObservable,
+ modelObservable,
+ new ECViewUpdateValueStrategy(
+ UpdateValueStrategy.POLICY_UPDATE)
+ .setConverter(new BoolNegator()),
+ new ECViewUpdateValueStrategy(
+ UpdateValueStrategy.POLICY_UPDATE)
+ .setConverter(new BoolNegator()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.IBindingManager#bindReadonlyOneway(org.eclipse.osbp.ecview.core.common.model.core.YEditable, com.vaadin.ui.Component)
+ */
+ @Override
+ public Binding bindReadonlyOneway(YEditable yEditable, Component field) {
+ IObservableValue uiObservable = BeansObservables.observeValue(field,
+ "readOnly");
+ IObservableValue modelObservable = EMFObservables.observeValue(
+ castEObject(yEditable),
+ CoreModelPackage.eINSTANCE.getYEditable_Editable());
+ return getDatabindingContext()
+ .bindValue(
+ uiObservable,
+ modelObservable,
+ new ECViewUpdateValueStrategy(
+ UpdateValueStrategy.POLICY_NEVER)
+ .setConverter(new BoolNegator()),
+ new ECViewUpdateValueStrategy(
+ UpdateValueStrategy.POLICY_UPDATE)
+ .setConverter(new BoolNegator()));
+
+ }
+
+ /**
+ * Negates booleans.
+ */
+ private static class BoolNegator implements IConverter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.conversion.IConverter#getFromType()
+ */
+ @Override
+ public Object getFromType() {
+ return Boolean.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.conversion.IConverter#getToType()
+ */
+ @Override
+ public Object getToType() {
+ return Boolean.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
+ */
+ @Override
+ public Object convert(Object fromObject) {
+ return !((Boolean) fromObject);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java
new file mode 100644
index 0000000..a79a04b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/binding/BindingManagerProvider.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.binding;
+
+import org.eclipse.osbp.ecview.core.common.context.IContext;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.services.IServiceProvider;
+import org.eclipse.osbp.runtime.common.dispose.IDisposable;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BindingManagerProvider.
+ */
+public class BindingManagerProvider implements IServiceProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.services.IServiceProvider#isFor(java.lang.String, org.eclipse.osbp.ecview.core.common.context.IContext)
+ */
+ @Override
+ public boolean isFor(String selector, IContext context) {
+ if (context instanceof IViewContext) {
+ if (!org.eclipse.osbp.ecview.core.common.binding.IECViewBindingManager.class
+ .getName().equals(selector)) {
+ return false;
+ }
+ IViewContext viewContext = (IViewContext) context;
+ if (!VaadinRenderer.UI_KIT_URI.equals(viewContext
+ .getPresentationURI())) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ecview.core.common.services.IServiceProvider#createService(java.lang.String, org.eclipse.osbp.ecview.core.common.context.IContext)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public <A> A createService(String selector, IContext context) {
+ IViewContext viewContext = (IViewContext) context;
+ final BindingManager bindingManager = new BindingManager(viewContext,
+ VaadinObservables.getRealm(VaadinObservables
+ .getUI((Component) viewContext.getRootLayout())));
+ viewContext.addDisposeListener(new IDisposable.Listener() {
+ @Override
+ public void notifyDisposed(IDisposable notifier) {
+ bindingManager.dispose();
+ }
+ });
+ return (A) bindingManager;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumConverter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumConverter.java
new file mode 100644
index 0000000..4e86d74
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumConverter.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data;
+
+import java.util.Locale;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.converter.Converter;
+
+/**
+ * This converter is used to support enums in vaadin combobox, optionsgroup,...
+ */
+// TODO add generics
+@SuppressWarnings("serial")
+public class EnumConverter implements Converter {
+
+ private Class<Enum<?>> type;
+ private Container datasource;
+
+ public EnumConverter(Class<Enum<?>> type, Container datasource) {
+ this.type = type;
+ this.datasource = datasource;
+ }
+
+ @Override
+ public Class<Enum<?>> getModelType() {
+ return type;
+ }
+
+ @Override
+ public Class<EnumOptionBean> getPresentationType() {
+ return EnumOptionBean.class;
+ }
+
+ @Override
+ public Object convertToModel(Object value, Class targetType, Locale locale)
+ throws ConversionException {
+ if(value == null){
+ return null;
+ }
+ EnumOptionBean casted = (EnumOptionBean) value;
+ return casted.getEnumx();
+ }
+
+ @Override
+ public Object convertToPresentation(Object value, Class targetType,
+ Locale locale) throws ConversionException {
+ if(value == null){
+ return null;
+ }
+ Enum<?> casted = (Enum<?>) value;
+ for (Object itemId : datasource.getItemIds()) {
+ EnumOptionBean castedId = (EnumOptionBean) itemId;
+ if (castedId.getEnumx() == casted) {
+ return castedId;
+ }
+ }
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java
new file mode 100644
index 0000000..66b1b1f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBean.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data;
+
+public class EnumOptionBean {
+
+ private final Enum<?> enumx;
+ private final String description;
+ private final String imagePath;
+
+ public EnumOptionBean(Enum<?> enumx, String description, String imagePath) {
+ super();
+ this.enumx = enumx;
+ this.description = description;
+ this.imagePath = imagePath;
+ }
+
+ /**
+ * @return the enumx
+ */
+ public Enum<?> getEnumx() {
+ return enumx;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return the imagePath
+ */
+ public String getImagePath() {
+ return imagePath;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java
new file mode 100644
index 0000000..69b2ac5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumOptionBeanHelper.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.common.i18n.I18nUtil;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class EnumOptionBeanHelper.
+ */
+public class EnumOptionBeanHelper {
+
+ /**
+ * Creates a list of enum options for the given enum. The services are used for internationalization und to find a proper image for the enum literal. Services and locale may be
+ * <code>null</code>.
+ *
+ * @param enumClass
+ * the enum class
+ * @param i18nService
+ * the i18n service
+ * @param locale
+ * the locale
+ * @return the beans
+ */
+ public static List<EnumOptionBean> getBeans(Class<? extends Enum<?>> enumClass, II18nService i18nService, Locale locale) {
+
+ // String enumName = enumClass.getCanonicalName();
+ String enumName = enumClass.getSimpleName();
+
+ List<EnumOptionBean> result = new ArrayList<EnumOptionBean>();
+ for (Enum<?> literal : enumClass.getEnumConstants()) {
+ String description = literal.name();
+ if (i18nService != null) {
+ // String temp = i18nService.getValue(I18nUtil.getI18nKey(enumName, literal), locale);
+ String temp = i18nService.getValue(literal.name(), locale);
+ if (temp != null && !temp.equals("")) {
+ description = temp;
+ }
+ }
+
+ String imagePath = null;
+ if (i18nService != null) {
+ // imagePath = i18nService.getValue(I18nUtil.getImageI18nKey(enumName, literal), locale);
+ imagePath = I18nUtil.getImageI18nKey(enumName, literal);
+ }
+
+ result.add(new EnumOptionBean(literal, description, imagePath));
+ }
+
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumSetConverter.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumSetConverter.java
new file mode 100644
index 0000000..7cd1b22
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/data/EnumSetConverter.java
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.data;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.converter.Converter;
+
+/**
+ * This converter is used to support enums in vaadin combobox, optionsgroup,...
+ */
+// TODO add generics
+@SuppressWarnings("serial")
+public class EnumSetConverter implements Converter {
+
+ private Container datasource;
+
+ public EnumSetConverter(Class<Enum<?>> type, Container datasource) {
+ this.datasource = datasource;
+ }
+
+ @Override
+ public Class<?> getModelType() {
+ return Set.class;
+ }
+
+ @Override
+ public Class<?> getPresentationType() {
+ return Set.class;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Object convertToModel(Object value, Class targetType, Locale locale)
+ throws ConversionException {
+ if (value == null) {
+ return null;
+ }
+
+ Set<EnumOptionBean> values = (Set<EnumOptionBean>) value;
+ if (values.size() == 0) {
+ return Collections.emptySet();
+ }
+
+ Set result = new HashSet();
+ for (EnumOptionBean casted : values) {
+ result.add(casted.getEnumx());
+ }
+ return result;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public Object convertToPresentation(Object value, Class targetType,
+ Locale locale) throws ConversionException {
+ if (value == null) {
+ return null;
+ }
+
+ Set<Enum<?>> values = (Set<Enum<?>>) value;
+ if (values.size() == 0) {
+ return Collections.emptySet();
+ }
+
+ Set<EnumOptionBean> result = new HashSet<EnumOptionBean>();
+ for (Enum<?> casted : values) {
+ for (Object itemId : datasource.getItemIds()) {
+ EnumOptionBean castedId = (EnumOptionBean) itemId;
+ if (castedId.getEnumx() == casted) {
+ result.add(castedId);
+ }
+ }
+ }
+
+ return result;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java
new file mode 100644
index 0000000..516bfc6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetAssocationsService.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services;
+
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.editpart.IElementEditpart;
+import org.eclipse.osbp.ecview.core.common.editpart.emf.ElementEditpart;
+import org.eclipse.osbp.ecview.core.common.model.core.YElement;
+import org.eclipse.osbp.ecview.core.common.services.AbstractWidgetAssocationsService;
+
+import com.vaadin.ui.Component;
+
+public class WidgetAssocationsService extends
+ AbstractWidgetAssocationsService<Component, YElement> {
+
+ @Override
+ public YElement getModelElement(String id) {
+ synchronized (associations) {
+ for (Map.Entry<Component, YElement> entry : associations.entrySet()) {
+ YElement yElement = entry.getValue();
+ if (yElement.getId() != null && yElement.getId().equals(id)) {
+ return yElement;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IElementEditpart getEditpart(String id) {
+ YElement yElement = getModelElement(id);
+ return yElement != null ? ElementEditpart.findEditPartFor(yElement) : null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetMouseClickService.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetMouseClickService.java
new file mode 100644
index 0000000..31c5d96
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/services/WidgetMouseClickService.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.services;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.services.IWidgetAssocationsService;
+import org.eclipse.osbp.ecview.core.common.tooling.IWidgetMouseClickService;
+import org.eclipse.osbp.runtime.common.event.IEventBroker;
+
+import com.vaadin.event.LayoutEvents;
+import com.vaadin.event.LayoutEvents.LayoutClickEvent;
+import com.vaadin.event.LayoutEvents.LayoutClickListener;
+import com.vaadin.event.LayoutEvents.LayoutClickNotifier;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Panel;
+
+@SuppressWarnings("serial")
+public class WidgetMouseClickService implements IWidgetMouseClickService,
+ LayoutClickListener {
+
+ private Set<Listener> listeners = Collections
+ .synchronizedSet(new HashSet<IWidgetMouseClickService.Listener>());
+ private IWidgetAssocationsService<Component, YEmbeddable> associations;
+ private IViewContext context;
+ private LayoutClickNotifier widget;
+ private IEventBroker eventBroker;
+
+ public WidgetMouseClickService(IViewContext context) {
+ this.context = context;
+ this.associations = context.getService(IWidgetAssocationsService.ID);
+ this.eventBroker = context.getService(IEventBroker.class.getName());
+ }
+
+ @Override
+ public void addListener(Listener listener) {
+ listeners.add(listener);
+ }
+
+ @Override
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ @Override
+ public void activate() {
+ Panel panel = (Panel) context.getViewEditpart().getPresentation()
+ .getWidget();
+ widget = (LayoutEvents.LayoutClickNotifier) panel.getContent();
+ widget.addLayoutClickListener(this);
+ }
+
+ @Override
+ public void dactivate() {
+ if (widget != null) {
+ widget.removeLayoutClickListener(this);
+ widget = null;
+ }
+ }
+
+ @Override
+ public void layoutClick(LayoutClickEvent event) {
+ synchronized (listeners) {
+ Object model = associations.getModelElement(event
+ .getClickedComponent());
+
+ for (Listener listener : listeners) {
+ listener.clicked(model);
+ }
+
+ if (eventBroker != null) {
+ Map<String, Object> data = new HashMap<String, Object>();
+ data.put(PROP_MODEL_ELEMENT, model);
+ data.put(PROP_WIDGET, event.getChildComponent());
+ eventBroker.send(IWidgetMouseClickService.EVENT_TOPIC, data);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java
new file mode 100644
index 0000000..ded2ef2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/internal/util/Util.java
@@ -0,0 +1,308 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.internal.util;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.visibility.VisibilityFactory;
+import org.eclipse.osbp.ecview.core.common.model.visibility.YColor;
+import org.eclipse.osbp.ecview.core.common.model.visibility.YVisibilityProperties;
+import org.eclipse.osbp.ecview.core.common.visibility.Color;
+import org.eclipse.osbp.ecview.core.common.visibility.IVisibilityHandler;
+import org.eclipse.osbp.runtime.common.i18n.I18nUtil;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.common.validation.IStatus;
+import org.eclipse.osbp.runtime.common.validation.IStatus.Severity;
+import org.eclipse.osbp.runtime.common.validation.Status;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+
+import com.vaadin.server.ErrorMessage;
+import com.vaadin.server.ErrorMessage.ErrorLevel;
+import com.vaadin.server.Resource;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Util.
+ */
+public class Util {
+
+ /**
+ * Maps the handler properties to the eObject.
+ *
+ * @param handler
+ * the handler
+ * @return the y visibility properties
+ */
+ public static YVisibilityProperties mapYProperties(
+ IVisibilityHandler handler) {
+ YVisibilityProperties yProps = VisibilityFactory.eINSTANCE
+ .createYVisibilityProperties();
+ yProps.setBackgroundColor(mapYColor(handler.getBackgroundColor()));
+ yProps.setBackgroundColorCode(handler.getBackgroundColorCode());
+ yProps.setBold(handler.isBold());
+ yProps.setBorder(handler.isBorder());
+ yProps.setEditable(handler.isEditable());
+ yProps.setEnabled(handler.isEnabled());
+ yProps.setForegroundColor(mapYColor(handler.getForegroundColor()));
+ yProps.setForegroundColorCode(handler.getForegroundColorCode());
+ yProps.setItalic(handler.isItalic());
+ yProps.setStrikethrough(handler.isStrikethrough());
+ yProps.setUnderline(handler.isUnderline());
+ yProps.setVisible(handler.isVisible());
+ yProps.setCssClass(handler.getCssClass());
+ yProps.setCssId(handler.getCssId());
+
+ return yProps;
+ }
+
+ /**
+ * Maps the handler color to the eObject.
+ *
+ * @param color
+ * the color
+ * @return the y color
+ */
+ public static YColor mapYColor(Color color) {
+ if (color == null) {
+ return YColor.UNDEFINED;
+ }
+ switch (color) {
+ case RED:
+ return YColor.RED;
+ case BLACK:
+ return YColor.BLACK;
+ case BLUE:
+ return YColor.BLUE;
+ case GREEN:
+ return YColor.GREEN;
+ case WHITE:
+ return YColor.WHITE;
+ case DARK_GRAY:
+ return YColor.DARK_GRAY;
+ case LIGHT_GRAY:
+ return YColor.LIGHT_GRAY;
+ case UNDEFINED:
+ return YColor.UNDEFINED;
+ case YELLOW:
+ return YColor.YELLOW;
+ default:
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ * Apply captions.
+ *
+ * @param service
+ * the service
+ * @param label
+ * the label
+ * @param i18nLabelKey
+ * the i18n label key
+ * @param locale
+ * the locale
+ * @param component
+ * the component
+ */
+ public static void applyCaptions(II18nService service, String label,
+ String i18nLabelKey, Locale locale, Component component) {
+ if(component != null) {
+ if (service != null && isValid(i18nLabelKey)) {
+ String translation = service.getValue(i18nLabelKey, locale);
+ if (translation == null || translation.equals("") || !i18nLabelKey.equals(label)) {
+ // caption must be set in all cases - even if it is null, else icon-only mode will not work
+ // if already set by other process then do not translate
+ component.setCaption(label);
+ } else {
+ component.setCaption(translation);
+ }
+
+ } else {
+ // caption must be set in all cases - even if it is null, else icon-only mode will not work
+ component.setCaption(label);
+ }
+ }
+ }
+
+ /**
+ * Gets the caption.
+ *
+ * @param service
+ * the service
+ * @param label
+ * the label
+ * @param i18nLabelKey
+ * the i18n label key
+ * @param locale
+ * the locale
+ * @return the caption
+ */
+ public static String getCaption(II18nService service, String label,
+ String i18nLabelKey, Locale locale) {
+
+ String result = i18nLabelKey;
+
+ if (service != null && isValid(i18nLabelKey)) {
+ String translation = service.getValue(i18nLabelKey, locale);
+ if (translation == null || translation.equals("")) {
+ if (isValid(label)) {
+ result = label;
+ }
+ } else {
+ result = translation;
+ }
+
+ } else {
+ if (isValid(label)) {
+ result = label;
+ }
+ }
+ return result != null ? result : "";
+ }
+
+ /**
+ * Apply caption icons.
+ *
+ * @param service
+ * the service
+ * @param provider
+ * the provider
+ * @param i18nLabelKey
+ * the i18n label key
+ * @param locale
+ * the locale
+ * @param component
+ * the component
+ */
+ public static void applyCaptionIcons(II18nService service,
+ IResourceProvider provider, String i18nLabelKey, Locale locale,
+ Component component) {
+ String iconKey = I18nUtil.getImageKey(i18nLabelKey);
+
+ if (service != null && provider != null && isValid(iconKey)) {
+ String iconResourcePath = service.getValue(iconKey, locale);
+ if (iconResourcePath != null && !iconResourcePath.equals("")) {
+ component.setIcon(provider.getResource(iconResourcePath));
+ }
+ }
+ }
+
+ /**
+ * Apply caption icons.
+ *
+ * @param service
+ * the service
+ * @param provider
+ * the provider
+ * @param i18nLabelKey
+ * the i18n label key
+ * @param locale
+ * the locale
+ * @param callback
+ * the callback
+ */
+ public static void applyCaptionIcons(II18nService service,
+ IResourceProvider provider, String i18nLabelKey, Locale locale,
+ ResourceCallback callback) {
+ String iconKey = I18nUtil.getImageKey(i18nLabelKey);
+
+ if (service != null && provider != null && isValid(iconKey)) {
+ String iconResourcePath = service.getValue(iconKey, locale);
+ if (iconResourcePath != null && !iconResourcePath.equals("")) {
+ callback.setIcon(provider.getResource(iconResourcePath));
+ }
+ }
+ }
+
+ /**
+ * Checks if is valid.
+ *
+ * @param value
+ * the value
+ * @return true, if is valid
+ */
+ private static boolean isValid(String value) {
+ return value != null && !value.equals("");
+ }
+
+ /**
+ * Creates a collection of status for the given InvalidValueException.
+ *
+ * @param yElement
+ * the y element
+ * @param message
+ * the message
+ * @return the list
+ */
+ public static List<org.eclipse.osbp.runtime.common.validation.IStatus> createStatus(
+ YEmbeddable yElement, ErrorMessage message) {
+ if (message == null) {
+ return Collections.emptyList();
+ }
+
+ String text = message.getFormattedHtmlMessage();
+ IStatus status = Status.createStatus("", Util.class,
+ mapSeverity(message.getErrorLevel()), text);
+ status.putProperty(IStatus.PROP_FIELD_ID, yElement.getId());
+ status.putProperty(IStatus.PROP_FIELD_I18N_KEY,
+ yElement.getLabelI18nKey());
+ status.putProperty(IStatus.PROP_CREATOR,
+ "Presentation of " + yElement.getId());
+
+ return Collections.singletonList(status);
+ }
+
+ /**
+ * Map severity.
+ *
+ * @param level
+ * the level
+ * @return the severity
+ */
+ private static Severity mapSeverity(ErrorLevel level) {
+ switch (level) {
+ case INFORMATION:
+ return IStatus.Severity.INFO;
+ case WARNING:
+ return IStatus.Severity.WARNING;
+ case ERROR:
+ return IStatus.Severity.ERROR;
+ case CRITICAL:
+ return IStatus.Severity.CRITICAL;
+ case SYSTEMERROR:
+ return IStatus.Severity.SYSTEMERROR;
+ }
+ return IStatus.Severity.ERROR;
+ }
+
+ /**
+ * Callback to set resources.
+ */
+ public interface ResourceCallback {
+
+ /**
+ * Sets the icon.
+ *
+ * @param resource
+ * the new icon
+ */
+ void setIcon(Resource resource);
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/validator/ExternalStatusAwareValidator.java b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/validator/ExternalStatusAwareValidator.java
new file mode 100644
index 0000000..97b913a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.presentation.vaadin/src/org/eclipse/osbp/runtime/web/ecview/presentation/vaadin/validator/ExternalStatusAwareValidator.java
@@ -0,0 +1,127 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+ package org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.validator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.osbp.ecview.core.common.validation.IValidator;
+import org.eclipse.osbp.runtime.common.dispose.AbstractDisposable;
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.common.validation.IStatus;
+
+/**
+ * This class is responsible, to add Status instances that have been created by
+ * external validation services to the field.<br>
+ * The cached status will become reset, if the value changes.
+ */
+public class ExternalStatusAwareValidator extends AbstractDisposable implements
+ IValidator {
+
+ private List<IStatus> statusList;
+ private Object value;
+
+ private boolean initialized;
+
+ public void addStatus(IStatus status) {
+ // only add errors
+ if (!status.isError()) {
+ return;
+ }
+
+ if (statusList == null) {
+ statusList = new ArrayList<IStatus>();
+ }
+
+ if (!statusList.contains(status)) {
+ statusList.add(status);
+ }
+ }
+
+ public void removeStatus(IStatus status) {
+ if (statusList != null) {
+ statusList.remove(status);
+ }
+ }
+
+ public void reset() {
+ if (statusList != null) {
+ statusList.clear();
+ }
+ }
+
+ @Override
+ public void updateParameter(Object model) {
+ // nothing to do
+ }
+
+ @Override
+ public IStatus validateValue(Object value) {
+ Object oldValue = this.value;
+ this.value = value;
+
+ if (initialized) {
+ // if value changed, then clear the cached status
+ if (oldValue == null && this.value != null || oldValue != null
+ && this.value == null) {
+ statusList.clear();
+ } else if (oldValue == null && this.value == null) {
+ // nothing to do
+ } else if (oldValue != null && !oldValue.equals(this.value)) {
+ statusList.clear();
+ }
+ }
+ initialized = true;
+
+ return statusList != null && statusList.size() > 0 ? statusList.get(0)
+ : IStatus.OK;
+ }
+
+ @Override
+ public boolean isCheckValidType() {
+ return false;
+ }
+
+ @Override
+ public Class<?> getType() {
+ return Class.class;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+
+ }
+
+ @Override
+ public void setI18nService(II18nService i18nService) {
+
+ }
+
+ @Override
+ protected void internalDispose() {
+ statusList.clear();
+ statusList = null;
+ }
+
+ @Override
+ public Set<IStatus> getCurrentStatus() {
+ return statusList != null ? new HashSet<IStatus>(statusList)
+ : Collections.<IStatus> emptySet();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project
new file mode 100644
index 0000000..d2ef580
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.ecview.services.vaadin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/LICENSE.txt b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..edd1d02
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/META-INF/MANIFEST.MF
@@ -0,0 +1,41 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.ecview.services.vaadin
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.ecview.services.vaadin
+Bundle-Version: 0.9.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: org.eclipse.osbp.runtime.web.ecview.services.vaadin;
+ org.eclipse.osbp.ecview.core.common.context,
+ org.eclipse.osbp.ecview.core.common.model.core,
+ com.vaadin.ui";version="0.9.0"
+Bundle-Vendor: Eclipse OSBP
+Require-Bundle: com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.editparts.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common.model;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.beans;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.databinding.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.extension.editparts;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.extension.model;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.ui.presentation.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.util.emf;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.ecview.presentation.vaadin;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.dsl.xtext.builder.participant;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.dsl.common.xtext;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.dsl.dto.xtext;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.dsl.entity.xtext;bundle-version="[0.9.0,0.10.0)",
+ com.google.inject;bundle-version="3.0.0",
+ org.junit;bundle-version="4.11.0",
+ org.eclipse.xtext;bundle-version="[2.7.3,2.8.0)",
+ org.eclipse.osbp.xtext.builder.types.bundles;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.xtend.lib;bundle-version="[2.7.3,2.8.0)",
+ com.google.guava;bundle-version="[10.0.0,19.0.0)",
+ org.eclipse.xtext.xbase.lib;bundle-version="[2.7.3,2.8.0)"
+Import-Package: org.osgi.service.component;version="1.2.0",
+ org.osgi.service.component.annotations;version="1.2.0"
+Service-Component: OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy.xml,
+ OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml,
+ OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy.xml
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml
new file mode 100644
index 0000000..4cb0533
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService">
+ <implementation class="org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.ECViewUIRenderService"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.IECViewUIRenderService"/>
+ </service>
+ <reference bind="bindDtoMetadataService" cardinality="1..1" interface="IDtoMetadataService" name="DtoMetadataService" policy="dynamic" unbind="unbindDtoMetadataService"/>
+ <reference bind="bindDtoRenderingStrategy" cardinality="1..1" interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILDtoRenderStrategy" name="DtoRenderingStrategy" policy="dynamic" unbind="unbindDtoRenderingStrategy"/>
+ <reference bind="bindEntityMetadataService" cardinality="1..1" interface="IEntityMetadataService" name="EntityMetadataService" policy="dynamic" unbind="unbindEntityMetadataService"/>
+ <reference bind="bindEntityRenderingStrategy" cardinality="1..1" interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILEntityRenderStrategy" name="EntityRenderingStrategy" policy="dynamic" unbind="unbindEntityRenderingStrategy"/>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy.xml b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy.xml
new file mode 100644
index 0000000..b4df5c2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy">
+ <implementation class="org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LDtoRenderStrategy"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILDtoRenderStrategy"/>
+ </service>
+ <property name="service.ranking" value="100"/>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy.xml b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy.xml
new file mode 100644
index 0000000..ba19cd4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/OSGI-INF/org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy">
+ <implementation class="org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.LEntityRenderStrategy"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILEntityRenderStrategy"/>
+ </service>
+ <property name="service.ranking" value="100"/>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.html b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.ini b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.mappings b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.properties b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.properties
new file mode 100644
index 0000000..af886f0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.ecview.services.vaadin
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/build.properties b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/build.properties
new file mode 100644
index 0000000..d9e274a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/build.properties
@@ -0,0 +1,8 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ OSGI-INF/,\
+ LICENSE.txt
+source.. = src/,\
+ xtend-gen/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/pom.xml b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/pom.xml
new file mode 100644
index 0000000..ef7ef6f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.ecview.services.vaadin</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <description>Generates default ECView models for Entities and DTOs that are defined by OSBP Xtext DSL.
+
+The IECViewUIRenderService is exposed as an OSGi service.</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/IECViewUIRenderService.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/IECViewUIRenderService.java
new file mode 100644
index 0000000..1ce3d23
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/IECViewUIRenderService.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin;
+
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+
+import com.vaadin.ui.ComponentContainer;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Is used to render a UI for a given dto or entity.
+ */
+public interface IECViewUIRenderService {
+
+ /**
+ * Renders an UI for the given dto class.
+ *
+ * @param clazz
+ * - the dto class
+ * @param component
+ * - the component container. Must be attached to an UI instance.
+ * @param beanSlots
+ * - The map entry is registered as a bean slot
+ * @param renderingOptions
+ * - The rendering options
+ * @return the i view context
+ */
+ IViewContext renderUIForDTO(Class<?> clazz, ComponentContainer component,
+ Map<String, Object> beanSlots, Map<String, Object> renderingOptions);
+
+ /**
+ * Renders an UI for the given dto instance and also create the required
+ * bindings.
+ *
+ * @param dto
+ * - the dto instance
+ * @param component
+ * - the component container. Must be attached to an UI instance.
+ * @param beanSlots
+ * - The map entry is registered as a bean slot
+ * @param renderingOptions
+ * - The rendering options
+ * @return the i view context
+ */
+ IViewContext renderUIForDTO(Object dto, ComponentContainer component,
+ Map<String, Object> beanSlots, Map<String, Object> renderingOptions);
+
+ /**
+ * Renders an UI for the given entity class.
+ *
+ * @param clazz
+ * - the dto class
+ * @param component
+ * - the component container. Must be attached to an UI instance.
+ * @param beanSlots
+ * - The map entry is registered as a bean slot
+ * @param renderingOptions
+ * - The rendering options
+ * @return the i view context
+ */
+ IViewContext renderUIForEntity(Class<?> clazz,
+ ComponentContainer component, Map<String, Object> beanSlots,
+ Map<String, Object> renderingOptions);
+
+ /**
+ * Renders an UI for the given entity instance and also create the required
+ * bindings.
+ *
+ * @param entity
+ * - the entity instance
+ * @param component
+ * - the component container. Must be attached to an UI instance.
+ * @param beanSlots
+ * - The map entry is registered as a bean slot
+ * @param renderingOptions
+ * - The rendering options
+ * @return the i view context
+ */
+ IViewContext renderUIForEntity(Object entity, ComponentContainer component,
+ Map<String, Object> beanSlots, Map<String, Object> renderingOptions);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILDtoRenderStrategy.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILDtoRenderStrategy.java
new file mode 100644
index 0000000..c3a5f9f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILDtoRenderStrategy.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin;
+
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.dsl.semantic.dto.LDto;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface ILDtoRenderStrategy.
+ */
+public interface ILDtoRenderStrategy {
+
+ /**
+ * Renders an YView for the given parameters.
+ *
+ * @param lDto
+ * - the dto model
+ * @param dtoClass
+ * - the class of the dto
+ * @param dtoInstance
+ * - the dto instance. May be <code>null</code>.
+ * @param beanSlots
+ * - the bean slot that should be initialzed.
+ * @return the y view
+ */
+ YView render(LDto lDto, Class<?> dtoClass, Object dtoInstance,
+ Map<String, Object> beanSlots);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILEntityRenderStrategy.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILEntityRenderStrategy.java
new file mode 100644
index 0000000..bbd6847
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/ILEntityRenderStrategy.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin;
+
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.dsl.semantic.entity.LEntity;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface ILEntityRenderStrategy.
+ */
+public interface ILEntityRenderStrategy {
+
+ /**
+ * Renders an YView for the given parameters.
+ *
+ * @param lEntity
+ * - the entity model
+ * @param entityClass
+ * - the class of the entity
+ * @param entityInstance
+ * - the entity instance. May be <code>null</code>.
+ * @param beanSlots
+ * - the bean slot that should be initialzed.
+ * @return the y view
+ */
+ YView render(LEntity lEntity, Class<?> entityClass, Object entityInstance,
+ Map<String, Object> beanSlots);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/AbstractRenderer.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/AbstractRenderer.java
new file mode 100644
index 0000000..1dae737
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/AbstractRenderer.java
@@ -0,0 +1,231 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Stack;
+
+import org.eclipse.osbp.ecview.core.common.model.core.YLayout;
+import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AbstractRenderer.
+ */
+public class AbstractRenderer {
+
+ /** The Constant NUMERICTYPES. */
+ protected static final Set<String> NUMERICTYPES = new HashSet<String>();
+ static {
+ NUMERICTYPES.add(Byte.class.getName());
+ NUMERICTYPES.add(Long.class.getName());
+ NUMERICTYPES.add(Short.class.getName());
+ NUMERICTYPES.add(Integer.class.getName());
+
+ NUMERICTYPES.add("byte");
+ NUMERICTYPES.add("long");
+ NUMERICTYPES.add("short");
+ NUMERICTYPES.add("int");
+ }
+
+ /** The Constant DECIMALTYPES. */
+ protected static final Set<String> DECIMALTYPES = new HashSet<String>();
+ static {
+ DECIMALTYPES.add(Double.class.getName());
+ DECIMALTYPES.add(Float.class.getName());
+
+ NUMERICTYPES.add("double");
+ NUMERICTYPES.add("float");
+ }
+
+ /** The contexts. */
+ protected Stack<Context> contexts = new Stack<Context>();
+
+ /** The model bundle. */
+ protected Bundle modelBundle;
+
+ /**
+ * Inits the.
+ *
+ * @param yLayout
+ * the y layout
+ * @param clazz
+ * the clazz
+ */
+ public void init(YLayout yLayout, Class<?> clazz) {
+ modelBundle = FrameworkUtil.getBundle(clazz);
+ contexts.push(new Context(null, null, yLayout));
+ }
+
+ /**
+ * Returns the currently active layout.
+ *
+ * @return the layout
+ */
+ public YLayout getLayout() {
+ return contexts.peek().getLayout();
+ }
+
+ /**
+ * Returns the binding path under respect of nested attributes.
+ *
+ * @param attribute
+ * the attribute
+ * @return the binding path
+ */
+ public String getBindingPath(String attribute) {
+ return contexts.peek().getBindingPathFor(attribute);
+ }
+
+ /**
+ * Checks if is string.
+ *
+ * @param object
+ * the object
+ * @return true, if is string
+ */
+ public static boolean isString(LDataType object) {
+ String fqn = object.getJvmTypeReference().getQualifiedName();
+ return "java.lang.String".equals(fqn);
+ }
+
+ /**
+ * Checks if is boolean.
+ *
+ * @param object
+ * the object
+ * @return true, if is boolean
+ */
+ public static boolean isBoolean(LDataType object) {
+ String name = object.getJvmTypeReference().getQualifiedName();
+ return "java.lang.Boolean".equals(name);
+ }
+
+ /**
+ * Checks if is numeric.
+ *
+ * @param object
+ * the object
+ * @return true, if is numeric
+ */
+ public static boolean isNumeric(LDataType object) {
+ String name = object.getJvmTypeReference().getQualifiedName();
+ return NUMERICTYPES.contains(name);
+ }
+
+ /**
+ * Checks if is decimal.
+ *
+ * @param object
+ * the object
+ * @return true, if is decimal
+ */
+ public static boolean isDecimal(LDataType object) {
+ String name = object.getJvmTypeReference().getQualifiedName();
+ return DECIMALTYPES.contains(name);
+ }
+
+ /**
+ * The Class Context.
+ */
+ protected static class Context {
+
+ /** The parent. */
+ protected final Context parent;
+
+ /** The binding attribute. */
+ protected final String bindingAttribute;
+
+ /** The layout. */
+ protected final YLayout layout;
+
+ /**
+ * Instantiates a new context.
+ *
+ * @param parent
+ * the parent
+ * @param bindingAttribute
+ * the binding attribute
+ * @param layout
+ * the layout
+ */
+ public Context(Context parent, String bindingAttribute, YLayout layout) {
+ super();
+ this.parent = parent;
+ this.bindingAttribute = bindingAttribute;
+ this.layout = layout;
+ }
+
+ /**
+ * Gets the layout.
+ *
+ * @return the parentLayout
+ */
+ public YLayout getLayout() {
+ if (layout != null) {
+ return layout;
+ }
+
+ if (parent != null) {
+ return parent.getLayout();
+ }
+
+ throw new IllegalStateException("No layout found");
+ }
+
+ /**
+ * Gets the binding path.
+ *
+ * @return the binding path
+ */
+ public String getBindingPath() {
+ String path = "";
+ if (parent != null) {
+ path = parent.getBindingPath();
+ }
+
+ if (bindingAttribute != null) {
+ if (path != null && !path.equals("")) {
+ if (!bindingAttribute.equals("")) {
+ // attache the binding attribute separated by a "."
+ path = path + "." + bindingAttribute;
+ }
+ } else {
+ path = bindingAttribute;
+ }
+ }
+
+ return path;
+ }
+
+ /**
+ * Gets the binding path for.
+ *
+ * @param attribute
+ * the attribute
+ * @return the binding path for
+ */
+ public String getBindingPathFor(String attribute) {
+ String path = getBindingPath();
+ if (path != null && !path.equals("")) {
+ path = path + "." + attribute;
+ } else {
+ path = attribute;
+ }
+ return path;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.xtend b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.xtend
new file mode 100644
index 0000000..7921674
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.xtend
@@ -0,0 +1,282 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+ package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl
+
+import org.eclipse.osbp.dsl.semantic.common.types.LAnnotationDef
+import org.eclipse.osbp.dsl.semantic.common.types.LOperation
+import org.eclipse.osbp.dsl.semantic.entity.LBean
+import org.eclipse.osbp.dsl.semantic.entity.LEntity
+import org.eclipse.osbp.runtime.common.annotations.DomainDescription
+import org.eclipse.osbp.runtime.common.annotations.DomainKey
+
+class BeanHelper {
+
+ /**
+ * @param bean the bean
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ def static String findCaptionProperty(Object bean) {
+ if (bean == null) {
+ return null
+ }
+
+ if (bean instanceof Class<?>) {
+ return findCaptionProperty(bean as Class<?>)
+ } else {
+ return findCaptionProperty(bean.class)
+ }
+ }
+
+ /**
+ * @param beanClass the bean class
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ def static String findCaptionProperty(Class<?> beanClass) {
+ if (beanClass == null) {
+ return null
+ }
+
+ // try to find annotation in class
+ for (field : beanClass.declaredFields) {
+ if (field.isAnnotationPresent(typeof(DomainKey))) {
+ return field.name
+ }
+ }
+
+ // include super classes too
+ for (field : beanClass.fields) {
+ if (field.isAnnotationPresent(typeof(DomainKey))) {
+ return field.name
+ }
+ }
+
+ return null
+ }
+
+ /**
+ * @param lEntity the entity
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ def static String findCaptionProperty(LEntity lEntity) {
+ var String bestMatch = null
+
+ if (lEntity == null) {
+ return null
+ }
+
+ for (field : lEntity.allAttributes) {
+ if (field.domainKey
+ || field.name.equalsIgnoreCase("Name")
+ || field.name.equalsIgnoreCase("Number")
+ || field.name.equalsIgnoreCase("Description")
+ || field.uuid
+ ) {
+ bestMatch = field.name
+ }
+ }
+ return bestMatch
+
+// // include super classes too
+// for (field : beanClass.fields) {
+// if (field.isAnnotationPresent(typeof(DomainKey))) {
+// return field.name
+// }
+// }
+
+ }
+
+ /**
+ * @param lBean the bean
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ def static String findCaptionProperty(LBean lBean) {
+ var String bestMatch = null
+
+ if (lBean == null) {
+ return null
+ }
+
+ for (field : lBean.allAttributes) {
+ if (field.domainKey
+ || field.name.equalsIgnoreCase("Name")
+ || field.name.equalsIgnoreCase("Number")
+ || field.name.equalsIgnoreCase("Description")
+ || field.uuid
+ ) {
+ bestMatch = field.name
+ }
+ }
+ return bestMatch
+
+// // include super classes too
+// for (field : beanClass.fields) {
+// if (field.isAnnotationPresent(typeof(DomainKey))) {
+// return field.name
+// }
+// }
+ }
+
+ /**
+ * @param bean the bean
+ * @return the description property if it could be found. Null otherwise.
+ */
+ def static String findDescriptionProperty(Object bean) {
+ if (bean == null) {
+ return null
+ }
+
+ if (bean instanceof Class<?>) {
+ return findDescriptionProperty(bean as Class<?>)
+ } else {
+ return findDescriptionProperty(bean.class)
+ }
+ }
+
+ /**
+ * @param beanClass the beanClass
+ * @return the description property if it could be found. Null otherwise.
+ */
+ def static String findDescriptionProperty(Class<?> beanClass) {
+ if (beanClass == null) {
+ return null
+ }
+
+ // try to find annotation in fields of class
+ for (field : beanClass.declaredFields) {
+ if (field.isAnnotationPresent(typeof(DomainDescription))) {
+ return field.name
+ }
+ }
+
+ // try to find annotation in methods of class
+ for (method : beanClass.declaredMethods) {
+ if (method.isAnnotationPresent(typeof(DomainDescription))) {
+ return OperationExtensions.toPropertyName(method.name)
+ }
+ }
+
+ // include super classes too
+ for (field : beanClass.fields) {
+ if (field.isAnnotationPresent(typeof(DomainDescription))) {
+ return field.name
+ }
+ }
+
+ // include super class too
+ for (method : beanClass.methods) {
+ if (method.isAnnotationPresent(typeof(DomainDescription))) {
+ return OperationExtensions.toPropertyName(method.name)
+ }
+ }
+
+ return null
+ }
+
+ /**
+ * @param entity the entity
+ * @return the description property if it could be found. Null otherwise.
+ */
+ def static String findDescriptionProperty(LEntity entity) {
+ if (entity == null) {
+ return null
+ }
+
+ // try to find annotation in fields of class
+ for (field : entity.attributes) {
+ if (field.domainDescription) {
+ return field.name
+ }
+ }
+
+ // try to find annotation in methods of class
+ for (method : entity.operations) {
+ val LAnnotationDef def = method.annotations.findFirst[
+ it.annotation.annotationType.qualifiedName.equals((typeof(DomainDescription)).canonicalName)
+ ];
+ if(def != null){
+ return OperationExtensions.toPropertyName(method.name)
+ }
+ }
+
+ // include super classes too
+ for (field : entity.allAttributes) {
+ if (field.domainDescription) {
+ return field.name
+ }
+ }
+
+ // include super class too
+ for (method : entity.allFeatures) {
+ if (method instanceof LOperation){
+ val LAnnotationDef def = method.annotations.findFirst[
+ it.annotation.annotationType.qualifiedName.equals((typeof(DomainDescription)).canonicalName)
+ ];
+ if(def != null){
+ return OperationExtensions.toPropertyName(method.name)
+ }
+ }
+ }
+
+ return null
+ }
+
+ /**
+ * @param bean the bean
+ * @return the description property if it could be found. Null otherwise.
+ */
+ def static String findDescriptionProperty(LBean bean) {
+ if (bean == null) {
+ return null
+ }
+
+ // try to find annotation in fields of class
+ for (field : bean.attributes) {
+ if (field.domainDescription) {
+ return field.name
+ }
+ }
+
+ // try to find annotation in methods of class
+ for (method : bean.operations) {
+ val LAnnotationDef def = method.annotations.findFirst[
+ it.annotation.annotationType.qualifiedName.equals((typeof(DomainDescription)).canonicalName)
+ ];
+ if(def != null){
+ return OperationExtensions.toPropertyName(method.name)
+ }
+ }
+
+ // include super classes too
+ for (field : bean.allAttributes) {
+ if (field.domainDescription) {
+ return field.name
+ }
+ }
+
+ // include super class too
+ for (method : bean.allFeatures) {
+ if (method instanceof LOperation){
+ val LAnnotationDef def = method.annotations.findFirst[
+ it.annotation.annotationType.qualifiedName.equals((typeof(DomainDescription)).canonicalName)
+ ];
+ if(def != null){
+ return OperationExtensions.toPropertyName(method.name)
+ }
+ }
+ }
+
+ return null
+ }
+
+
+
+}
+
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/DtoModelRenderer.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/DtoModelRenderer.java
new file mode 100644
index 0000000..be64fd3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/DtoModelRenderer.java
@@ -0,0 +1,415 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.BindingFactory;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YEnumListBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlot;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlotValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.core.YLayout;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YNumericDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.dsl.semantic.common.types.LAttribute;
+import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
+import org.eclipse.osbp.dsl.semantic.common.types.LEnum;
+import org.eclipse.osbp.dsl.semantic.common.types.LFeature;
+import org.eclipse.osbp.dsl.semantic.common.types.LPackage;
+import org.eclipse.osbp.dsl.semantic.common.types.LScalarType;
+import org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch;
+import org.eclipse.osbp.dsl.semantic.dto.LDto;
+import org.eclipse.osbp.dsl.semantic.dto.LDtoAttribute;
+import org.eclipse.osbp.dsl.semantic.dto.LDtoInheritedAttribute;
+import org.eclipse.osbp.dsl.semantic.dto.util.OSBPDtoSwitch;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class DtoModelRenderer.
+ */
+public class DtoModelRenderer extends AbstractRenderer {
+
+ /**
+ * Instantiates a new dto model renderer.
+ */
+ public DtoModelRenderer() {
+ super();
+ }
+
+ /**
+ * Render.
+ *
+ * @param lDto
+ * the l dto
+ * @param yLayout
+ * the y layout
+ * @param dtoClass
+ * the dto class
+ * @return the y embeddable
+ */
+ public YEmbeddable render(LDto lDto, YLayout yLayout, Class<?> dtoClass) {
+ super.init(yLayout, dtoClass);
+ return new DtoTypesProcessor(null).doSwitch(lDto);
+ }
+
+ /**
+ * Is responsible to create fields based on the datatype.
+ */
+ protected class CommonTypesProcessor extends OSBPTypesSwitch<YEmbeddable> {
+
+ /** The factory. */
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ /** The l attribute. */
+ private final LAttribute lAttribute;
+
+ /**
+ * Instantiates a new common types processor.
+ *
+ * @param lAttribute
+ * the l attribute
+ */
+ public CommonTypesProcessor(LAttribute lAttribute) {
+ this.lAttribute = lAttribute;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch#caseLDataType(org.eclipse.osbp.dsl.semantic.common.types.LDataType)
+ */
+ @Override
+ public YEmbeddable caseLDataType(LDataType object) {
+ YEmbeddable result = null;
+ if (object.isDate()) {
+ result = createDateField(object);
+ } else if (isString(object)) {
+ result = createTextField(object);
+ } else if (isNumeric(object)) {
+ result = createNumericField(object);
+ } else if (isDecimal(object)) {
+ result = createDecimalField(object);
+ } else if (isBoolean(object)) {
+ result = createCheckbox(object);
+ }
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch#caseLScalarType(org.eclipse.osbp.dsl.semantic.common.types.LScalarType)
+ */
+ @Override
+ public YEmbeddable caseLScalarType(LScalarType object) {
+ // in case of scalar type, delegate to the specific entity datatype
+ // processor
+ return new DtoTypesProcessor(lAttribute).doSwitch(object);
+ }
+
+ /**
+ * Creates the date field.
+ *
+ * @param object
+ * the object
+ * @return the y date time
+ */
+ public YDateTime createDateField(LDataType object) {
+ YDateTime yDate = factory.createDateTime();
+
+ // create the datatype
+ YDateTimeDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYDateTimeDatatype();
+ yDate.setDatatype(yDt);
+ switch (object.getDateType()) {
+ case DATE:
+ yDt.setFormat(YDateTimeFormat.DATE);
+ break;
+ case TIME:
+ yDt.setFormat(YDateTimeFormat.TIME);
+ break;
+ case TIMESTAMP:
+ yDt.setFormat(YDateTimeFormat.DATE_TIME);
+ break;
+ }
+
+ YLayout yLayout = getLayout();
+ // create the binding -> bind from root slot to the attribute
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yDate.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yDate;
+ }
+
+ /**
+ * Creates the text field.
+ *
+ * @param object
+ * the object
+ * @return the y text field
+ */
+ public YTextField createTextField(LDataType object) {
+ YTextField yText = factory.createTextField();
+
+ // create the datatype
+ YTextDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYTextDatatype();
+ yText.setDatatype(yDt);
+ yDt.setMinLength(3);
+ yDt.setMaxLength(20);
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yText;
+ }
+
+ /**
+ * Creates the numeric field.
+ *
+ * @param object
+ * the object
+ * @return the y numeric field
+ */
+ public YNumericField createNumericField(LDataType object) {
+ YNumericField yNumeric = factory.createNumericField();
+
+ // create the datatype
+ YNumericDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYNumericDatatype();
+ yNumeric.setDatatype(yDt);
+
+ yDt.setGrouping(true);
+ yDt.setMarkNegative(true);
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yNumeric.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yNumeric;
+ }
+
+ /**
+ * Creates the decimal field.
+ *
+ * @param object
+ * the object
+ * @return the y decimal field
+ */
+ public YDecimalField createDecimalField(LDataType object) {
+ YDecimalField yDecimal = factory.createDecimalField();
+
+ // create the datatype
+ YDecimalDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYDecimalDatatype();
+ yDecimal.setDatatype(yDt);
+
+ yDt.setGrouping(true);
+ yDt.setMarkNegative(true);
+ yDt.setPrecision(2);
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yDecimal.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yDecimal;
+ }
+
+ /**
+ * Creates the decimal field.
+ *
+ * @param object
+ * the object
+ * @return the y check box
+ */
+ public YCheckBox createCheckbox(LDataType object) {
+ YCheckBox yCheckbox = factory.createCheckBox();
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yCheckbox.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yCheckbox;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch#caseLEnum(org.eclipse.osbp.dsl.semantic.common.types.LEnum)
+ */
+ @Override
+ public YEmbeddable caseLEnum(LEnum object) {
+ LPackage lPkg = (LPackage) object.eContainer();
+ String enumClassName = lPkg.getName() + "." + object.getName();
+ Class<?> enumClass = null;
+ try {
+ enumClass = modelBundle.loadClass(enumClassName);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("No class found for "
+ + enumClassName);
+ }
+
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YEnumListBindingEndpoint enumValuesEndpoint = BindingFactory.eINSTANCE
+ .createYEnumListBindingEndpoint();
+ enumValuesEndpoint.setEnum(enumClass);
+
+ YEmbeddable result = null;
+ if (enumClass.getEnumConstants().length > 3) {
+ YComboBox yCombo = factory.createComboBox();
+ yCombo.setType(enumClass);
+ result = yCombo;
+
+ // bind the enum literals as collection input
+ yBindingSet.addBinding(yCombo.createCollectionEndpoint(),
+ enumValuesEndpoint);
+
+ // bind the selection to the input dto
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute
+ .getName()));
+ // bind selection to ui field
+ yBindingSet.addBinding(yCombo.createSelectionEndpoint(),
+ yContextBindingEndpoint);
+
+ } else {
+ YOptionsGroup yOptions = factory.createOptionsGroup();
+ yOptions.setType(enumClass);
+ result = yOptions;
+
+ // bind the enum literals as collection input
+ yBindingSet.addBinding(yOptions.createCollectionEndpoint(),
+ enumValuesEndpoint);
+
+ // bind the selection to the input dto
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute
+ .getName()));
+ // bind selection to ui field
+ yBindingSet.addBinding(yOptions.createSelectionEndpoint(),
+ yContextBindingEndpoint);
+ }
+
+ return result;
+ }
+
+ }
+
+ /**
+ * Is responsible to create fields based on the datatype.
+ */
+ protected class DtoTypesProcessor extends OSBPDtoSwitch<YEmbeddable> {
+
+ /**
+ * Instantiates a new dto types processor.
+ *
+ * @param lAttribute
+ * the l attribute
+ */
+ public DtoTypesProcessor(LAttribute lAttribute) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.dto.util.OSBPDtoSwitch#caseLDtoAttribute(org.eclipse.osbp.dsl.semantic.dto.LDtoAttribute)
+ */
+ @Override
+ public YEmbeddable caseLDtoAttribute(LDtoAttribute object) {
+ YEmbeddable yEmbeddable = null;
+ yEmbeddable = new CommonTypesProcessor(object).doSwitch(object
+ .getType());
+ if (yEmbeddable != null) {
+ yEmbeddable.setLabel(object.getName());
+ }
+
+ return yEmbeddable;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.dto.util.OSBPDtoSwitch#caseLDtoInheritedAttribute(org.eclipse.osbp.dsl.semantic.dto.LDtoInheritedAttribute)
+ */
+ @Override
+ public YEmbeddable caseLDtoInheritedAttribute(
+ LDtoInheritedAttribute object) {
+
+ LAttribute attribute = object.getInheritedFeature();
+ LScalarType type = object.getInheritedType();
+ YEmbeddable yEmbeddable = null;
+ yEmbeddable = new CommonTypesProcessor(attribute).doSwitch(type);
+ if (yEmbeddable != null) {
+ yEmbeddable.setLabel(attribute.getName());
+ }
+
+ return yEmbeddable;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.dto.util.OSBPDtoSwitch#caseLDto(org.eclipse.osbp.dsl.semantic.dto.LDto)
+ */
+ @Override
+ public YEmbeddable caseLDto(LDto lDto) {
+ YLayout yLayout = getLayout();
+ for (LFeature lFeature : lDto.getAllFeatures()) {
+ YEmbeddable result = doSwitch(lFeature);
+ if (result != null) {
+ yLayout.addElement(result);
+ }
+ }
+ return yLayout;
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/ECViewUIRenderService.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/ECViewUIRenderService.java
new file mode 100644
index 0000000..d45fc93
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/ECViewUIRenderService.java
@@ -0,0 +1,204 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import java.util.Map;
+
+import org.eclipse.osbp.dsl.semantic.dto.LDto;
+import org.eclipse.osbp.dsl.semantic.entity.LEntity;
+import org.eclipse.osbp.dsl.xtext.builder.participant.IDtoMetadataService;
+import org.eclipse.osbp.dsl.xtext.builder.participant.IEntityMetadataService;
+import org.eclipse.osbp.ecview.core.common.context.ContextException;
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.VaadinRenderer;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.IECViewUIRenderService;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILDtoRenderStrategy;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILEntityRenderStrategy;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.vaadin.ui.ComponentContainer;
+
+@Component(immediate = true, enabled = true)
+public class ECViewUIRenderService implements IECViewUIRenderService {
+
+ private ILDtoRenderStrategy dtoStrategy;
+ private ILEntityRenderStrategy entityStrategy;
+ private IEntityMetadataService entityMetadataService;
+ private IDtoMetadataService dtoMetadataService;
+ private Injector injector;
+
+ protected void activate() {
+ injector = Guice.createInjector(new XtextModule());
+
+ if (entityStrategy != null) {
+ injector.injectMembers(entityStrategy);
+ }
+ }
+
+ protected void deactivate() {
+ }
+
+ @Override
+ public IViewContext renderUIForDTO(Class<?> clazz,
+ ComponentContainer component, Map<String, Object> beanSlots,
+ Map<String, Object> renderingOptions) {
+ if (dtoStrategy == null) {
+ return null;
+ }
+
+ YView yView = dtoStrategy.render(findLDTO(clazz), clazz, null,
+ beanSlots);
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext context = null;
+ try {
+ context = renderer.render(component, yView, renderingOptions);
+ } catch (ContextException e) {
+ throw new RuntimeException(e);
+ }
+
+ return context;
+ }
+
+ @Override
+ public IViewContext renderUIForDTO(Object dto,
+ ComponentContainer component, Map<String, Object> beanSlots,
+ Map<String, Object> renderingOptions) {
+ if (dtoStrategy == null) {
+ return null;
+ }
+
+ YView yView = dtoStrategy.render(findLDTO(dto.getClass()),
+ dto.getClass(), dto, beanSlots);
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext context = null;
+ try {
+ context = renderer.render(component, yView, renderingOptions);
+ context.setBean(IViewContext.ROOTBEAN_SELECTOR, dto);
+ } catch (ContextException e) {
+ throw new RuntimeException(e);
+ }
+
+ return context;
+ }
+
+ @Override
+ public IViewContext renderUIForEntity(Class<?> clazz,
+ ComponentContainer component, Map<String, Object> beanSlots,
+ Map<String, Object> renderingOptions) {
+ if (entityStrategy == null) {
+ return null;
+ }
+
+ YView yView = entityStrategy.render(findLEntity(clazz), clazz, null,
+ beanSlots);
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext context = null;
+ try {
+ context = renderer.render(component, yView, renderingOptions);
+ } catch (ContextException e) {
+ throw new RuntimeException(e);
+ }
+
+ return context;
+
+ }
+
+ @Override
+ public IViewContext renderUIForEntity(Object entity,
+ ComponentContainer component, Map<String, Object> beanSlots,
+ Map<String, Object> renderingOptions) {
+ if (entityStrategy == null) {
+ return null;
+ }
+
+ YView yView = entityStrategy.render(findLEntity(entity.getClass()),
+ entity.getClass(), entity, beanSlots);
+ VaadinRenderer renderer = new VaadinRenderer();
+ IViewContext context = null;
+ try {
+ context = renderer.render(component, yView, renderingOptions);
+ context.setBean(IViewContext.ROOTBEAN_SELECTOR, entity);
+ } catch (ContextException e) {
+ throw new RuntimeException(e);
+ }
+
+ return context;
+ }
+
+ /**
+ * Returns the dto for the given class.
+ *
+ * @param clazz
+ * @return
+ */
+ private LDto findLDTO(Class<?> clazz) {
+ return dtoMetadataService.getMetadata(clazz);
+ }
+
+ /**
+ * Returns the entity for the given class.
+ *
+ * @param clazz
+ * @return
+ */
+ private LEntity findLEntity(Class<?> clazz) {
+ return entityMetadataService.getMetadata(clazz);
+ }
+
+ @Reference(unbind = "unbindDtoRenderingStrategy", policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY)
+ protected void bindDtoRenderingStrategy(ILDtoRenderStrategy dtoStrategy) {
+ this.dtoStrategy = dtoStrategy;
+ }
+
+ protected void unbindDtoRenderingStrategy(ILDtoRenderStrategy dtoStrategy) {
+ this.dtoStrategy = null;
+ }
+
+ @Reference(unbind = "unbindEntityRenderingStrategy", policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY)
+ protected void bindEntityRenderingStrategy(
+ ILEntityRenderStrategy entityStrategy) {
+ this.entityStrategy = entityStrategy;
+ }
+
+ protected void unbindEntityRenderingStrategy(
+ ILEntityRenderStrategy entityStrategy) {
+ this.entityStrategy = null;
+ }
+
+ @Reference(unbind = "unbindEntityMetadataService", policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY)
+ protected void bindEntityMetadataService(
+ IEntityMetadataService entityMetadataService) {
+ this.entityMetadataService = entityMetadataService;
+ }
+
+ protected void unbindEntityMetadataService(
+ IEntityMetadataService entityMetadataService) {
+ this.entityMetadataService = null;
+ }
+
+ @Reference(unbind = "unbindDtoMetadataService", policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MANDATORY)
+ protected void bindDtoMetadataService(IDtoMetadataService dtoMetadataService) {
+ this.dtoMetadataService = dtoMetadataService;
+ }
+
+ protected void unbindDtoMetadataService(
+ IDtoMetadataService dtoMetadataService) {
+ this.dtoMetadataService = null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityModelRenderer.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityModelRenderer.java
new file mode 100644
index 0000000..742e3cf
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityModelRenderer.java
@@ -0,0 +1,436 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.binding.BindingFactory;
+import org.eclipse.osbp.ecview.core.common.model.binding.YBindingSet;
+import org.eclipse.osbp.ecview.core.common.model.binding.YEnumListBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlot;
+import org.eclipse.osbp.ecview.core.common.model.core.YBeanSlotValueBindingEndpoint;
+import org.eclipse.osbp.ecview.core.common.model.core.YEmbeddable;
+import org.eclipse.osbp.ecview.core.common.model.core.YLayout;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.ExtDatatypesFactory;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDateTimeFormat;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YDecimalDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YNumericDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.datatypes.YTextDatatype;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YCheckBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YComboBox;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDateTime;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YDecimalField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YNumericField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YOptionsGroup;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YTextField;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YVerticalLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.dsl.semantic.common.types.LAttribute;
+import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
+import org.eclipse.osbp.dsl.semantic.common.types.LEnum;
+import org.eclipse.osbp.dsl.semantic.common.types.LPackage;
+import org.eclipse.osbp.dsl.semantic.common.types.LScalarType;
+import org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch;
+import org.eclipse.osbp.dsl.semantic.entity.LBean;
+import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute;
+import org.eclipse.osbp.dsl.semantic.entity.LBeanFeature;
+import org.eclipse.osbp.dsl.semantic.entity.LEntity;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature;
+import org.eclipse.osbp.dsl.semantic.entity.util.OSBPEntitySwitch;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class EntityModelRenderer.
+ */
+public class EntityModelRenderer extends AbstractRenderer {
+
+ /**
+ * Instantiates a new entity model renderer.
+ */
+ public EntityModelRenderer() {
+ super();
+ }
+
+ /**
+ * Render.
+ *
+ * @param lEntity
+ * the l entity
+ * @param yLayout
+ * the y layout
+ * @param entityClass
+ * the entity class
+ * @return the y embeddable
+ */
+ public YEmbeddable render(LEntity lEntity, YLayout yLayout,
+ Class<?> entityClass) {
+ super.init(yLayout, entityClass);
+ return new EntityTypesProcessor(null).doSwitch(lEntity);
+ }
+
+ /**
+ * Is responsible to create fields based on the datatype.
+ */
+ protected class CommonTypesProcessor extends OSBPTypesSwitch<YEmbeddable> {
+
+ /** The factory. */
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ /** The l attribute. */
+ private final LAttribute lAttribute;
+
+ /**
+ * Instantiates a new common types processor.
+ *
+ * @param lAttribute
+ * the l attribute
+ */
+ public CommonTypesProcessor(LAttribute lAttribute) {
+ this.lAttribute = lAttribute;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch#caseLDataType(org.eclipse.osbp.dsl.semantic.common.types.LDataType)
+ */
+ @Override
+ public YEmbeddable caseLDataType(LDataType object) {
+ YEmbeddable result = null;
+ if (object.isDate()) {
+ result = createDateField(object);
+ } else if (isString(object)) {
+ result = createTextField(object);
+ } else if (isNumeric(object)) {
+ result = createNumericField(object);
+ } else if (isDecimal(object)) {
+ result = createDecimalField(object);
+ } else if (isBoolean(object)) {
+ result = createCheckbox(object);
+ }
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch#caseLScalarType(org.eclipse.osbp.dsl.semantic.common.types.LScalarType)
+ */
+ @Override
+ public YEmbeddable caseLScalarType(LScalarType object) {
+ // in case of scalar type, delegate to the specific entity datatype
+ // processor
+ return new EntityTypesProcessor(lAttribute).doSwitch(object);
+ }
+
+ /**
+ * Creates the date field.
+ *
+ * @param object
+ * the object
+ * @return the y date time
+ */
+ public YDateTime createDateField(LDataType object) {
+ YDateTime yDate = factory.createDateTime();
+
+ // create the datatype
+ YDateTimeDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYDateTimeDatatype();
+ yDate.setDatatype(yDt);
+ switch (object.getDateType()) {
+ case DATE:
+ yDt.setFormat(YDateTimeFormat.DATE);
+ break;
+ case TIME:
+ yDt.setFormat(YDateTimeFormat.TIME);
+ break;
+ case TIMESTAMP:
+ yDt.setFormat(YDateTimeFormat.DATE_TIME);
+ break;
+ }
+
+ YLayout yLayout = getLayout();
+ // create the binding -> bind from root slot to the attribute
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yDate.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yDate;
+ }
+
+ /**
+ * Creates the text field.
+ *
+ * @param object
+ * the object
+ * @return the y text field
+ */
+ public YTextField createTextField(LDataType object) {
+ YTextField yText = factory.createTextField();
+
+ // create the datatype
+ YTextDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYTextDatatype();
+ yText.setDatatype(yDt);
+ yDt.setMinLength(3);
+ yDt.setMaxLength(20);
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yText.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yText;
+ }
+
+ /**
+ * Creates the numeric field.
+ *
+ * @param object
+ * the object
+ * @return the y numeric field
+ */
+ public YNumericField createNumericField(LDataType object) {
+ YNumericField yNumeric = factory.createNumericField();
+
+ // create the datatype
+ YNumericDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYNumericDatatype();
+ yNumeric.setDatatype(yDt);
+
+ yDt.setGrouping(true);
+ yDt.setMarkNegative(true);
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yNumeric.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yNumeric;
+ }
+
+ /**
+ * Creates the decimal field.
+ *
+ * @param object
+ * the object
+ * @return the y decimal field
+ */
+ public YDecimalField createDecimalField(LDataType object) {
+ YDecimalField yDecimal = factory.createDecimalField();
+
+ // create the datatype
+ YDecimalDatatype yDt = ExtDatatypesFactory.eINSTANCE
+ .createYDecimalDatatype();
+ yDecimal.setDatatype(yDt);
+
+ yDt.setGrouping(true);
+ yDt.setMarkNegative(true);
+ yDt.setPrecision(2);
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yDecimal.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yDecimal;
+ }
+
+ /**
+ * Creates the decimal field.
+ *
+ * @param object
+ * the object
+ * @return the y check box
+ */
+ public YCheckBox createCheckbox(LDataType object) {
+ YCheckBox yCheckbox = factory.createCheckBox();
+
+ // create the binding -> bind from root slot to the attribute
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YBeanSlot yBeanSlot = yLayout.getView().getBeanSlot(
+ IViewContext.ROOTBEAN_SELECTOR);
+
+ YBeanSlotValueBindingEndpoint yContextBindingEndpoint = yBeanSlot
+ .createBindingEndpoint(getBindingPath(lAttribute.getName()));
+ yBindingSet.addBinding(yCheckbox.createValueEndpoint(),
+ yContextBindingEndpoint);
+
+ return yCheckbox;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.common.types.util.OSBPTypesSwitch#caseLEnum(org.eclipse.osbp.dsl.semantic.common.types.LEnum)
+ */
+ @Override
+ public YEmbeddable caseLEnum(LEnum object) {
+ LPackage lPkg = (LPackage) object.eContainer();
+ String enumClassName = lPkg.getName() + "." + object.getName();
+ Class<?> enumClass = null;
+ try {
+ enumClass = modelBundle.loadClass(enumClassName);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("No class found for "
+ + enumClassName);
+ }
+
+ YLayout yLayout = getLayout();
+ YBindingSet yBindingSet = yLayout.getView().getOrCreateBindingSet();
+ YEnumListBindingEndpoint enumValuesEndpoint = BindingFactory.eINSTANCE
+ .createYEnumListBindingEndpoint();
+ enumValuesEndpoint.setEnum(enumClass);
+
+ YEmbeddable result = null;
+ if (enumClass.getEnumConstants().length > 3) {
+ YComboBox yCombo = factory.createComboBox();
+ yCombo.setType(enumClass);
+ result = yCombo;
+ // create the binding -> bind from root slot to the attribute
+
+ yBindingSet.addBinding(yCombo.createCollectionEndpoint(),
+ enumValuesEndpoint);
+ } else {
+ YOptionsGroup yOptions = factory.createOptionsGroup();
+ yOptions.setType(enumClass);
+ result = yOptions;
+ // create the binding -> bind from root slot to the attribute
+
+ yBindingSet.addBinding(yOptions.createCollectionEndpoint(),
+ enumValuesEndpoint);
+
+ }
+
+ return result;
+ }
+
+ }
+
+ /**
+ * Is responsible to create fields based on the datatype.
+ */
+ protected class EntityTypesProcessor extends OSBPEntitySwitch<YEmbeddable> {
+
+ /** The factory. */
+ private final SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ /**
+ * Instantiates a new entity types processor.
+ *
+ * @param lAttribute
+ * the l attribute
+ */
+ public EntityTypesProcessor(LAttribute lAttribute) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.entity.util.OSBPEntitySwitch#caseLEntityAttribute(org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute)
+ */
+ @Override
+ public YEmbeddable caseLEntityAttribute(LEntityAttribute object) {
+
+ YEmbeddable yEmbeddable = null;
+ LScalarType type = object.getType();
+ if (type instanceof LBean) {
+
+ // put a new context on the stack
+ contexts.push(new Context(contexts.peek(), object.getName(),
+ null));
+
+ yEmbeddable = doSwitch(object.getType());
+
+ contexts.pop();
+
+ } else {
+ yEmbeddable = new CommonTypesProcessor(object).doSwitch(object
+ .getType());
+ }
+ if (yEmbeddable != null) {
+ yEmbeddable.setLabel(object.getName());
+ }
+
+ return yEmbeddable;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.entity.util.OSBPEntitySwitch#caseLEntity(org.eclipse.osbp.dsl.semantic.entity.LEntity)
+ */
+ @Override
+ public YEmbeddable caseLEntity(LEntity lEntity) {
+ YLayout yLayout = getLayout();
+ for (LEntityFeature lFeature : lEntity.getAllFeatures()) {
+ YEmbeddable result = doSwitch(lFeature);
+ if (result != null) {
+ yLayout.addElement(result);
+ }
+ }
+ return yLayout;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.entity.util.OSBPEntitySwitch#caseLBean(org.eclipse.osbp.dsl.semantic.entity.LBean)
+ */
+ @Override
+ public YEmbeddable caseLBean(LBean lBean) {
+ YVerticalLayout beanLayout = factory.createVerticalLayout();
+ beanLayout.setLabel(contexts.peek().bindingAttribute);
+
+ YGridLayout layout = (YGridLayout) getLayout();
+ layout.addElement(beanLayout);
+
+ // put a new context on the stack
+ contexts.push(new Context(contexts.peek(), null, beanLayout));
+
+ for (LBeanFeature lFeature : lBean.getAllFeatures()) {
+ YEmbeddable element = doSwitch(lFeature);
+ if (element != null) {
+ beanLayout.addElement(element);
+ }
+ }
+
+ // remove the last context from the stack
+ contexts.pop();
+
+ return beanLayout;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.dsl.semantic.entity.util.OSBPEntitySwitch#caseLBeanAttribute(org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute)
+ */
+ @Override
+ public YEmbeddable caseLBeanAttribute(LBeanAttribute object) {
+ YEmbeddable yEmbeddable = new CommonTypesProcessor(object)
+ .doSwitch(object.getType());
+ yEmbeddable.setLabel(object.getName());
+ return yEmbeddable;
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.xtend b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.xtend
new file mode 100644
index 0000000..de697ea
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.xtend
@@ -0,0 +1,317 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Klemens Edler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl
+
+import javax.inject.Inject
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.osbp.dsl.semantic.common.types.LDataType
+import org.eclipse.osbp.dsl.semantic.common.types.LReference
+import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage
+import org.eclipse.osbp.dsl.semantic.common.types.LUpperBound
+import org.eclipse.osbp.dsl.semantic.entity.LBean
+import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute
+import org.eclipse.osbp.dsl.semantic.entity.LBeanReference
+import org.eclipse.osbp.dsl.semantic.entity.LEntity
+import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute
+import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature
+import org.eclipse.osbp.dsl.semantic.entity.LEntityReference
+
+/**
+ * This generator automatically creates a generic .uimodel-file from a given entity.
+ *
+ */
+class EntityToUimodelFileGenerator {
+
+ @Inject
+ private TypeHelper typeHelper
+
+ Bindings bindings = new Bindings("")
+ Counter counter = new Counter(0)
+
+ def getContent(LEntity entity) '''
+««« «entity.toDocu»
+ package «entity.toUimodelName»
+
+ import «(entity.eContainer as LTypedPackage).name».*
+
+ ideview «entity.name» {
+
+ datasource ds: «entity.toEntityFQN»
+
+ horizontalLayout «entity.name» {
+
+ form leftForm {
+ «FOR LEntityFeature feature: entity.features»
+««« «feature.toDocu»
+ «IF counter.value % 2 == 0»
+ «IF feature instanceof LEntityAttribute»
+ «IF feature.type instanceof LDataType»
+ «feature.toAttributeUiField»
+ «ELSE»
+ «feature.toBeanRefUiField»
+ «ENDIF»
+ «ELSEIF feature instanceof LReference»
+ «feature.toEntityRefUiField»
+ «ENDIF»
+ «ENDIF»
+ «counter.value = counter.value + 1»
+ «ENDFOR»
+ }
+
+ «counter.value = 0»
+ form rightForm {
+ «FOR LEntityFeature feature: entity.features»
+««« «feature.toDocu»
+ «IF counter.value % 2 == 1»
+ «IF feature instanceof LEntityAttribute»
+ «IF feature.type instanceof LDataType»
+ «feature.toAttributeUiField»
+ «ELSE»
+ «feature.toBeanRefUiField»
+ «ENDIF»
+ «ELSEIF feature instanceof LReference»
+ «feature.toEntityRefUiField»
+ «ENDIF»
+ «ENDIF»
+ «counter.value = counter.value + 1»
+ «ENDFOR»
+ }
+ «bindings.bindingList»
+
+ }
+ }
+ '''
+
+
+
+ def String getToUimodelName(LEntity entity) {
+ return (entity.eContainer as LTypedPackage).name + ".uimodel"
+ }
+
+ def String getToEntityFQN(LEntity entity) {
+ return (entity.eContainer as LTypedPackage).name + "." + entity.name
+ }
+
+ def String getToAttributeUiField(LEntityAttribute attribute) {
+ val LDataType datatype = attribute.type as LDataType
+ if (datatype.date) {
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].value''')
+ return '''
+ datefield «attribute.name»
+ '''
+ } else if(typeHelper.isString(datatype.jvmTypeReference.type)){
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].value''')
+ return '''
+ textfield «attribute.name»
+ '''
+ } else if(typeHelper.isBoolean(datatype.jvmTypeReference.type)){
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].value''')
+ return '''
+ checkbox «attribute.name»
+ '''
+ } else if(typeHelper.isNumber(datatype.jvmTypeReference.type)){
+ if(typeHelper.isDecimal(datatype.jvmTypeReference.type)){
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].value''')
+ return '''
+ decimalField «attribute.name»
+ '''
+ } else {
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].value''')
+ return '''
+ numericField «attribute.name»
+ '''
+ }
+ }
+ }
+
+ def String getToEntityRefUiField(LEntityFeature feature) {
+ val ref = feature as LEntityReference
+
+ if (ref.multiplicity.upper == LUpperBound.ONE) {
+ bindings.add('''bind ds.«feature.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«feature.name»].value''')
+ return '''
+ referenceField «feature.name» {
+ type «ref.type.name»
+ captionField «BeanHelper.findCaptionProperty(feature.eContainer as LEntity)»
+ }
+ '''
+ }
+
+ if (ref.multiplicity.upper == LUpperBound.MANY) {
+ bindings.add('''bind ds.«feature.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«feature.name»].collection''')
+ return '''
+ table «feature.name» {
+ type «ref.type.name»
+ columns {
+ column «BeanHelper.findCaptionProperty(feature.eContainer as LEntity)»
+ column «BeanHelper.findDescriptionProperty(feature.eContainer as LEntity)»
+ }
+ }
+ '''
+ }
+ }
+
+ def String getToBeanRefUiField(LEntityAttribute attribute) {
+ val type = attribute.type
+
+ if(type instanceof LBean){
+ return '''
+ panel «attribute.name» {
+ content horizontalLayout {
+ form {
+ «FOR LBeanAttribute feature: type.allAttributes»
+««« «feature.toDocu»
+ «IF feature instanceof LBeanAttribute»
+ «IF feature.type instanceof LDataType»
+ «feature.toBeanAttributeUiField»
+ «ELSE»
+ «feature.toBeantoBeanRefUiField»
+ «ENDIF»
+ «ELSEIF feature instanceof LReference»
+ «feature.toBeanReferenceUiField»
+ «ENDIF»
+ «ENDFOR»
+ }
+ }
+ }
+ '''
+ }
+ }
+
+ def String getToBeantoBeanRefUiField(LBeanAttribute attribute) {
+ val ref = attribute as LBeanReference
+
+ if (ref.multiplicity.upper == LUpperBound.ONE) {
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].value''')
+ return '''
+ referenceField «attribute.name» {
+ type «ref.type.name»
+ captionField «BeanHelper.findCaptionProperty(attribute.eContainer as LBean)»
+ }
+ '''
+ }
+
+ if (ref.multiplicity.upper == LUpperBound.MANY) {
+ bindings.add('''bind ds.«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«attribute.name»].collection''')
+ return '''
+ table «attribute.name» {
+ type «ref.type.name»
+ columns {
+ column «BeanHelper.findCaptionProperty(attribute.eContainer as LBean)»
+ column «BeanHelper.findDescriptionProperty(attribute.eContainer as LBean)»
+ }
+ }
+ '''
+ }
+ }
+
+ def String getToBeanAttributeUiField(LBeanAttribute attribute) {
+ val LDataType datatype = attribute.type as LDataType
+ val String beanName = (attribute.eContainer as LBean).name.toFirstLower
+ if (datatype.date) {
+ bindings.add('''bind ds.«beanName».«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«beanName».«attribute.name»].value''')
+ return '''
+ datefield «attribute.name»
+ '''
+ } else if(typeHelper.isString(datatype.jvmTypeReference.type)){
+ bindings.add('''bind ds.«beanName».«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«beanName».«attribute.name»].value''')
+ return '''
+ textfield «attribute.name»
+ '''
+ } else if(typeHelper.isBoolean(datatype.jvmTypeReference.type)){
+ bindings.add('''bind ds.«beanName».«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«beanName».«attribute.name»].value''')
+ return '''
+ checkbox «attribute.name»
+ '''
+ } else if(typeHelper.isNumber(datatype.jvmTypeReference.type)){
+ if(typeHelper.isDecimal(datatype.jvmTypeReference.type)){
+ bindings.add('''bind ds.«beanName».«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«beanName».«attribute.name»].value''')
+ return '''
+ decimalField «attribute.name»
+ '''
+ } else {
+ bindings.add('''bind ds.«beanName».«attribute.name» <--> [this.«IF counter.value %2 == 0»leftform«ELSE»rightform«ENDIF».«beanName».«attribute.name»].value''')
+ return '''
+ numericField «attribute.name»
+ '''
+ }
+ }
+
+ }
+
+ def String getToBeanReferenceUiField(LBeanAttribute attribute){
+ val ref = attribute as LBeanReference
+
+ if (ref.multiplicity.upper == LUpperBound.ONE) {
+ return '''
+ referenceField «attribute.name» {
+ type «ref.type.name»
+ captionField uuid
+ }
+ '''
+ }
+
+ if (ref.multiplicity.upper == LUpperBound.MANY) {
+ return '''
+ table «attribute.name» {
+ type «ref.type.name»
+ columns {
+ column uuid
+ }
+ }
+ '''
+ }
+ }
+
+ def toDocu(EObject element) {
+// if (element.documentation.nullOrEmpty) return ""
+// var docu = element.documentation
+// if (!docu.nullOrEmpty) {
+// var docus = docu.split('\n')
+// if (docus.length > 1) {
+// return '''
+// /**
+// «FOR line : docus»
+// «" * "»«line»
+// «ENDFOR»
+// */'''.toString
+// } else if (docus.length == 1) {
+// return '''/** «docu» */'''.toString
+// }
+// }
+ return ""
+ }
+}
+
+class Counter {
+
+ public var int value
+
+ new(int value) {
+ this.value = value
+ }
+
+}
+
+class Bindings {
+
+ public var String bindingList
+
+ new(String bindingList) {
+ this.bindingList = bindingList
+ }
+
+ def add(String string){
+ bindingList = bindingList.concat("\n").concat(string)
+ }
+}
+
+
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LDtoRenderStrategy.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LDtoRenderStrategy.java
new file mode 100644
index 0000000..20f6b8b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LDtoRenderStrategy.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import java.util.Map;
+
+import org.eclipse.osbp.ecview.core.common.context.IViewContext;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.YGridLayout;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.dsl.semantic.dto.LDto;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILDtoRenderStrategy;
+import org.osgi.service.component.annotations.Component;
+
+@Component(property = { "service.ranking=100" })
+public class LDtoRenderStrategy implements ILDtoRenderStrategy {
+
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ @Override
+ public YView render(LDto lDto, Class<?> dtoClass, Object dtoInstance,
+ Map<String, Object> beanSlots) {
+
+ YView yView = factory.createView();
+ // create a bean slot for the bindings
+ yView.addBeanSlot(IViewContext.ROOTBEAN_SELECTOR, dtoClass);
+
+ // create a main layout
+ YGridLayout yLayout = factory.createGridLayout();
+ yLayout.setColumns(4);
+ yView.setContent(yLayout);
+
+ // Use the dto visitor to build the UI
+ DtoModelRenderer visitor = new DtoModelRenderer();
+ visitor.render(lDto, yLayout, dtoClass);
+
+ return yView;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LEntityRenderStrategy.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LEntityRenderStrategy.java
new file mode 100644
index 0000000..1f7947f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/LEntityRenderStrategy.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import java.util.Map;
+
+import org.eclipse.osbp.dsl.semantic.entity.LEntity;
+import org.eclipse.osbp.ecview.core.common.model.core.YView;
+import org.eclipse.osbp.ecview.core.extension.model.extension.util.SimpleExtensionModelFactory;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.ILEntityRenderStrategy;
+import org.osgi.service.component.annotations.Component;
+
+import com.google.inject.Inject;
+
+@Component(property = { "service.ranking=100" })
+public class LEntityRenderStrategy implements ILEntityRenderStrategy {
+
+ @Inject
+ private EntityToUimodelFileGenerator generator;
+ @SuppressWarnings("unused")
+ private SimpleExtensionModelFactory factory = new SimpleExtensionModelFactory();
+
+ @Override
+ public YView render(LEntity lEntity, Class<?> entityClass,
+ Object entityInstance, Map<String, Object> beanSlots) {
+
+ System.out.println("******************************");
+ System.out.println("******************************");
+ System.out.println("******************************\n\n");
+ System.out.println(generator.getContent(lEntity));
+ System.out.println("\n\n******************************");
+ System.out.println("******************************");
+ System.out.println("******************************");
+
+ // YView yView = factory.createView();
+ // // create a bean slot for the bindings
+ // yView.addBeanSlot(IViewContext.ROOTBEAN_SELECTOR, entityClass);
+ //
+ // // create a main layout
+ // YGridLayout yLayout = factory.createGridLayout();
+ // yLayout.setColumns(4);
+ // yView.setContent(yLayout);
+ //
+ // // Use the entity renderer to build the UI model
+ // EntityModelRenderer renderer = new EntityModelRenderer();
+ // renderer.render(lEntity, yLayout, entityClass);
+
+ return null;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/OperationExtensions.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/OperationExtensions.java
new file mode 100644
index 0000000..b780d3a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/OperationExtensions.java
@@ -0,0 +1,294 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.xtext.common.types.JvmDeclaredType;
+import org.eclipse.xtext.common.types.JvmFeature;
+import org.eclipse.xtext.common.types.JvmOperation;
+import org.eclipse.xtext.common.types.JvmVisibility;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class OperationExtensions.
+ */
+public class OperationExtensions {
+
+ /**
+ * Normalizes the method name.
+ *
+ * @param simpleName
+ * the simple name
+ * @return the string
+ */
+ public static String toPropertyName(String simpleName) {
+ if (simpleName == null) {
+ return null;
+ }
+ String tempName = null;
+ if (isSetter(simpleName)) {
+ tempName = StringExtensions.toFirstLower(simpleName.replaceFirst(
+ "set", ""));
+ } else if (isGetter(simpleName)) {
+ if (simpleName.startsWith("get")) {
+ tempName = StringExtensions.toFirstLower(simpleName
+ .replaceFirst("get", ""));
+ } else {
+ tempName = StringExtensions.toFirstLower(simpleName
+ .replaceFirst("is", ""));
+ }
+ }
+ return tempName;
+ }
+
+ /**
+ * Checks if is getter.
+ *
+ * @param simpleName
+ * the simple name
+ * @return true, if is getter
+ */
+ public static boolean isGetter(String simpleName) {
+ if (simpleName == null) {
+ return false;
+ }
+ return simpleName.startsWith("get") || simpleName.startsWith("is");
+ }
+
+ /**
+ * Checks if is setter.
+ *
+ * @param simpleName
+ * the simple name
+ * @return true, if is setter
+ */
+ public static boolean isSetter(String simpleName) {
+ return simpleName != null && simpleName.startsWith("set");
+ }
+
+ /**
+ * Calculates the operation infos for the given type.
+ *
+ * @param type
+ * the type
+ * @return the operation infos
+ */
+ public static Map<String, OperationInfo> getOperationInfos(
+ JvmDeclaredType type) {
+ return getOperationInfos(type, null);
+ }
+
+ /**
+ * Calculates the operation infos for the given type.
+ *
+ * @param type
+ * the type
+ * @param filterName
+ * - is used to filter only methods property names matching the
+ * filter name.
+ * @return the operation infos
+ */
+ public static Map<String, OperationInfo> getOperationInfos(
+ JvmDeclaredType type, String filterName) {
+ Map<String, OperationInfo> infos = new HashMap<String, OperationInfo>();
+ for (JvmFeature feature : type.getAllFeatures()) {
+ if (!(feature instanceof JvmOperation)) {
+ continue;
+ }
+
+ JvmOperation operation = (JvmOperation) feature;
+ if (operation.getVisibility() != JvmVisibility.PUBLIC) {
+ continue;
+ }
+
+ if (!operation.getParameters().isEmpty()) {
+ continue;
+ }
+
+ String propertyName = toPropertyName(operation.getSimpleName());
+ if (filterName != null && !filterName.equals(propertyName)) {
+ continue;
+ }
+
+ if (!isGetter(operation.getSimpleName())
+ && !isSetter(operation.getSimpleName())) {
+ continue;
+ }
+
+ String id = calcId(operation.getDeclaringType(),
+ operation.getSimpleName());
+ if (!infos.containsKey(id)) {
+ OperationInfo info = new OperationInfo();
+ info.id = id;
+ info.name = propertyName;
+ infos.put(id, info);
+ }
+
+ OperationInfo info = infos.get(id);
+ if (isGetter(operation.getSimpleName())) {
+ info.getter = operation;
+ } else {
+ info.setter = operation;
+ }
+ }
+
+ // apply readonly and create descriptions
+ for (OperationInfo info : infos.values()) {
+ if (info.getter == null) {
+ continue;
+ }
+ if (info.setter == null) {
+ info.readonly = true;
+ }
+ }
+ return infos;
+ }
+
+ /**
+ * Normalizes the name.
+ *
+ * @param declaringType
+ * the declaring type
+ * @param simpleName
+ * the simple name
+ * @return the string
+ */
+ public static String calcId(JvmDeclaredType declaringType, String simpleName) {
+ String tempName = toPropertyName(simpleName);
+ if (tempName == null) {
+ return null;
+ }
+
+ return declaringType.getQualifiedName() + ":" + tempName;
+ }
+
+ /**
+ * The Class OperationInfo.
+ */
+ public static class OperationInfo {
+
+ /** The id. */
+ private String id;
+
+ /** The name. */
+ private String name;
+
+ /** The readonly. */
+ private boolean readonly;
+
+ /** The getter. */
+ private JvmOperation getter;
+
+ /** The setter. */
+ private JvmOperation setter;
+
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the id.
+ *
+ * @param id
+ * the new id
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name
+ * the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Checks if is readonly.
+ *
+ * @return true, if is readonly
+ */
+ public boolean isReadonly() {
+ return readonly;
+ }
+
+ /**
+ * Sets the readonly.
+ *
+ * @param readonly
+ * the new readonly
+ */
+ public void setReadonly(boolean readonly) {
+ this.readonly = readonly;
+ }
+
+ /**
+ * Gets the getter.
+ *
+ * @return the getter
+ */
+ public JvmOperation getGetter() {
+ return getter;
+ }
+
+ /**
+ * Sets the getter.
+ *
+ * @param getter
+ * the new getter
+ */
+ public void setGetter(JvmOperation getter) {
+ this.getter = getter;
+ }
+
+ /**
+ * Gets the setter.
+ *
+ * @return the setter
+ */
+ public JvmOperation getSetter() {
+ return setter;
+ }
+
+ /**
+ * Sets the setter.
+ *
+ * @param setter
+ * the new setter
+ */
+ public void setSetter(JvmOperation setter) {
+ this.setter = setter;
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/TypeHelper.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/TypeHelper.java
new file mode 100644
index 0000000..7f4366d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/TypeHelper.java
@@ -0,0 +1,145 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import org.eclipse.xtext.common.types.JvmType;
+import org.eclipse.xtext.common.types.util.TypeReferences;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TypeHelper.
+ */
+@SuppressWarnings("restriction")
+@Singleton
+public class TypeHelper {
+
+ /** The type references. */
+ @Inject
+ private TypeReferences typeReferences;
+
+ /**
+ * Returns true, if the type is numeric.
+ *
+ * @param type
+ * the type
+ * @return true, if is number
+ */
+ public boolean isNumber(JvmType type) {
+ if (typeReferences.is(type, Byte.class)
+ || typeReferences.is(type, Byte.TYPE)
+ || typeReferences.is(type, Short.class)
+ || typeReferences.is(type, Short.TYPE)
+ || typeReferences.is(type, Integer.class)
+ || typeReferences.is(type, Integer.TYPE)
+ || typeReferences.is(type, Long.class)
+ || typeReferences.is(type, Long.TYPE)
+ || typeReferences.is(type, Float.class)
+ || typeReferences.is(type, Float.TYPE)
+ || typeReferences.is(type, Double.class)
+ || typeReferences.is(type, Double.TYPE)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true, if the type is a decimal number.
+ *
+ * @param type
+ * the type
+ * @return true, if is decimal
+ */
+ public boolean isDecimal(JvmType type) {
+ if (typeReferences.is(type, Float.class)
+ || typeReferences.is(type, Float.TYPE)
+ || typeReferences.is(type, Double.class)
+ || typeReferences.is(type, Double.TYPE)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the qualified name of the given numeric type. Throws exception,
+ * if the given type is not a valid number.
+ *
+ * @param type
+ * the type
+ * @return the string
+ */
+ public String toNumericQualifiedName(JvmType type) {
+ return toNumericType(type).getName();
+ }
+
+ /**
+ * Returns the class file of the given numeric type. Throws exception, if
+ * the given type is not a valid number.
+ *
+ * @param type
+ * the type
+ * @return the class&lt;? extends number&gt;
+ */
+ public Class<? extends Number> toNumericType(JvmType type) {
+ if (typeReferences.is(type, Byte.class)
+ || typeReferences.is(type, Byte.TYPE)) {
+ return Byte.class;
+ } else if (typeReferences.is(type, Short.class)
+ || typeReferences.is(type, Short.TYPE)) {
+ return Short.class;
+ } else if (typeReferences.is(type, Integer.class)
+ || typeReferences.is(type, Integer.TYPE)) {
+ return Integer.class;
+ } else if (typeReferences.is(type, Long.class)
+ || typeReferences.is(type, Long.TYPE)) {
+ return Long.class;
+ } else if (typeReferences.is(type, Float.class)
+ || typeReferences.is(type, Float.TYPE)) {
+ return Float.class;
+ } else if (typeReferences.is(type, Double.class)
+ || typeReferences.is(type, Double.TYPE)) {
+ return Double.class;
+ }
+ throw new IllegalArgumentException(type + " is not a valid number type");
+ }
+
+ /**
+ * Returns true, if the type is boolean.
+ *
+ * @param type
+ * the type
+ * @return true, if is boolean
+ */
+ public boolean isBoolean(JvmType type) {
+ if (typeReferences.is(type, Boolean.class)
+ || typeReferences.is(type, Boolean.TYPE)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true, if the type is boolean.
+ *
+ * @param type
+ * the type
+ * @return true, if is string
+ */
+ public boolean isString(JvmType type) {
+ if (typeReferences.is(type, String.class)) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/XtextModule.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/XtextModule.java
new file mode 100644
index 0000000..a6bed59
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/src/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/XtextModule.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import org.eclipse.xtext.common.types.TypesFactory;
+import org.eclipse.xtext.common.types.access.IJvmTypeProvider;
+import org.eclipse.xtext.common.types.impl.TypesFactoryImpl;
+import org.eclipse.xtext.common.types.util.TypeReferences;
+import org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider;
+import org.eclipse.xtext.resource.IResourceDescriptions;
+import org.eclipse.xtext.resource.XtextResourceSet;
+import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider;
+import org.eclipse.xtext.resource.impl.ResourceSetBasedResourceDescriptions;
+import org.eclipse.xtext.service.AbstractGenericModule;
+import org.eclipse.xtext.service.SingletonBinding;
+import org.eclipse.osbp.dsl.xtext.types.bundles.BundleSpaceTypeProviderFactory;
+import org.eclipse.osbp.dsl.xtext.types.bundles.BundleSpaceTypeScopeProvider;
+
+import com.google.inject.name.Names;
+
+@SuppressWarnings("restriction")
+public class XtextModule extends AbstractGenericModule {
+
+ public XtextModule() {
+ }
+
+ public void configureNamedProviderScope(com.google.inject.Binder binder) {
+ binder.bind(IResourceDescriptions.class)
+ .annotatedWith(
+ Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
+ .to(ResourceSetBasedResourceDescriptions.class);
+ }
+
+ public void configureLiveProviderScope(com.google.inject.Binder binder) {
+ binder.bind(IResourceDescriptions.class)
+ .annotatedWith(
+ Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
+ .to(ResourceSetBasedResourceDescriptions.class);
+ }
+
+ public void configurePeristedProviderScope(com.google.inject.Binder binder) {
+ binder.bind(IResourceDescriptions.class)
+ .annotatedWith(
+ Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS))
+ .to(ResourceSetBasedResourceDescriptions.class);
+ }
+
+ @SingletonBinding
+ public Class<? extends IResourceDescriptions> bindIResourceDescriptions() {
+ return ResourceSetBasedResourceDescriptions.class;
+ }
+
+ @SingletonBinding
+ public Class<? extends XtextResourceSet> bindXtextResourceSet() {
+ return XtextResourceSet.class;
+ }
+
+ public Class<? extends TypeReferences> bindTypeReferences() {
+ return TypeReferences.class;
+ }
+
+ public Class<? extends TypesFactory> bindTypesFactory() {
+ return TypesFactoryImpl.class;
+ }
+
+ public Class<? extends AbstractTypeScopeProvider> bindAbstractTypeScopeProvider() {
+ return BundleSpaceTypeScopeProvider.class;
+ }
+
+ public Class<? extends IJvmTypeProvider.Factory> bindbindIJvmTypeProvider$Factory() {
+ return BundleSpaceTypeProviderFactory.class;
+ }
+
+
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java
new file mode 100644
index 0000000..4332da3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/BeanHelper.java
@@ -0,0 +1,378 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import com.google.common.base.Objects;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.osbp.dsl.semantic.common.types.LAnnotationDef;
+import org.eclipse.osbp.dsl.semantic.common.types.LAnnotationTarget;
+import org.eclipse.osbp.dsl.semantic.entity.LBean;
+import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute;
+import org.eclipse.osbp.dsl.semantic.entity.LBeanFeature;
+import org.eclipse.osbp.dsl.semantic.entity.LEntity;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature;
+import org.eclipse.osbp.dsl.semantic.entity.LOperation;
+import org.eclipse.osbp.runtime.common.annotations.DomainDescription;
+import org.eclipse.osbp.runtime.common.annotations.DomainKey;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.OperationExtensions;
+import org.eclipse.xtext.common.types.JvmType;
+import org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation;
+import org.eclipse.xtext.xbase.lib.Functions.Function1;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+
+@SuppressWarnings("all")
+public class BeanHelper {
+ /**
+ * @param bean the bean
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ public static String findCaptionProperty(final Object bean) {
+ boolean _equals = Objects.equal(bean, null);
+ if (_equals) {
+ return null;
+ }
+ if ((bean instanceof Class<?>)) {
+ return BeanHelper.findCaptionProperty(((Class<?>) bean));
+ } else {
+ Class<?> _class = bean.getClass();
+ return BeanHelper.findCaptionProperty(_class);
+ }
+ }
+
+ /**
+ * @param beanClass the bean class
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ public static String findCaptionProperty(final Class<?> beanClass) {
+ boolean _equals = Objects.equal(beanClass, null);
+ if (_equals) {
+ return null;
+ }
+ Field[] _declaredFields = beanClass.getDeclaredFields();
+ for (final Field field : _declaredFields) {
+ boolean _isAnnotationPresent = field.isAnnotationPresent(DomainKey.class);
+ if (_isAnnotationPresent) {
+ return field.getName();
+ }
+ }
+ Field[] _fields = beanClass.getFields();
+ for (final Field field_1 : _fields) {
+ boolean _isAnnotationPresent_1 = field_1.isAnnotationPresent(DomainKey.class);
+ if (_isAnnotationPresent_1) {
+ return field_1.getName();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param lEntity the entity
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ public static String findCaptionProperty(final LEntity lEntity) {
+ String bestMatch = null;
+ boolean _equals = Objects.equal(lEntity, null);
+ if (_equals) {
+ return null;
+ }
+ List<LEntityAttribute> _allAttributes = lEntity.getAllAttributes();
+ for (final LEntityAttribute field : _allAttributes) {
+ boolean _or = false;
+ boolean _or_1 = false;
+ boolean _or_2 = false;
+ boolean _or_3 = false;
+ boolean _isDomainKey = field.isDomainKey();
+ if (_isDomainKey) {
+ _or_3 = true;
+ } else {
+ String _name = field.getName();
+ boolean _equalsIgnoreCase = _name.equalsIgnoreCase("Name");
+ _or_3 = _equalsIgnoreCase;
+ }
+ if (_or_3) {
+ _or_2 = true;
+ } else {
+ String _name_1 = field.getName();
+ boolean _equalsIgnoreCase_1 = _name_1.equalsIgnoreCase("Number");
+ _or_2 = _equalsIgnoreCase_1;
+ }
+ if (_or_2) {
+ _or_1 = true;
+ } else {
+ String _name_2 = field.getName();
+ boolean _equalsIgnoreCase_2 = _name_2.equalsIgnoreCase("Description");
+ _or_1 = _equalsIgnoreCase_2;
+ }
+ if (_or_1) {
+ _or = true;
+ } else {
+ boolean _isUuid = field.isUuid();
+ _or = _isUuid;
+ }
+ if (_or) {
+ String _name_3 = field.getName();
+ bestMatch = _name_3;
+ }
+ }
+ return bestMatch;
+ }
+
+ /**
+ * @param lBean the bean
+ * @return the caption property if it could be found. Null otherwise.
+ */
+ public static String findCaptionProperty(final LBean lBean) {
+ String bestMatch = null;
+ boolean _equals = Objects.equal(lBean, null);
+ if (_equals) {
+ return null;
+ }
+ List<LBeanAttribute> _allAttributes = lBean.getAllAttributes();
+ for (final LBeanAttribute field : _allAttributes) {
+ boolean _or = false;
+ boolean _or_1 = false;
+ boolean _or_2 = false;
+ boolean _or_3 = false;
+ boolean _isDomainKey = field.isDomainKey();
+ if (_isDomainKey) {
+ _or_3 = true;
+ } else {
+ String _name = field.getName();
+ boolean _equalsIgnoreCase = _name.equalsIgnoreCase("Name");
+ _or_3 = _equalsIgnoreCase;
+ }
+ if (_or_3) {
+ _or_2 = true;
+ } else {
+ String _name_1 = field.getName();
+ boolean _equalsIgnoreCase_1 = _name_1.equalsIgnoreCase("Number");
+ _or_2 = _equalsIgnoreCase_1;
+ }
+ if (_or_2) {
+ _or_1 = true;
+ } else {
+ String _name_2 = field.getName();
+ boolean _equalsIgnoreCase_2 = _name_2.equalsIgnoreCase("Description");
+ _or_1 = _equalsIgnoreCase_2;
+ }
+ if (_or_1) {
+ _or = true;
+ } else {
+ boolean _isUuid = field.isUuid();
+ _or = _isUuid;
+ }
+ if (_or) {
+ String _name_3 = field.getName();
+ bestMatch = _name_3;
+ }
+ }
+ return bestMatch;
+ }
+
+ /**
+ * @param bean the bean
+ * @return the description property if it could be found. Null otherwise.
+ */
+ public static String findDescriptionProperty(final Object bean) {
+ boolean _equals = Objects.equal(bean, null);
+ if (_equals) {
+ return null;
+ }
+ if ((bean instanceof Class<?>)) {
+ return BeanHelper.findDescriptionProperty(((Class<?>) bean));
+ } else {
+ Class<?> _class = bean.getClass();
+ return BeanHelper.findDescriptionProperty(_class);
+ }
+ }
+
+ /**
+ * @param beanClass the beanClass
+ * @return the description property if it could be found. Null otherwise.
+ */
+ public static String findDescriptionProperty(final Class<?> beanClass) {
+ boolean _equals = Objects.equal(beanClass, null);
+ if (_equals) {
+ return null;
+ }
+ Field[] _declaredFields = beanClass.getDeclaredFields();
+ for (final Field field : _declaredFields) {
+ boolean _isAnnotationPresent = field.isAnnotationPresent(DomainDescription.class);
+ if (_isAnnotationPresent) {
+ return field.getName();
+ }
+ }
+ Method[] _declaredMethods = beanClass.getDeclaredMethods();
+ for (final Method method : _declaredMethods) {
+ boolean _isAnnotationPresent_1 = method.isAnnotationPresent(DomainDescription.class);
+ if (_isAnnotationPresent_1) {
+ String _name = method.getName();
+ return OperationExtensions.toPropertyName(_name);
+ }
+ }
+ Field[] _fields = beanClass.getFields();
+ for (final Field field_1 : _fields) {
+ boolean _isAnnotationPresent_2 = field_1.isAnnotationPresent(DomainDescription.class);
+ if (_isAnnotationPresent_2) {
+ return field_1.getName();
+ }
+ }
+ Method[] _methods = beanClass.getMethods();
+ for (final Method method_1 : _methods) {
+ boolean _isAnnotationPresent_3 = method_1.isAnnotationPresent(DomainDescription.class);
+ if (_isAnnotationPresent_3) {
+ String _name_1 = method_1.getName();
+ return OperationExtensions.toPropertyName(_name_1);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param entity the entity
+ * @return the description property if it could be found. Null otherwise.
+ */
+ public static String findDescriptionProperty(final LEntity entity) {
+ boolean _equals = Objects.equal(entity, null);
+ if (_equals) {
+ return null;
+ }
+ List<LEntityAttribute> _attributes = entity.getAttributes();
+ for (final LEntityAttribute field : _attributes) {
+ boolean _isDomainDescription = field.isDomainDescription();
+ if (_isDomainDescription) {
+ return field.getName();
+ }
+ }
+ List<LOperation> _operations = entity.getOperations();
+ for (final LOperation method : _operations) {
+ {
+ EList<LAnnotationDef> _annotations = method.getAnnotations();
+ final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() {
+ public Boolean apply(final LAnnotationDef it) {
+ XAnnotation _annotation = it.getAnnotation();
+ JvmType _annotationType = _annotation.getAnnotationType();
+ String _qualifiedName = _annotationType.getQualifiedName();
+ String _canonicalName = DomainDescription.class.getCanonicalName();
+ return Boolean.valueOf(_qualifiedName.equals(_canonicalName));
+ }
+ };
+ final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function);
+ boolean _notEquals = (!Objects.equal(def, null));
+ if (_notEquals) {
+ String _name = method.getName();
+ return OperationExtensions.toPropertyName(_name);
+ }
+ }
+ }
+ List<LEntityAttribute> _allAttributes = entity.getAllAttributes();
+ for (final LEntityAttribute field_1 : _allAttributes) {
+ boolean _isDomainDescription_1 = field_1.isDomainDescription();
+ if (_isDomainDescription_1) {
+ return field_1.getName();
+ }
+ }
+ List<LEntityFeature> _allFeatures = entity.getAllFeatures();
+ for (final LEntityFeature method_1 : _allFeatures) {
+ if ((method_1 instanceof org.eclipse.osbp.dsl.semantic.common.types.LOperation)) {
+ EList<LAnnotationDef> _annotations = ((LAnnotationTarget)method_1).getAnnotations();
+ final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() {
+ public Boolean apply(final LAnnotationDef it) {
+ XAnnotation _annotation = it.getAnnotation();
+ JvmType _annotationType = _annotation.getAnnotationType();
+ String _qualifiedName = _annotationType.getQualifiedName();
+ String _canonicalName = DomainDescription.class.getCanonicalName();
+ return Boolean.valueOf(_qualifiedName.equals(_canonicalName));
+ }
+ };
+ final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function);
+ boolean _notEquals = (!Objects.equal(def, null));
+ if (_notEquals) {
+ String _name = method_1.getName();
+ return OperationExtensions.toPropertyName(_name);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param bean the bean
+ * @return the description property if it could be found. Null otherwise.
+ */
+ public static String findDescriptionProperty(final LBean bean) {
+ boolean _equals = Objects.equal(bean, null);
+ if (_equals) {
+ return null;
+ }
+ List<LBeanAttribute> _attributes = bean.getAttributes();
+ for (final LBeanAttribute field : _attributes) {
+ boolean _isDomainDescription = field.isDomainDescription();
+ if (_isDomainDescription) {
+ return field.getName();
+ }
+ }
+ List<LOperation> _operations = bean.getOperations();
+ for (final LOperation method : _operations) {
+ {
+ EList<LAnnotationDef> _annotations = method.getAnnotations();
+ final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() {
+ public Boolean apply(final LAnnotationDef it) {
+ XAnnotation _annotation = it.getAnnotation();
+ JvmType _annotationType = _annotation.getAnnotationType();
+ String _qualifiedName = _annotationType.getQualifiedName();
+ String _canonicalName = DomainDescription.class.getCanonicalName();
+ return Boolean.valueOf(_qualifiedName.equals(_canonicalName));
+ }
+ };
+ final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function);
+ boolean _notEquals = (!Objects.equal(def, null));
+ if (_notEquals) {
+ String _name = method.getName();
+ return OperationExtensions.toPropertyName(_name);
+ }
+ }
+ }
+ List<LBeanAttribute> _allAttributes = bean.getAllAttributes();
+ for (final LBeanAttribute field_1 : _allAttributes) {
+ boolean _isDomainDescription_1 = field_1.isDomainDescription();
+ if (_isDomainDescription_1) {
+ return field_1.getName();
+ }
+ }
+ List<LBeanFeature> _allFeatures = bean.getAllFeatures();
+ for (final LBeanFeature method_1 : _allFeatures) {
+ if ((method_1 instanceof org.eclipse.osbp.dsl.semantic.common.types.LOperation)) {
+ EList<LAnnotationDef> _annotations = ((LAnnotationTarget)method_1).getAnnotations();
+ final Function1<LAnnotationDef, Boolean> _function = new Function1<LAnnotationDef, Boolean>() {
+ public Boolean apply(final LAnnotationDef it) {
+ XAnnotation _annotation = it.getAnnotation();
+ JvmType _annotationType = _annotation.getAnnotationType();
+ String _qualifiedName = _annotationType.getQualifiedName();
+ String _canonicalName = DomainDescription.class.getCanonicalName();
+ return Boolean.valueOf(_qualifiedName.equals(_canonicalName));
+ }
+ };
+ final LAnnotationDef def = IterableExtensions.<LAnnotationDef>findFirst(_annotations, _function);
+ boolean _notEquals = (!Objects.equal(def, null));
+ if (_notEquals) {
+ String _name = method_1.getName();
+ return OperationExtensions.toPropertyName(_name);
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java
new file mode 100644
index 0000000..febd15f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Bindings.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Klemens Edler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+@SuppressWarnings("all")
+public class Bindings {
+ public String bindingList;
+
+ public Bindings(final String bindingList) {
+ this.bindingList = bindingList;
+ }
+
+ public String add(final String string) {
+ String _concat = this.bindingList.concat("\n");
+ String _concat_1 = _concat.concat(string);
+ return this.bindingList = _concat_1;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java
new file mode 100644
index 0000000..db1b944
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/Counter.java
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Klemens Edler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+@SuppressWarnings("all")
+public class Counter {
+ public int value;
+
+ public Counter(final int value) {
+ this.value = value;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java
new file mode 100644
index 0000000..24fb505
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.ecview.services.vaadin/xtend-gen/org/eclipse/osbp/runtime/web/ecview/services/vaadin/impl/EntityToUimodelFileGenerator.java
@@ -0,0 +1,850 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Klemens Edler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl;
+
+import com.google.common.base.Objects;
+import java.util.List;
+import javax.inject.Inject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
+import org.eclipse.osbp.dsl.semantic.common.types.LMultiplicity;
+import org.eclipse.osbp.dsl.semantic.common.types.LReference;
+import org.eclipse.osbp.dsl.semantic.common.types.LScalarType;
+import org.eclipse.osbp.dsl.semantic.common.types.LType;
+import org.eclipse.osbp.dsl.semantic.common.types.LTypedPackage;
+import org.eclipse.osbp.dsl.semantic.common.types.LUpperBound;
+import org.eclipse.osbp.dsl.semantic.entity.LBean;
+import org.eclipse.osbp.dsl.semantic.entity.LBeanAttribute;
+import org.eclipse.osbp.dsl.semantic.entity.LBeanReference;
+import org.eclipse.osbp.dsl.semantic.entity.LEntity;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityAttribute;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature;
+import org.eclipse.osbp.dsl.semantic.entity.LEntityReference;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.BeanHelper;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.Bindings;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.Counter;
+import org.eclipse.osbp.runtime.web.ecview.services.vaadin.impl.TypeHelper;
+import org.eclipse.xtend2.lib.StringConcatenation;
+import org.eclipse.xtext.common.types.JvmType;
+import org.eclipse.xtext.common.types.JvmTypeReference;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+
+/**
+ * This generator automatically creates a generic .uimodel-file from a given entity.
+ */
+@SuppressWarnings("all")
+public class EntityToUimodelFileGenerator {
+ @Inject
+ private TypeHelper typeHelper;
+
+ private Bindings bindings = new Bindings("");
+
+ private Counter counter = new Counter(0);
+
+ public CharSequence getContent(final LEntity entity) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("package ");
+ String _toUimodelName = this.getToUimodelName(entity);
+ _builder.append(_toUimodelName, "");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ _builder.append("import ");
+ EObject _eContainer = entity.eContainer();
+ String _name = ((LTypedPackage) _eContainer).getName();
+ _builder.append(_name, "");
+ _builder.append(".*");
+ _builder.newLineIfNotEmpty();
+ _builder.newLine();
+ _builder.append("ideview ");
+ String _name_1 = entity.getName();
+ _builder.append(_name_1, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("datasource ds: ");
+ String _toEntityFQN = this.getToEntityFQN(entity);
+ _builder.append(_toEntityFQN, "\t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("horizontalLayout ");
+ String _name_2 = entity.getName();
+ _builder.append(_name_2, "\t");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("form leftForm {");
+ _builder.newLine();
+ {
+ EList<LEntityFeature> _features = entity.getFeatures();
+ for(final LEntityFeature feature : _features) {
+ {
+ if (((this.counter.value % 2) == 0)) {
+ {
+ if ((feature instanceof LEntityAttribute)) {
+ {
+ LScalarType _type = ((LEntityAttribute)feature).getType();
+ if ((_type instanceof LDataType)) {
+ _builder.append("\t\t\t");
+ String _toAttributeUiField = this.getToAttributeUiField(((LEntityAttribute)feature));
+ _builder.append(_toAttributeUiField, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ } else {
+ _builder.append("\t\t\t");
+ String _toBeanRefUiField = this.getToBeanRefUiField(((LEntityAttribute)feature));
+ _builder.append(_toBeanRefUiField, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ } else {
+ if ((feature instanceof LReference)) {
+ _builder.append("\t\t\t");
+ String _toEntityRefUiField = this.getToEntityRefUiField(feature);
+ _builder.append(_toEntityRefUiField, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ }
+ _builder.append("\t\t\t");
+ _builder.append(this.counter.value = (this.counter.value + 1), "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append(this.counter.value = 0, "\t\t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t\t");
+ _builder.append("form rightForm {");
+ _builder.newLine();
+ {
+ EList<LEntityFeature> _features_1 = entity.getFeatures();
+ for(final LEntityFeature feature_1 : _features_1) {
+ {
+ if (((this.counter.value % 2) == 1)) {
+ {
+ if ((feature_1 instanceof LEntityAttribute)) {
+ {
+ LScalarType _type_1 = ((LEntityAttribute)feature_1).getType();
+ if ((_type_1 instanceof LDataType)) {
+ _builder.append("\t\t\t");
+ String _toAttributeUiField_1 = this.getToAttributeUiField(((LEntityAttribute)feature_1));
+ _builder.append(_toAttributeUiField_1, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ } else {
+ _builder.append("\t\t\t");
+ String _toBeanRefUiField_1 = this.getToBeanRefUiField(((LEntityAttribute)feature_1));
+ _builder.append(_toBeanRefUiField_1, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ } else {
+ if ((feature_1 instanceof LReference)) {
+ _builder.append("\t\t\t");
+ String _toEntityRefUiField_1 = this.getToEntityRefUiField(feature_1);
+ _builder.append(_toEntityRefUiField_1, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ }
+ _builder.append("\t\t\t");
+ _builder.append(this.counter.value = (this.counter.value + 1), "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append(this.bindings.bindingList, "\t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder;
+ }
+
+ public String getToUimodelName(final LEntity entity) {
+ EObject _eContainer = entity.eContainer();
+ String _name = ((LTypedPackage) _eContainer).getName();
+ return (_name + ".uimodel");
+ }
+
+ public String getToEntityFQN(final LEntity entity) {
+ EObject _eContainer = entity.eContainer();
+ String _name = ((LTypedPackage) _eContainer).getName();
+ String _plus = (_name + ".");
+ String _name_1 = entity.getName();
+ return (_plus + _name_1);
+ }
+
+ public String getToAttributeUiField(final LEntityAttribute attribute) {
+ LScalarType _type = attribute.getType();
+ final LDataType datatype = ((LDataType) _type);
+ boolean _isDate = datatype.isDate();
+ if (_isDate) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("bind ds.");
+ String _name = attribute.getName();
+ _builder.append(_name, "");
+ _builder.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder.append("leftform");
+ } else {
+ _builder.append("rightform");
+ }
+ }
+ _builder.append(".");
+ String _name_1 = attribute.getName();
+ _builder.append(_name_1, "");
+ _builder.append("].value");
+ this.bindings.add(_builder.toString());
+ StringConcatenation _builder_1 = new StringConcatenation();
+ _builder_1.append("datefield ");
+ String _name_2 = attribute.getName();
+ _builder_1.append(_name_2, "");
+ _builder_1.newLineIfNotEmpty();
+ return _builder_1.toString();
+ } else {
+ JvmTypeReference _jvmTypeReference = datatype.getJvmTypeReference();
+ JvmType _type_1 = _jvmTypeReference.getType();
+ boolean _isString = this.typeHelper.isString(_type_1);
+ if (_isString) {
+ StringConcatenation _builder_2 = new StringConcatenation();
+ _builder_2.append("bind ds.");
+ String _name_3 = attribute.getName();
+ _builder_2.append(_name_3, "");
+ _builder_2.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_2.append("leftform");
+ } else {
+ _builder_2.append("rightform");
+ }
+ }
+ _builder_2.append(".");
+ String _name_4 = attribute.getName();
+ _builder_2.append(_name_4, "");
+ _builder_2.append("].value");
+ this.bindings.add(_builder_2.toString());
+ StringConcatenation _builder_3 = new StringConcatenation();
+ _builder_3.append("textfield ");
+ String _name_5 = attribute.getName();
+ _builder_3.append(_name_5, "");
+ _builder_3.newLineIfNotEmpty();
+ return _builder_3.toString();
+ } else {
+ JvmTypeReference _jvmTypeReference_1 = datatype.getJvmTypeReference();
+ JvmType _type_2 = _jvmTypeReference_1.getType();
+ boolean _isBoolean = this.typeHelper.isBoolean(_type_2);
+ if (_isBoolean) {
+ StringConcatenation _builder_4 = new StringConcatenation();
+ _builder_4.append("bind ds.");
+ String _name_6 = attribute.getName();
+ _builder_4.append(_name_6, "");
+ _builder_4.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_4.append("leftform");
+ } else {
+ _builder_4.append("rightform");
+ }
+ }
+ _builder_4.append(".");
+ String _name_7 = attribute.getName();
+ _builder_4.append(_name_7, "");
+ _builder_4.append("].value");
+ this.bindings.add(_builder_4.toString());
+ StringConcatenation _builder_5 = new StringConcatenation();
+ _builder_5.append("checkbox ");
+ String _name_8 = attribute.getName();
+ _builder_5.append(_name_8, "");
+ _builder_5.newLineIfNotEmpty();
+ return _builder_5.toString();
+ } else {
+ JvmTypeReference _jvmTypeReference_2 = datatype.getJvmTypeReference();
+ JvmType _type_3 = _jvmTypeReference_2.getType();
+ boolean _isNumber = this.typeHelper.isNumber(_type_3);
+ if (_isNumber) {
+ JvmTypeReference _jvmTypeReference_3 = datatype.getJvmTypeReference();
+ JvmType _type_4 = _jvmTypeReference_3.getType();
+ boolean _isDecimal = this.typeHelper.isDecimal(_type_4);
+ if (_isDecimal) {
+ StringConcatenation _builder_6 = new StringConcatenation();
+ _builder_6.append("bind ds.");
+ String _name_9 = attribute.getName();
+ _builder_6.append(_name_9, "");
+ _builder_6.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_6.append("leftform");
+ } else {
+ _builder_6.append("rightform");
+ }
+ }
+ _builder_6.append(".");
+ String _name_10 = attribute.getName();
+ _builder_6.append(_name_10, "");
+ _builder_6.append("].value");
+ this.bindings.add(_builder_6.toString());
+ StringConcatenation _builder_7 = new StringConcatenation();
+ _builder_7.append("decimalField ");
+ String _name_11 = attribute.getName();
+ _builder_7.append(_name_11, "");
+ _builder_7.newLineIfNotEmpty();
+ return _builder_7.toString();
+ } else {
+ StringConcatenation _builder_8 = new StringConcatenation();
+ _builder_8.append("bind ds.");
+ String _name_12 = attribute.getName();
+ _builder_8.append(_name_12, "");
+ _builder_8.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_8.append("leftform");
+ } else {
+ _builder_8.append("rightform");
+ }
+ }
+ _builder_8.append(".");
+ String _name_13 = attribute.getName();
+ _builder_8.append(_name_13, "");
+ _builder_8.append("].value");
+ this.bindings.add(_builder_8.toString());
+ StringConcatenation _builder_9 = new StringConcatenation();
+ _builder_9.append("numericField ");
+ String _name_14 = attribute.getName();
+ _builder_9.append(_name_14, "");
+ _builder_9.newLineIfNotEmpty();
+ return _builder_9.toString();
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getToEntityRefUiField(final LEntityFeature feature) {
+ final LEntityReference ref = ((LEntityReference) feature);
+ LMultiplicity _multiplicity = ref.getMultiplicity();
+ LUpperBound _upper = _multiplicity.getUpper();
+ boolean _equals = Objects.equal(_upper, LUpperBound.ONE);
+ if (_equals) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("bind ds.");
+ String _name = feature.getName();
+ _builder.append(_name, "");
+ _builder.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder.append("leftform");
+ } else {
+ _builder.append("rightform");
+ }
+ }
+ _builder.append(".");
+ String _name_1 = feature.getName();
+ _builder.append(_name_1, "");
+ _builder.append("].value");
+ this.bindings.add(_builder.toString());
+ StringConcatenation _builder_1 = new StringConcatenation();
+ _builder_1.append("referenceField ");
+ String _name_2 = feature.getName();
+ _builder_1.append(_name_2, "");
+ _builder_1.append(" {");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("\t");
+ _builder_1.append("type ");
+ LEntity _type = ref.getType();
+ String _name_3 = _type.getName();
+ _builder_1.append(_name_3, "\t");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("\t");
+ _builder_1.append("captionField ");
+ EObject _eContainer = feature.eContainer();
+ String _findCaptionProperty = BeanHelper.findCaptionProperty(((LEntity) _eContainer));
+ _builder_1.append(_findCaptionProperty, "\t");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("}");
+ _builder_1.newLine();
+ return _builder_1.toString();
+ }
+ LMultiplicity _multiplicity_1 = ref.getMultiplicity();
+ LUpperBound _upper_1 = _multiplicity_1.getUpper();
+ boolean _equals_1 = Objects.equal(_upper_1, LUpperBound.MANY);
+ if (_equals_1) {
+ StringConcatenation _builder_2 = new StringConcatenation();
+ _builder_2.append("bind ds.");
+ String _name_4 = feature.getName();
+ _builder_2.append(_name_4, "");
+ _builder_2.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_2.append("leftform");
+ } else {
+ _builder_2.append("rightform");
+ }
+ }
+ _builder_2.append(".");
+ String _name_5 = feature.getName();
+ _builder_2.append(_name_5, "");
+ _builder_2.append("].collection");
+ this.bindings.add(_builder_2.toString());
+ StringConcatenation _builder_3 = new StringConcatenation();
+ _builder_3.append("table ");
+ String _name_6 = feature.getName();
+ _builder_3.append(_name_6, "");
+ _builder_3.append(" {");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t");
+ _builder_3.append("type ");
+ LEntity _type_1 = ref.getType();
+ String _name_7 = _type_1.getName();
+ _builder_3.append(_name_7, "\t");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t");
+ _builder_3.append("columns {");
+ _builder_3.newLine();
+ _builder_3.append("\t\t");
+ _builder_3.append("column ");
+ EObject _eContainer_1 = feature.eContainer();
+ String _findCaptionProperty_1 = BeanHelper.findCaptionProperty(((LEntity) _eContainer_1));
+ _builder_3.append(_findCaptionProperty_1, "\t\t");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t\t");
+ _builder_3.append("column ");
+ EObject _eContainer_2 = feature.eContainer();
+ String _findDescriptionProperty = BeanHelper.findDescriptionProperty(((LEntity) _eContainer_2));
+ _builder_3.append(_findDescriptionProperty, "\t\t");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t");
+ _builder_3.append("}");
+ _builder_3.newLine();
+ _builder_3.append("}");
+ _builder_3.newLine();
+ return _builder_3.toString();
+ }
+ return null;
+ }
+
+ public String getToBeanRefUiField(final LEntityAttribute attribute) {
+ final LScalarType type = attribute.getType();
+ if ((type instanceof LBean)) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("panel ");
+ String _name = attribute.getName();
+ _builder.append(_name, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("content horizontalLayout {");
+ _builder.newLine();
+ _builder.append("\t\t");
+ _builder.append("form {");
+ _builder.newLine();
+ {
+ List<LBeanAttribute> _allAttributes = ((LBean)type).getAllAttributes();
+ for(final LBeanAttribute feature : _allAttributes) {
+ {
+ if ((feature instanceof LBeanAttribute)) {
+ {
+ LScalarType _type = feature.getType();
+ if ((_type instanceof LDataType)) {
+ _builder.append("\t\t\t");
+ String _toBeanAttributeUiField = this.getToBeanAttributeUiField(feature);
+ _builder.append(_toBeanAttributeUiField, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ } else {
+ _builder.append("\t\t\t");
+ String _toBeantoBeanRefUiField = this.getToBeantoBeanRefUiField(feature);
+ _builder.append(_toBeantoBeanRefUiField, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ } else {
+ if ((feature instanceof LReference)) {
+ _builder.append("\t\t\t");
+ String _toBeanReferenceUiField = this.getToBeanReferenceUiField(feature);
+ _builder.append(_toBeanReferenceUiField, "\t\t\t");
+ _builder.newLineIfNotEmpty();
+ }
+ }
+ }
+ }
+ }
+ _builder.append("\t\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("\t");
+ _builder.append("}");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder.toString();
+ }
+ return null;
+ }
+
+ public String getToBeantoBeanRefUiField(final LBeanAttribute attribute) {
+ final LBeanReference ref = ((LBeanReference) attribute);
+ LMultiplicity _multiplicity = ref.getMultiplicity();
+ LUpperBound _upper = _multiplicity.getUpper();
+ boolean _equals = Objects.equal(_upper, LUpperBound.ONE);
+ if (_equals) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("bind ds.");
+ String _name = attribute.getName();
+ _builder.append(_name, "");
+ _builder.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder.append("leftform");
+ } else {
+ _builder.append("rightform");
+ }
+ }
+ _builder.append(".");
+ String _name_1 = attribute.getName();
+ _builder.append(_name_1, "");
+ _builder.append("].value");
+ this.bindings.add(_builder.toString());
+ StringConcatenation _builder_1 = new StringConcatenation();
+ _builder_1.append("referenceField ");
+ String _name_2 = attribute.getName();
+ _builder_1.append(_name_2, "");
+ _builder_1.append(" {");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("\t");
+ _builder_1.append("type ");
+ LType _type = ref.getType();
+ String _name_3 = _type.getName();
+ _builder_1.append(_name_3, "\t");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("\t");
+ _builder_1.append("captionField ");
+ EObject _eContainer = attribute.eContainer();
+ String _findCaptionProperty = BeanHelper.findCaptionProperty(((LBean) _eContainer));
+ _builder_1.append(_findCaptionProperty, "\t");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("}");
+ _builder_1.newLine();
+ return _builder_1.toString();
+ }
+ LMultiplicity _multiplicity_1 = ref.getMultiplicity();
+ LUpperBound _upper_1 = _multiplicity_1.getUpper();
+ boolean _equals_1 = Objects.equal(_upper_1, LUpperBound.MANY);
+ if (_equals_1) {
+ StringConcatenation _builder_2 = new StringConcatenation();
+ _builder_2.append("bind ds.");
+ String _name_4 = attribute.getName();
+ _builder_2.append(_name_4, "");
+ _builder_2.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_2.append("leftform");
+ } else {
+ _builder_2.append("rightform");
+ }
+ }
+ _builder_2.append(".");
+ String _name_5 = attribute.getName();
+ _builder_2.append(_name_5, "");
+ _builder_2.append("].collection");
+ this.bindings.add(_builder_2.toString());
+ StringConcatenation _builder_3 = new StringConcatenation();
+ _builder_3.append("table ");
+ String _name_6 = attribute.getName();
+ _builder_3.append(_name_6, "");
+ _builder_3.append(" {");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t");
+ _builder_3.append("type ");
+ LType _type_1 = ref.getType();
+ String _name_7 = _type_1.getName();
+ _builder_3.append(_name_7, "\t");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t");
+ _builder_3.append("columns {");
+ _builder_3.newLine();
+ _builder_3.append("\t\t");
+ _builder_3.append("column ");
+ EObject _eContainer_1 = attribute.eContainer();
+ String _findCaptionProperty_1 = BeanHelper.findCaptionProperty(((LBean) _eContainer_1));
+ _builder_3.append(_findCaptionProperty_1, "\t\t");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t\t");
+ _builder_3.append("column ");
+ EObject _eContainer_2 = attribute.eContainer();
+ String _findDescriptionProperty = BeanHelper.findDescriptionProperty(((LBean) _eContainer_2));
+ _builder_3.append(_findDescriptionProperty, "\t\t");
+ _builder_3.newLineIfNotEmpty();
+ _builder_3.append("\t");
+ _builder_3.append("}");
+ _builder_3.newLine();
+ _builder_3.append("}");
+ _builder_3.newLine();
+ return _builder_3.toString();
+ }
+ return null;
+ }
+
+ public String getToBeanAttributeUiField(final LBeanAttribute attribute) {
+ LScalarType _type = attribute.getType();
+ final LDataType datatype = ((LDataType) _type);
+ EObject _eContainer = attribute.eContainer();
+ String _name = ((LBean) _eContainer).getName();
+ final String beanName = StringExtensions.toFirstLower(_name);
+ boolean _isDate = datatype.isDate();
+ if (_isDate) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("bind ds.");
+ _builder.append(beanName, "");
+ _builder.append(".");
+ String _name_1 = attribute.getName();
+ _builder.append(_name_1, "");
+ _builder.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder.append("leftform");
+ } else {
+ _builder.append("rightform");
+ }
+ }
+ _builder.append(".");
+ _builder.append(beanName, "");
+ _builder.append(".");
+ String _name_2 = attribute.getName();
+ _builder.append(_name_2, "");
+ _builder.append("].value");
+ this.bindings.add(_builder.toString());
+ StringConcatenation _builder_1 = new StringConcatenation();
+ _builder_1.append("datefield ");
+ String _name_3 = attribute.getName();
+ _builder_1.append(_name_3, "");
+ _builder_1.newLineIfNotEmpty();
+ return _builder_1.toString();
+ } else {
+ JvmTypeReference _jvmTypeReference = datatype.getJvmTypeReference();
+ JvmType _type_1 = _jvmTypeReference.getType();
+ boolean _isString = this.typeHelper.isString(_type_1);
+ if (_isString) {
+ StringConcatenation _builder_2 = new StringConcatenation();
+ _builder_2.append("bind ds.");
+ _builder_2.append(beanName, "");
+ _builder_2.append(".");
+ String _name_4 = attribute.getName();
+ _builder_2.append(_name_4, "");
+ _builder_2.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_2.append("leftform");
+ } else {
+ _builder_2.append("rightform");
+ }
+ }
+ _builder_2.append(".");
+ _builder_2.append(beanName, "");
+ _builder_2.append(".");
+ String _name_5 = attribute.getName();
+ _builder_2.append(_name_5, "");
+ _builder_2.append("].value");
+ this.bindings.add(_builder_2.toString());
+ StringConcatenation _builder_3 = new StringConcatenation();
+ _builder_3.append("textfield ");
+ String _name_6 = attribute.getName();
+ _builder_3.append(_name_6, "");
+ _builder_3.newLineIfNotEmpty();
+ return _builder_3.toString();
+ } else {
+ JvmTypeReference _jvmTypeReference_1 = datatype.getJvmTypeReference();
+ JvmType _type_2 = _jvmTypeReference_1.getType();
+ boolean _isBoolean = this.typeHelper.isBoolean(_type_2);
+ if (_isBoolean) {
+ StringConcatenation _builder_4 = new StringConcatenation();
+ _builder_4.append("bind ds.");
+ _builder_4.append(beanName, "");
+ _builder_4.append(".");
+ String _name_7 = attribute.getName();
+ _builder_4.append(_name_7, "");
+ _builder_4.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_4.append("leftform");
+ } else {
+ _builder_4.append("rightform");
+ }
+ }
+ _builder_4.append(".");
+ _builder_4.append(beanName, "");
+ _builder_4.append(".");
+ String _name_8 = attribute.getName();
+ _builder_4.append(_name_8, "");
+ _builder_4.append("].value");
+ this.bindings.add(_builder_4.toString());
+ StringConcatenation _builder_5 = new StringConcatenation();
+ _builder_5.append("checkbox ");
+ String _name_9 = attribute.getName();
+ _builder_5.append(_name_9, "");
+ _builder_5.newLineIfNotEmpty();
+ return _builder_5.toString();
+ } else {
+ JvmTypeReference _jvmTypeReference_2 = datatype.getJvmTypeReference();
+ JvmType _type_3 = _jvmTypeReference_2.getType();
+ boolean _isNumber = this.typeHelper.isNumber(_type_3);
+ if (_isNumber) {
+ JvmTypeReference _jvmTypeReference_3 = datatype.getJvmTypeReference();
+ JvmType _type_4 = _jvmTypeReference_3.getType();
+ boolean _isDecimal = this.typeHelper.isDecimal(_type_4);
+ if (_isDecimal) {
+ StringConcatenation _builder_6 = new StringConcatenation();
+ _builder_6.append("bind ds.");
+ _builder_6.append(beanName, "");
+ _builder_6.append(".");
+ String _name_10 = attribute.getName();
+ _builder_6.append(_name_10, "");
+ _builder_6.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_6.append("leftform");
+ } else {
+ _builder_6.append("rightform");
+ }
+ }
+ _builder_6.append(".");
+ _builder_6.append(beanName, "");
+ _builder_6.append(".");
+ String _name_11 = attribute.getName();
+ _builder_6.append(_name_11, "");
+ _builder_6.append("].value");
+ this.bindings.add(_builder_6.toString());
+ StringConcatenation _builder_7 = new StringConcatenation();
+ _builder_7.append("decimalField ");
+ String _name_12 = attribute.getName();
+ _builder_7.append(_name_12, "");
+ _builder_7.newLineIfNotEmpty();
+ return _builder_7.toString();
+ } else {
+ StringConcatenation _builder_8 = new StringConcatenation();
+ _builder_8.append("bind ds.");
+ _builder_8.append(beanName, "");
+ _builder_8.append(".");
+ String _name_13 = attribute.getName();
+ _builder_8.append(_name_13, "");
+ _builder_8.append(" <--> [this.");
+ {
+ if (((this.counter.value % 2) == 0)) {
+ _builder_8.append("leftform");
+ } else {
+ _builder_8.append("rightform");
+ }
+ }
+ _builder_8.append(".");
+ _builder_8.append(beanName, "");
+ _builder_8.append(".");
+ String _name_14 = attribute.getName();
+ _builder_8.append(_name_14, "");
+ _builder_8.append("].value");
+ this.bindings.add(_builder_8.toString());
+ StringConcatenation _builder_9 = new StringConcatenation();
+ _builder_9.append("numericField ");
+ String _name_15 = attribute.getName();
+ _builder_9.append(_name_15, "");
+ _builder_9.newLineIfNotEmpty();
+ return _builder_9.toString();
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getToBeanReferenceUiField(final LBeanAttribute attribute) {
+ final LBeanReference ref = ((LBeanReference) attribute);
+ LMultiplicity _multiplicity = ref.getMultiplicity();
+ LUpperBound _upper = _multiplicity.getUpper();
+ boolean _equals = Objects.equal(_upper, LUpperBound.ONE);
+ if (_equals) {
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("referenceField ");
+ String _name = attribute.getName();
+ _builder.append(_name, "");
+ _builder.append(" {");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("type ");
+ LType _type = ref.getType();
+ String _name_1 = _type.getName();
+ _builder.append(_name_1, "\t");
+ _builder.newLineIfNotEmpty();
+ _builder.append("\t");
+ _builder.append("captionField uuid");
+ _builder.newLine();
+ _builder.append("}");
+ _builder.newLine();
+ return _builder.toString();
+ }
+ LMultiplicity _multiplicity_1 = ref.getMultiplicity();
+ LUpperBound _upper_1 = _multiplicity_1.getUpper();
+ boolean _equals_1 = Objects.equal(_upper_1, LUpperBound.MANY);
+ if (_equals_1) {
+ StringConcatenation _builder_1 = new StringConcatenation();
+ _builder_1.append("table ");
+ String _name_2 = attribute.getName();
+ _builder_1.append(_name_2, "");
+ _builder_1.append(" {");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("\t");
+ _builder_1.append("type ");
+ LType _type_1 = ref.getType();
+ String _name_3 = _type_1.getName();
+ _builder_1.append(_name_3, "\t");
+ _builder_1.newLineIfNotEmpty();
+ _builder_1.append("\t");
+ _builder_1.append("columns {");
+ _builder_1.newLine();
+ _builder_1.append("\t\t");
+ _builder_1.append("column uuid");
+ _builder_1.newLine();
+ _builder_1.append("\t");
+ _builder_1.append("}");
+ _builder_1.newLine();
+ _builder_1.append("}");
+ _builder_1.newLine();
+ return _builder_1.toString();
+ }
+ return null;
+ }
+
+ public String toDocu(final EObject element) {
+ return "";
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.project b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.project
new file mode 100644
index 0000000..fd21d90
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/build.properties b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/build.properties
new file mode 100644
index 0000000..bfb7f6b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ LICENSE.txt,\
+ license.html
+src.includes = LICENSE.txt,\
+ license.html
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.properties b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.properties
new file mode 100644
index 0000000..b96135e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.properties
@@ -0,0 +1,169 @@
+###############################################################################
+# Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = ECView - Vaadin presentation layer
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description=.
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml
new file mode 100644
index 0000000..0193f50
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/feature.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.ecview.presentation.vaadin"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/license.html b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/pom.xml b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/pom.xml
new file mode 100644
index 0000000..598eeef
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin</artifactId>
+ <packaging>eclipse-feature</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <description>This features contains the implementation of the Vaadin presentation used by ECView to render a Vaadin UI based on a given UI-Model.
+
+It also contains an implementation to generate default ECView models for a given Entity or DTO. Entity and DTO have to be defined by OSBP Xtext DSLs</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/main/javadoc/README.txt b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/main/javadoc/README.txt
new file mode 100644
index 0000000..831da7e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/main/javadoc/README.txt
@@ -0,0 +1 @@
+Resource folder for javadoc resources. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/overview.html b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/overview.html
new file mode 100644
index 0000000..ed5f3fa
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin/src/overview.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>OSBP runtime web ecview presentation vaadin feature Overview</TITLE>
+ </HEAD>
+ <BODY>
+ The <b>OSBP runtime web ecview presentation vaadin feature</b> contains the implementation of the Vaadin presentation used by ECView to render a Vaadin UI based on a given UI-Model.<br><br>
+ It also contains an implementation to generate default ECView models for a given Entity or DTO. Entity and DTO have to be defined by OSBP Xtext DSLs.
+ </BODY>
+</HTML> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/.project b/org.eclipse.osbp.runtime.web.feature.testbase/.project
new file mode 100644
index 0000000..cc981a6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.testbase</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.testbase/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/build.properties b/org.eclipse.osbp.runtime.web.feature.testbase/build.properties
new file mode 100644
index 0000000..9234d19
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/build.properties
@@ -0,0 +1,2 @@
+bin.includes = license.html, feature.xml,\
+ feature.properties
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.testbase/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/feature.properties b/org.eclipse.osbp.runtime.web.feature.testbase/feature.properties
new file mode 100644
index 0000000..7159c43
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/feature.properties
@@ -0,0 +1,170 @@
+###############################################################################
+# Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = Vaadin Selenium Test Base
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description=If vaadin UIs should become tested with selenium, this feature is required \n\
+to setup a test application that hooks up test parts.
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml b/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml
new file mode 100644
index 0000000..bc81646
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/feature.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.testbase"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.eclipse.osbp.runtime.web.feature.jetty" version="0.9.0"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.testbase"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/license.html b/org.eclipse.osbp.runtime.web.feature.testbase/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.testbase/pom.xml b/org.eclipse.osbp.runtime.web.feature.testbase/pom.xml
new file mode 100644
index 0000000..4f5b152
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.testbase/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.testbase</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.project b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.project
new file mode 100644
index 0000000..d808b80
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/build.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/build.properties
new file mode 100644
index 0000000..dbd9c44
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ LICENSE.txt,\
+ license.html
+src.includes = license.html,\
+ LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.properties
new file mode 100644
index 0000000..50a70e7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.properties
@@ -0,0 +1,169 @@
+###############################################################################
+# Copyright (c) 2011, 2016 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = Vaadin Addon - OSGi bridge
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description= Vaadin addon to enable OSGi support featured by osbp.org
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2011, 2016 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml
new file mode 100644
index 0000000..a1a08d5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/feature.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.eclipse.osbp.runtime.web.feature.vaadin.common" version="0.9.0" match="equivalent"/>
+ <import feature="org.eclipse.osbp.runtime.feature.common" version="0.9.0" match="equivalent"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.vaadin.osgi"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/license.html b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/pom.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/pom.xml
new file mode 100644
index 0000000..bae72e6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <description>This feature contains implementations to run Vaadin UIs using the OSGi-HttpService based on DS (Declarative Services).</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/main/javadoc/README.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/main/javadoc/README.txt
new file mode 100644
index 0000000..831da7e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/main/javadoc/README.txt
@@ -0,0 +1 @@
+Resource folder for javadoc resources. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/overview.html b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/overview.html
new file mode 100644
index 0000000..d8ec1cd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi/src/overview.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>OSBP runtime web vaadin addon osgi feature Overview</TITLE>
+ </HEAD>
+ <BODY>
+ The <b>OSBP runtime web vaadin addon osgi feature</b> contains implementations to run Vaadin UIs using the OSGi-HttpService based on DS (Declarative Services).
+
+ </BODY>
+</HTML> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/.project b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.project
new file mode 100644
index 0000000..d3bb240
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.vaadin.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.common/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/build.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.common/build.properties
new file mode 100644
index 0000000..bfb7f6b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ LICENSE.txt,\
+ license.html
+src.includes = LICENSE.txt,\
+ license.html
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.vaadin.common/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.properties
new file mode 100644
index 0000000..7f800d2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.properties
@@ -0,0 +1,169 @@
+###############################################################################
+# Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = Vaadin Common
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description= Common parts for the osbp infrastructure. For instance context and enabling features are included.
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml
new file mode 100644
index 0000000..8f83ec0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/feature.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.vaadin.common"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.vaadin.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.atmosphere.fragment"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/license.html b/org.eclipse.osbp.runtime.web.feature.vaadin.common/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/pom.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.common/pom.xml
new file mode 100644
index 0000000..31039cc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.vaadin.common</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <description>Common Vaadin stuff that is used by different features.
+</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/src/main/javadoc/README.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.common/src/main/javadoc/README.txt
new file mode 100644
index 0000000..831da7e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/src/main/javadoc/README.txt
@@ -0,0 +1 @@
+Resource folder for javadoc resources. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.common/src/overview.html b/org.eclipse.osbp.runtime.web.feature.vaadin.common/src/overview.html
new file mode 100644
index 0000000..8f862d8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.common/src/overview.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>OSBP runtime web vaadin common feature Overview</TITLE>
+ </HEAD>
+ <BODY>
+ The <b>OSBP ....</b> contains Common Vaadin stuff that is used by different features.
+
+ </BODY>
+</HTML> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/.project b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.project
new file mode 100644
index 0000000..eb812f0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.vaadin.components</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.components/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/build.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.components/build.properties
new file mode 100644
index 0000000..dbd9c44
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ LICENSE.txt,\
+ license.html
+src.includes = license.html,\
+ LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.vaadin.components/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.properties
new file mode 100644
index 0000000..de559d6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.properties
@@ -0,0 +1,169 @@
+###############################################################################
+# Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = Enhanced Vaadin UI Components
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description= Additional UI components like NumberField, DecimalField,...
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml
new file mode 100644
index 0000000..95d8879
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/feature.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.vaadin.components"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.vaadin.components"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.vaadin.components.widget"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin id="org.eclipse.osbp.runtime.web.vaadin.widgetset"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/license.html b/org.eclipse.osbp.runtime.web.feature.vaadin.components/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/pom.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.components/pom.xml
new file mode 100644
index 0000000..0fe0b67
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.vaadin.components</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <description>Contains different fields like NumericField, DecimalField,…
+</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/src/main/javadoc/README.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.components/src/main/javadoc/README.txt
new file mode 100644
index 0000000..831da7e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/src/main/javadoc/README.txt
@@ -0,0 +1 @@
+Resource folder for javadoc resources. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.components/src/overview.html b/org.eclipse.osbp.runtime.web.feature.vaadin.components/src/overview.html
new file mode 100644
index 0000000..86d6072
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.components/src/overview.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>OSBP runtime web vaadin components feature Overview</TITLE>
+ </HEAD>
+ <BODY>
+ The <b>OSBP runtime web vaadin components feature</b> contains different fields like NumericField, DecimalField,…
+
+ </BODY>
+</HTML> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.project b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.project
new file mode 100644
index 0000000..5275583
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.vaadin.databinding</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/build.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/build.properties
new file mode 100644
index 0000000..bfb7f6b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ LICENSE.txt,\
+ license.html
+src.includes = LICENSE.txt,\
+ license.html
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.properties
new file mode 100644
index 0000000..8349558
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.properties
@@ -0,0 +1,169 @@
+###############################################################################
+# Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = Eclipse Databinding for Vaadin
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description=An implementation of eclipse databinding for Vaadin UI elements.
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml
new file mode 100644
index 0000000..4a8f96a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/feature.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.vaadin.databinding"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/license.html b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/pom.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/pom.xml
new file mode 100644
index 0000000..9dece47
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.vaadin.databinding</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <description>An implementation of Eclipse Databinding for Vaadin widgets. Using the VaadinObservables static methods, IObservables can be created and used in Eclipse Databinding.</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/main/javadoc/README.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/main/javadoc/README.txt
new file mode 100644
index 0000000..831da7e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/main/javadoc/README.txt
@@ -0,0 +1 @@
+Resource folder for javadoc resources. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/overview.html b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/overview.html
new file mode 100644
index 0000000..8677952
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.databinding/src/overview.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>OSBP runtime web vaadin databinding Overview</TITLE>
+ </HEAD>
+ <BODY>
+ The <b>OSBP runtime web vaadin databinding</b> contains the databinding functionality ...
+
+ </BODY>
+</HTML> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.project b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.project
new file mode 100644
index 0000000..5e2fe9a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.feature.vaadin.osgi</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/LICENSE.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/build.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/build.properties
new file mode 100644
index 0000000..bfb7f6b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/build.properties
@@ -0,0 +1,6 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ LICENSE.txt,\
+ license.html
+src.includes = LICENSE.txt,\
+ license.html
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/epl-v10.html b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), 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 OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.properties b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.properties
new file mode 100644
index 0000000..19bbc0b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.properties
@@ -0,0 +1,169 @@
+###############################################################################
+# Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Florian Pirchner - initial API and implementation
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName = Vaadin OSGi Wrapper
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse OSBP
+
+# "description" property - description of the feature
+description=Defines an OSGi bridge to run Vaadin 7 as a OSBP VaadinApplication on an OSGi-HttpService.
+
+# "updateSiteName" property - label for the update site
+updateSiteName=
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2012, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml
new file mode 100644
index 0000000..696de82
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/feature.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<feature
+ id="org.eclipse.osbp.runtime.web.feature.vaadin.osgi"
+ label="%featureName"
+ version="0.9.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.osbp.runtime.web.vaadin.osgi"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+</feature>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/license.html b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/license.html
new file mode 100644
index 0000000..6e579a5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/license.html
@@ -0,0 +1,164 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse
+ Foundation is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also
+ available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code,
+documentation and other files maintained in the Eclipse Foundation
+source code
+ repository ("Repository") in software modules ("Modules") and made
+available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to
+facilitate delivering, extending, and upgrading the Content. Typical
+modules may include plug-ins ("Plug-ins"), plug-in fragments
+("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&#8482; ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or
+Fragments and associated material. Each Feature may be packaged as a
+sub-directory in a directory named "features". Within a Feature, files
+named "feature.xml" may contain a list of the names and version numbers
+of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included
+Features"). Within a Feature, files named "feature.xml" may contain a
+list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be
+contained in files named "about.html" ("Abouts"). The terms and
+conditions governing Features and
+Included Features should be contained in files named "license.html"
+("Feature Licenses"). Abouts and Feature Licenses may be located in any
+ directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is
+installed using the Provisioning Technology (as defined below), you must
+ agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the
+Feature Update License should either provide you with the terms and
+conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be
+found in the "license" property of files named "feature.properties"
+found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the
+terms and conditions (or references to such terms and conditions) that
+govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.
+ SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
+CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
+or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions
+govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software,
+examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of
+allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This
+capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about
+packaging Installable Software is available at <a href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install
+ Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to
+ be presented to, and accepted by, the users of the Provisioning
+Technology
+ in accordance with the Specification. By using Provisioning
+Technology in such a manner and making it available in accordance with
+the
+ Specification, you further acknowledge your agreement to, and the
+acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in
+which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing,
+extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology
+may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user
+the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable
+Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable
+Software Agreement must inform the user of the terms and conditions that
+ govern
+ the Installable Software and must solicit acceptance by the end
+user in the manner prescribed in such Installable Software Agreement.
+Upon such
+ indication of agreement by the user, the provisioning Technology
+will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are
+ currently may have restrictions on the import, possession, and use,
+and/or re-export to
+ another country, of encryption software. BEFORE using any encryption
+software, please check the country's laws, regulations and policies
+concerning the import,
+ possession, or use, and re-export of encryption software, to see if
+this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/pom.xml b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/pom.xml
new file mode 100644
index 0000000..1ad8e0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.feature.vaadin.osgi</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <version>${tychoExtrasVersion}</version>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <labelSuffix> (source)</labelSuffix>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <!-- workaround while bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=398250
+ is not fixed -->
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <description>This feature contains implementations to run Vaadin UIs using the OSGi-HttpService based on DS (Declarative Services).</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/main/javadoc/README.txt b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/main/javadoc/README.txt
new file mode 100644
index 0000000..831da7e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/main/javadoc/README.txt
@@ -0,0 +1 @@
+Resource folder for javadoc resources. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/overview.html b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/overview.html
new file mode 100644
index 0000000..57e9743
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.feature.vaadin.osgi/src/overview.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE>OSBP runtime web vaadin osgi feature Overview</TITLE>
+ </HEAD>
+ <BODY>
+ The <b>OSBP runtime web vaadin osgi feature</b> contains implementations to run Vaadin UIs using the OSGi-HttpService based on DS (Declarative Services).
+
+ </BODY>
+</HTML> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.target/.project b/org.eclipse.osbp.runtime.web.target/.project
new file mode 100644
index 0000000..3060072
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.target/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.target</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.target/LICENSE.txt b/org.eclipse.osbp.runtime.web.target/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.target/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target b/org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target
new file mode 100644
index 0000000..1c8de48
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.target/org.eclipse.osbp.runtime.web.target.kepler.target
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target includeMode="feature" name="org.eclipse.osbp.runtime.web.target.kepler" sequenceNumber="36">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.httpcomponents.httpcore.source" version="4.1.4.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpcore" version="4.1.4.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpcore.nio" version="4.1.0.v201101201700"/>
+<unit id="org.apache.httpcomponents.httpcore.nio.source" version="4.1.0.v201101201700"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.httpcomponents.httpclient" version="4.1.2.v201203221030"/>
+<unit id="org.apache.httpcomponents.httpclient.source" version="4.1.2.v201203221030"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.feature.group" version="0.0.1.201406272004"/>
+<repository location="http://lun.lunifera.org/downloads/p2/ecview/nightly/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.equinox.sdk.feature.group" version="3.9.0.v20140221-1852"/>
+<unit id="org.eclipse.platform.sdk" version="4.3.2.M20140221-1700"/>
+<unit id="org.eclipse.emf.sdk.feature.group" version="2.9.2.v20140203-1126"/>
+<repository location="http://download.eclipse.org/releases/kepler"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.junit.source" version="4.10.0.v4_10_0_v20120426-0900"/>
+<unit id="org.junit" version="4.10.0.v4_10_0_v20120426-0900"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.security.shiro.feature.group" version="1.2.2"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.feature.group" version="0.0.1.201405120903"/>
+<unit id="org.eclipse.osbp.dependencies.feature.assert-utilities.feature.group" version="1.2.2"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.source.feature.group" version="0.0.1.201405120903"/>
+<unit id="org.eclipse.osbp.dependencies.feature.vaadin.feature.group" version="7.1.9"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.apache.commons.math" version="2.1.0.v201105210652"/>
+<unit id="org.apache.commons.lang" version="2.6.0.v201205030909"/>
+<unit id="org.apache.commons.collections" version="3.2.0.v201005080500"/>
+<unit id="org.apache.commons.beanutils" version="1.8.0.v201205091237"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dsl.feature.entities.headless.feature.group" version="0.0.1.201406261127"/>
+<unit id="org.eclipse.osbp.dsl.feature.dto.headless.source.feature.group" version="0.0.1.201406261127"/>
+<unit id="org.eclipse.osbp.dsl.feature.entities.headless.source.feature.group" version="0.0.1.201406261127"/>
+<unit id="org.eclipse.osbp.dsl.feature.common.headless.feature.group" version="0.0.1.201406261127"/>
+<unit id="org.eclipse.osbp.dsl.feature.common.headless.source.feature.group" version="0.0.1.201406261127"/>
+<unit id="org.eclipse.osbp.dsl.feature.dto.headless.feature.group" version="0.0.1.201406261127"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/kepler/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="false" type="InstallableUnit">
+<unit id="org.eclipse.xtext.redist.feature.group" version="2.6.1.v201406120726"/>
+<unit id="org.eclipse.xtext.ui.feature.group" version="2.6.1.v201406120726"/>
+<unit id="org.eclipse.xtext.runtime.feature.group" version="2.6.1.v201406120726"/>
+<unit id="org.eclipse.xtext.xbase.feature.group" version="2.6.1.v201406120726"/>
+<unit id="org.eclipse.xtext.examples.feature.group" version="2.6.1.v201406120726"/>
+<unit id="org.eclipse.xtext.sdk.feature.group" version="2.6.1.v201406120726"/>
+<unit id="org.eclipse.xtext.docs.feature.group" version="2.6.1.v201406120726"/>
+<repository location="http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases"/>
+</location>
+</locations>
+</target>
diff --git a/org.eclipse.osbp.runtime.web.target/pom.xml b/org.eclipse.osbp.runtime.web.target/pom.xml
new file mode 100644
index 0000000..0acc17f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.target/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.target</artifactId>
+ <packaging>pom</packaging>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.testbase/.project b/org.eclipse.osbp.runtime.web.testbase/.project
new file mode 100644
index 0000000..62b5601
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.testbase</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.testbase/LICENSE.txt b/org.eclipse.osbp.runtime.web.testbase/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ae4e383
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/MANIFEST.MF
@@ -0,0 +1,37 @@
+Manifest-Version: 1.0
+Bundle-ActivationPolicy: lazy
+Built-By: root
+Bundle-Name: org.eclipse.osbp.runtime.web.testbase
+Created-By: ApacheMaven
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.external.org.slf4j;bundle-version="1.6.1",
+ com.vaadin.client-compiled;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.themes;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.push;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.equinox.http.jetty;bundle-version="3.0.100",
+ org.eclipse.jetty.http;bundle-version="8.1.11",
+ org.eclipse.jetty.io;bundle-version="8.1.11",
+ org.eclipse.jetty.security;bundle-version="8.1.11",
+ org.eclipse.jetty.server;bundle-version="8.1.11",
+ org.eclipse.jetty.servlet;bundle-version="8.1.11",
+ org.eclipse.jetty.util;bundle-version="8.1.11",
+ org.eclipse.jetty.websocket;bundle-version="8.1.11",
+ org.eclipse.equinox.http.servlet;bundle-version="1.1.400",
+ org.jsoup;bundle-version="1.8.3"
+Build-Jdk: 1.7.0_15
+Bundle-Vendor: Eclipse OSBP
+Bundle-Version: 0.9.0.qualifier
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.osbp.runtime.web.testbase.Activator
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.framework.wiring;version="1.1.0",
+ org.osgi.service.http;version="1.2.1",
+ org.osgi.util.tracker;version="1.5.1"
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.testbase
+Archiver-Version: PlexusArchiver
+Export-Package: org.eclipse.osbp.runtime.web.testbase.api;version="0.9.0"
+
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.html b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.ini b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.mappings b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.properties b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.properties
new file mode 100644
index 0000000..92ec702
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.lunifera.runtime.web.testbase
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.properties b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.properties
new file mode 100644
index 0000000..d66b8c5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed Jul 31 20:09:15 CEST 2013
+version=0.0.1-SNAPSHOT
+groupId=org.eclipse.osbp.runtime.web
+artifactId=org.eclipse.osbp.runtime.web.testbase
diff --git a/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.xml b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.xml
new file mode 100644
index 0000000..613b75b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.testbase/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.parent</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>../org.eclipse.osbp.runtime.web.parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.testbase</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.testbase/build.properties b/org.eclipse.osbp.runtime.web.testbase/build.properties
new file mode 100644
index 0000000..b107977
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/build.properties
@@ -0,0 +1,3 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/Activator.java b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/Activator.java
new file mode 100644
index 0000000..1fbacd6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/Activator.java
@@ -0,0 +1,174 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.testbase;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.servlet.ServletException;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+/**
+ * Activator is used by OSGi framework to notify about the start and stop of the
+ * bundle. The activator will look for the HttpService and registers the vaadin
+ * servlet at it.
+ */
+public class Activator implements BundleActivator,
+ ServiceTrackerCustomizer<HttpService, HttpService>, BundleListener {
+
+ private static final String LUNIFERA_TESTBASE = "OSBP-Testbase";
+ public static final String URI_ALIAS = "/";
+ private static BundleContext context;
+ private static Activator instance;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Returns all registered test base bundles.
+ *
+ * @return
+ */
+ public static List<Bundle> getTestBaseBundles() {
+ return new ArrayList<Bundle>(instance.testBases);
+ }
+
+ // used to track the HttpService
+ private ServiceTracker<HttpService, HttpService> tracker;
+ // used to register servlets
+ private HttpService httpService;
+ private ResourceProvider resourceProvider;
+ private List<Bundle> testBases = new ArrayList<Bundle>();
+
+ //
+ // Helper methods to get an instance of the http service
+ //
+ @Override
+ public HttpService addingService(ServiceReference<HttpService> reference) {
+ httpService = context.getService(reference);
+
+ try {
+ // register the servlet at the http service
+ httpService.registerServlet(URI_ALIAS, new TestbaseVaadinServlet(),
+ null, resourceProvider);
+ } catch (ServletException e) {
+ e.printStackTrace();
+ } catch (NamespaceException e) {
+ e.printStackTrace();
+ }
+
+ return httpService;
+ }
+
+ @Override
+ public void removedService(ServiceReference<HttpService> reference,
+ HttpService service) {
+ // unregister the servlet from the http service
+ httpService.unregister("URI_ALIAS");
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<HttpService> reference,
+ HttpService service) {
+
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ instance = this;
+
+ resourceProvider = new ResourceProvider();
+
+ handleStartedBundles(context);
+
+ // register this instance as a bundle listener to an reference to all
+ // vaadin bundles. Used to find the static resources.
+ bundleContext.addBundleListener(this);
+
+ // Start a HttpService-Tracker to get an instance of HttpService
+ tracker = new ServiceTracker<HttpService, HttpService>(bundleContext,
+ HttpService.class, this);
+ tracker.open();
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ // close the HttpService-tracker
+ tracker.close();
+ tracker = null;
+
+ resourceProvider = null;
+
+ bundleContext.removeBundleListener(this);
+
+ instance = null;
+ Activator.context = null;
+ }
+
+ /**
+ * Tries to find proper started bundles and adds them to resource provider.
+ * Since bundle changed listener will not find them.
+ *
+ * @param context
+ */
+ protected void handleStartedBundles(BundleContext context) {
+ for (Bundle bundle : context.getBundles()) {
+ String name = bundle.getSymbolicName();
+ if (bundle.getState() == Bundle.ACTIVE
+ && name.startsWith("com.vaadin")) {
+ resourceProvider.add(bundle);
+ } else {
+ Enumeration<String> keys = bundle.getHeaders().keys();
+ while (keys.hasMoreElements()) {
+ String key = keys.nextElement();
+ if (key.equals(LUNIFERA_TESTBASE)) {
+ testBases.add(bundle);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void bundleChanged(BundleEvent event) {
+ Bundle bundle = event.getBundle();
+ // tracks the starting and stopping of vaadin bundles. If a bundle is a
+ // vaadin bundle it will be added to the resource provider for lookups.
+ String name = event.getBundle().getSymbolicName();
+ if (name.startsWith("com.vaadin")) {
+ if (event.getType() == BundleEvent.STARTED) {
+ resourceProvider.add(event.getBundle());
+ } else if (event.getType() == BundleEvent.STOPPED) {
+ resourceProvider.remove(event.getBundle());
+ }
+ } else {
+ Enumeration<String> keys = bundle.getHeaders().keys();
+ while (keys.hasMoreElements()) {
+ String key = keys.nextElement();
+ if (key.equals(LUNIFERA_TESTBASE)) {
+ testBases.add(bundle);
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/ResourceProvider.java b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/ResourceProvider.java
new file mode 100644
index 0000000..4e6aafb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/ResourceProvider.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.testbase;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
+/**
+ * Resource provider is responsible to look for resources requested by the
+ * HttpService. Therefore it uses the classpath of registered bundles.
+ */
+public class ResourceProvider implements HttpContext {
+
+ private List<Bundle> resources = new ArrayList<Bundle>();
+
+ @Override
+ public URL getResource(String uri) {
+ URL resource = null;
+ // iterate over the vaadin bundles and try to find the requested
+ // resource
+ for (Bundle bundle : resources) {
+ resource = bundle.getResource(uri);
+ if (resource != null) {
+ break;
+ }
+ }
+ return resource;
+ }
+
+ /**
+ * Adds a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void add(Bundle bundle) {
+ if(!resources.contains(bundle)){
+ resources.add(bundle);
+ }
+ }
+
+ /**
+ * Removes a bundle that may potentially contain a requested resource.
+ *
+ * @param bundle
+ */
+ public void remove(Bundle bundle) {
+ resources.remove(bundle);
+ }
+
+ @Override
+ public String getMimeType(String arg0) {
+ return null;
+ }
+
+ @Override
+ public boolean handleSecurity(HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+ return true;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseUI.java b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseUI.java
new file mode 100644
index 0000000..8d7fcd2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseUI.java
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.testbase;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.osbp.runtime.web.testbase.api.ITestPart;
+import org.eclipse.osbp.runtime.web.testbase.api.Testable;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.wiring.BundleWiring;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.Page;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.themes.Reindeer;
+
+@SuppressWarnings("serial")
+@Theme(Reindeer.THEME_NAME)
+@Push
+public class TestbaseUI extends UI {
+ private Map<String, ITestPart> parts = new HashMap<String, ITestPart>();
+
+ private CssLayout content = new CssLayout();
+
+ @Override
+ protected void init(VaadinRequest request) {
+ initializeParts();
+ setContent(content);
+ content.addComponent(new Label("Started properly"));
+
+ getPage().addUriFragmentChangedListener(
+ new Page.UriFragmentChangedListener() {
+ public void uriFragmentChanged(
+ Page.UriFragmentChangedEvent source) {
+ showTest(source.getUriFragment());
+ }
+ });
+ }
+
+ /**
+ * Shows the test for the given uri fragment
+ *
+ * @param uriFragment
+ */
+ protected void showTest(final String uriFragment) {
+ accessSynchronously(new Runnable() {
+ @Override
+ public void run() {
+ content.removeAllComponents();
+ if (parts.containsKey(uriFragment)) {
+ content.addComponent(parts.get(uriFragment)
+ .getTestComponent());
+ }
+ }
+ });
+ }
+
+ /**
+ * Is called to initialize all parts that should possibly become tested.
+ */
+ protected void initializeParts() {
+ for (Bundle bundle : Activator.getTestBaseBundles()) {
+ BundleWiring wiring = bundle.adapt(BundleWiring.class);
+ for (String name : wiring.listResources("target/classes/", "*.class",
+ BundleWiring.FINDENTRIES_RECURSE)) {
+ try {
+ Class<?> clazz = bundle.loadClass(name.replace("target/classes/", "").replace("/", ".").replace(".class", ""));
+ if (ITestPart.class.isAssignableFrom(clazz)
+ && clazz.isAnnotationPresent(Testable.class)) {
+ Testable annotation = clazz
+ .getAnnotation(Testable.class);
+ parts.put(annotation.uriFragment(),
+ (ITestPart) clazz.newInstance());
+ }
+ } catch (ClassNotFoundException e) {
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseVaadinServlet.java b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseVaadinServlet.java
new file mode 100644
index 0000000..ac2db13
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/TestbaseVaadinServlet.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.testbase;
+
+import com.vaadin.annotations.VaadinServletConfiguration;
+import com.vaadin.server.VaadinServlet;
+
+/**
+ * An implementation of VaadinServlet that uses SimpleUI as its base UI.
+ */
+@SuppressWarnings("serial")
+@VaadinServletConfiguration(ui = TestbaseUI.class, productionMode = false)
+public class TestbaseVaadinServlet extends VaadinServlet {
+
+}
diff --git a/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/ITestPart.java b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/ITestPart.java
new file mode 100644
index 0000000..792d755
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/ITestPart.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.testbase.api;
+
+import com.vaadin.ui.Component;
+
+/**
+ * Vaadin UI components that should become tested by selenium must implement
+ * that interface. It will become hooked by the TestbaseUI and new instances of
+ * the test component are requested.
+ *
+ * Subclasses that should become tested must also be annotated with the Testable
+ * annotation.
+ */
+public interface ITestPart {
+
+ /**
+ * Returns the vaadin component that will be displayed if the fragment is
+ * addressed. Fragment is specified in the Testable annotation.
+ *
+ * @return
+ */
+ Component getTestComponent();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/Testable.java b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/Testable.java
new file mode 100644
index 0000000..59c273a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.testbase/src/org/eclipse/osbp/runtime/web/testbase/api/Testable.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.testbase.api;
+
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { TYPE })
+public @interface Testable {
+ /**
+ * Defines the URI fragment that is used to access the test component. For
+ * instance "TextFieldTest". It may be addressed by
+ * "localhost:8080/testapplication#TextFieldTest"
+ *
+ * @return
+ */
+ String uriFragment();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/.project b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.project
new file mode 100644
index 0000000..349e9e6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/.project
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.common.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.common.tests/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f7fce71
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.common.tests
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.common.tests
+Bundle-Version: 0.9.0.qualifier
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.equinox.preferences;bundle-version="3.5.0",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse OSBP
+Service-Component: OSGI-INF/contextRegistryHelper.xml
+Import-Package: org.eclipse.osgi.service.datalocation;version="1.3.0",
+ org.osgi.framework;version="1.7.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.osbp.runtime.web.vaadin.common.tests.Activator
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/OSGI-INF/contextRegistryHelper.xml b/org.eclipse.osbp.runtime.web.vaadin.common.tests/OSGI-INF/contextRegistryHelper.xml
new file mode 100644
index 0000000..3d50da9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/OSGI-INF/contextRegistryHelper.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.vaadin.common.tests.contextregistryhelper">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.common.tests.ContextRegistryHelper"/>
+ <reference bind="setRegistry" cardinality="1..1" interface="org.eclipse.osbp.runtime.web.common.IWebContextRegistry" name="webContextRegistry" policy="static" target="(osbp.web.common.context.uikit=vaadin)" unbind="unsetRegistry"/>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/build.properties b/org.eclipse.osbp.runtime.web.vaadin.common.tests/build.properties
new file mode 100644
index 0000000..255b1af
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/build.properties
@@ -0,0 +1,5 @@
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
+source.. = src/
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.common.tests/pom.xml
new file mode 100644
index 0000000..ae144c7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.common.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common.tests/src/org/eclipse/osbp/runtime/web/vaadin/common/tests/Activator.java b/org.eclipse.osbp.runtime.web.vaadin.common.tests/src/org/eclipse/osbp/runtime/web/vaadin/common/tests/Activator.java
new file mode 100644
index 0000000..664679e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common.tests/src/org/eclipse/osbp/runtime/web/vaadin/common/tests/Activator.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.common.tests;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ public static BundleContext context;
+
+ // private static boolean locationRegistered;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ }
+
+ /**
+ * Registers the user area default location as an OSGi service.
+ *
+ * @throws IOException
+ * @throws MalformedURLException
+ */
+ public static void registerUserLocation() throws IOException,
+ MalformedURLException {
+ // if (locationRegistered) {
+ // return;
+ // }
+ // BasicLocation location = new BasicLocation("", null, false, null);
+ // location.set(new File(System.getProperty("user.home"),
+ // "osbp_test")
+ // .toURL(), false);
+ // Hashtable<String, Object> properties = new Hashtable<String,
+ // Object>();
+ // properties.put("type", "osgi.user.area");
+ // context.registerService(Location.class, location, properties);
+ // locationRegistered = true;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/.project b/org.eclipse.osbp.runtime.web.vaadin.common/.project
new file mode 100644
index 0000000..71b78d9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.common/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9604984
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/META-INF/MANIFEST.MF
@@ -0,0 +1,41 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.common
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.common
+Bundle-Version: 0.9.0.qualifier
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.osbp.runtime.common.dispose;version="0.9.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.cm;version="1.4.0",
+ org.osgi.service.component;version="1.2.0",
+ org.osgi.service.component.annotations;version="1.2.0",
+ org.osgi.service.http;version="1.2.1",
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.service.prefs;version="1.1.1",
+ org.osgi.util.tracker;version="1.5.1"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.osbp.runtime.web.vaadin.common;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.converter;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.data;version="0.9.0";
+ uses:="org.eclipse.osbp.dsl.dto.lib.services,
+ org.eclipse.osbp.runtime.web.vaadin.databinding.container,
+ com.vaadin.data,
+ com.vaadin.data.util",
+ org.eclipse.osbp.runtime.web.vaadin.common.data.filter;version="0.9.0";uses:="com.vaadin.data,com.vaadin.data.util.filter",
+ org.eclipse.osbp.runtime.web.vaadin.common.resource;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.resource.impl;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.services.filter;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.sharedState;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.shortcuts;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.common.validator;version="0.9.0"
+Bundle-Vendor: Eclipse OSBP
+Require-Bundle: com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.dsl.dto.lib;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.xtext.xbase.lib;bundle-version="[2.7.3,2.8.0)";resolution:=optional,
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)",
+ org.slf4j.api;bundle-version="1.7.2",
+ org.apache.commons.lang3
+Service-Component: OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider.xml,
+ OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate.xml
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate.xml b/org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate.xml
new file mode 100644
index 0000000..520b6a4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulDelegatingDtoSearchServiceFactoryDelegate"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate"/>
+ </service>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider.xml b/org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider.xml
new file mode 100644
index 0000000..b11e3c4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.common.resource.impl.ThemeResourceProvider"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider"/>
+ </service>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/about.html b/org.eclipse.osbp.runtime.web.vaadin.common/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/about.ini b/org.eclipse.osbp.runtime.web.vaadin.common/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.common/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/about.properties b/org.eclipse.osbp.runtime.web.vaadin.common/about.properties
new file mode 100644
index 0000000..a9443cd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.common
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/build.properties b/org.eclipse.osbp.runtime.web.vaadin.common/build.properties
new file mode 100644
index 0000000..d9e274a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/build.properties
@@ -0,0 +1,8 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ OSGI-INF/,\
+ LICENSE.txt
+source.. = src/,\
+ xtend-gen/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.common/pom.xml
new file mode 100644
index 0000000..95df111
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.common</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <description>Vaadin stuff that is used by different bundles.</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/Constants.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/Constants.java
new file mode 100644
index 0000000..e66cf62
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/Constants.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common;
+
+public class Constants {
+
+ /**
+ * OSGi property component.factory for the vaadin UI (tab sheet). The
+ * vaadin.ui.class name is part of the factory name and putted after the /.
+ * The class name is required for lazy loading issues.
+ * <p>
+ * Example:
+ *
+ * factory=
+ * "org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.web.vaadin.example.Vaadin7DemoUI"
+ */
+ public static final String OSGI_COMP_FACTORY_VAADIN_UI = "org.eclipse.osbp.web.vaadin.UI";
+
+ /**
+ * The prefix of the factory component name before the UI class name starts. <br>
+ * UI-Class name: org.eclipse.osbp.web.vaadin.example.Vaadin7DemoUI<br>
+ * Factory name: org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.web.vaadin.example.
+ * Vaadin7DemoUI
+ */
+ public static final String PREFIX_UI_CLASS = OSGI_COMP_FACTORY_VAADIN_UI
+ + "/";
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/converter/StringToFormattedNumberConverter.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/converter/StringToFormattedNumberConverter.java
new file mode 100644
index 0000000..57eb5dc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/converter/StringToFormattedNumberConverter.java
@@ -0,0 +1,100 @@
+package org.eclipse.osbp.runtime.web.vaadin.common.converter;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+
+import com.vaadin.data.util.converter.AbstractStringToNumberConverter;
+
+@SuppressWarnings("serial")
+public class StringToFormattedNumberConverter extends
+ AbstractStringToNumberConverter<Number> {
+ private final String format;
+ private final Class<? extends Number> resultType;
+
+ public StringToFormattedNumberConverter(String format,
+ Class<? extends Number> resultType) {
+ this.format = format;
+ this.resultType = resultType;
+ }
+
+ @Override
+ public String convertToPresentation(Number value,
+ Class<? extends String> targetType, Locale locale)
+ throws ConversionException {
+ if (value == null) {
+ return null;
+ }
+
+ return getFormat(locale).format(value);
+ }
+
+ @Override
+ public Number convertToModel(String value,
+ Class<? extends Number> targetType, Locale locale)
+ throws ConversionException {
+ Number n = convertToNumber(value, targetType, locale);
+ return n;
+ }
+
+ @Override
+ protected Number convertToNumber(String value,
+ Class<? extends Number> targetType, Locale locale)
+ throws ConversionException {
+ Number number = super.convertToNumber(value, targetType, locale);
+ return number == null ? number
+ : convertToResultType(number, resultType);
+ }
+
+ protected DecimalFormat getFormat(Locale locale) {
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+ DecimalFormat decimalFormat = null;
+ try {
+ decimalFormat = new DecimalFormat(
+ StringEscapeUtils.unescapeHtml4(format),
+ new DecimalFormatSymbols(locale));
+ } catch (IllegalArgumentException e) {
+ throw new ConversionException(String.format(
+ "formatter %s is invalid for decimal numbers: %s", format,
+ e.toString()));
+ }
+
+ return decimalFormat;
+ }
+
+ @Override
+ public Class<Number> getModelType() {
+ return Number.class;
+ }
+
+ public static Number convertToResultType(final Number number,
+ final Class<? extends Number> targetClass) {
+ if (Integer.class.isAssignableFrom(targetClass)
+ || Integer.TYPE.isAssignableFrom(targetClass)) {
+ return number.intValue();
+ } else if (Long.class.isAssignableFrom(targetClass)
+ || Long.TYPE.isAssignableFrom(targetClass)) {
+ return number.longValue();
+ } else if (Double.class.isAssignableFrom(targetClass)
+ || Double.TYPE.isAssignableFrom(targetClass)) {
+ return number.doubleValue();
+ } else if (Float.class.isAssignableFrom(targetClass)
+ || Float.TYPE.isAssignableFrom(targetClass)) {
+ return number.floatValue();
+ } else if (BigDecimal.class.isAssignableFrom(targetClass)) {
+ return new BigDecimal(number.doubleValue());
+ } else if (BigInteger.class.isAssignableFrom(targetClass)) {
+ return new BigInteger(String.valueOf(number.longValue()));
+ } else if (Short.class.isAssignableFrom(targetClass)
+ || Short.TYPE.isAssignableFrom(targetClass)) {
+ return number.shortValue();
+ }
+ return number;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java
new file mode 100644
index 0000000..4fc1b00
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/AbstractDeepResolvingBeanContainer.java
@@ -0,0 +1,1015 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ * Contributors:
+ * Florian Pirchner - copied from vaadin and changed implementations to meet requirements
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.container.IEnhancedFilterableContainer;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.PropertySetChangeNotifier;
+import com.vaadin.data.Container.SimpleFilterable;
+import com.vaadin.data.Container.Sortable;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.Property.ValueChangeNotifier;
+import com.vaadin.data.util.AbstractInMemoryContainer;
+import com.vaadin.data.util.ItemSorter;
+import com.vaadin.data.util.MethodProperty.MethodException;
+import com.vaadin.data.util.NestedMethodProperty;
+import com.vaadin.data.util.NestedPropertyDescriptor;
+import com.vaadin.data.util.VaadinPropertyDescriptor;
+import com.vaadin.data.util.filter.SimpleStringFilter;
+import com.vaadin.data.util.filter.UnsupportedFilterException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An abstract base class for in-memory containers for JavaBeans.
+ *
+ * <p>
+ * The properties of the container are determined automatically by introspecting
+ * the used JavaBean class and explicitly adding or removing properties is not
+ * supported. Only beans of the same type can be added to the container.
+ *
+ *
+ * <p>
+ * Subclasses should implement any public methods adding items to the container,
+ * typically calling the protected methods {@link #addItem(Object, Object)},
+ * {@link #addItemAfter(Object, Object, Object)} and
+ * {@link #addItemAt(int, Object, Object)}.
+ *
+ *
+ * <p>
+ * Additions ECView:<br>
+ * Since several methods and constructors are package protected in com.vaadin,
+ * the whole class was copied.<br>
+ * The container implements {@link IEnhancedFilterableContainer}. This interface
+ * provides the unfiltered item ids.<br>
+ * The container also uses {@link DeepResolvingBeanItem}. So it can filter for
+ * nested properties that are not visibile.
+ *
+ * @param <IDTYPE>
+ * The type of the item identifier
+ * @param <BEANTYPE>
+ * The type of the Bean
+ *
+ * @since 6.5
+ */
+@SuppressWarnings("serial")
+public abstract class AbstractDeepResolvingBeanContainer<IDTYPE, BEANTYPE>
+ extends
+ AbstractInMemoryContainer<IDTYPE, String, DeepResolvingBeanItem<BEANTYPE>>
+ implements ILazyRefreshFilterable, SimpleFilterable, Sortable,
+ ValueChangeListener, PropertySetChangeNotifier,
+ IEnhancedFilterableContainer<IDTYPE>, INestedPropertyAble<BEANTYPE> {
+
+ /**
+ * Resolver that maps beans to their (item) identifiers, removing the need
+ * to explicitly specify item identifiers when there is no need to customize
+ * this.
+ *
+ * Note that beans can also be added with an explicit id even if a resolver
+ * has been set.
+ *
+ * @param <IDTYPE>
+ * the generic type
+ * @param <BEANTYPE>
+ * the generic type
+ * @since 6.5
+ */
+ public static interface BeanIdResolver<IDTYPE, BEANTYPE> extends
+ Serializable {
+
+ /**
+ * Return the item identifier for a bean.
+ *
+ * @param bean
+ * the bean
+ * @return the id for bean
+ */
+ public IDTYPE getIdForBean(BEANTYPE bean);
+ }
+
+ /**
+ * A item identifier resolver that returns the value of a bean property.
+ *
+ * The bean must have a getter for the property, and the getter must return
+ * an object of type IDTYPE.
+ */
+ protected class PropertyBasedBeanIdResolver implements
+ BeanIdResolver<IDTYPE, BEANTYPE> {
+
+ /** The property id. */
+ private final Object propertyId;
+
+ /**
+ * Instantiates a new property based bean id resolver.
+ *
+ * @param propertyId
+ * the property id
+ */
+ public PropertyBasedBeanIdResolver(Object propertyId) {
+ if (propertyId == null) {
+ throw new IllegalArgumentException(
+ "Property identifier must not be null");
+ }
+ this.propertyId = propertyId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.AbstractDeepResolvingBeanContainer.BeanIdResolver#getIdForBean(java.lang.Object)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public IDTYPE getIdForBean(BEANTYPE bean)
+ throws IllegalArgumentException {
+ VaadinPropertyDescriptor<BEANTYPE> pd = model.get(propertyId);
+ if (null == pd) {
+ throw new IllegalStateException("Property " + propertyId
+ + " not found");
+ }
+ try {
+ Property<IDTYPE> property = (Property<IDTYPE>) pd
+ .createProperty(bean);
+ return property.getValue();
+ } catch (MethodException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ }
+
+ /**
+ * The resolver that finds the item ID for a bean, or null not to use
+ * automatic resolving.
+ *
+ * Methods that add a bean without specifying an ID must not be called if no
+ * resolver has been set.
+ */
+ private BeanIdResolver<IDTYPE, BEANTYPE> beanIdResolver = null;
+
+ /**
+ * Maps all item ids in the container (including filtered) to their
+ * corresponding DeepResolvingBeanItem.
+ */
+ private final Map<IDTYPE, DeepResolvingBeanItem<BEANTYPE>> itemIdToItem = new HashMap<IDTYPE, DeepResolvingBeanItem<BEANTYPE>>();
+
+ /**
+ * The type of the beans in the container.
+ */
+ private final Class<? super BEANTYPE> type;
+
+ /**
+ * A description of the properties found in beans of type {@link #type}.
+ * Determines the property ids that are present in the container.
+ */
+ private LinkedHashMap<String, VaadinPropertyDescriptor<BEANTYPE>> model;
+
+ /**
+ * Constructs a {@code AbstractBeanContainer} for beans of the given type.
+ *
+ * @param type
+ * the type of the beans that will be added to the container.
+ * @throws IllegalArgumentException
+ * If {@code type} is null
+ */
+ @SuppressWarnings("unchecked")
+ protected AbstractDeepResolvingBeanContainer(Class<? super BEANTYPE> type) {
+ if (type == null) {
+ throw new IllegalArgumentException(
+ "The bean type passed to AbstractBeanContainer must not be null");
+ }
+ this.type = type;
+ model = DeepResolvingBeanItem
+ .getPropertyDescriptors((Class<BEANTYPE>) type);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#getType(java.lang.Object)
+ */
+ @Override
+ public Class<?> getType(Object propertyId) {
+ return model.get(propertyId).getPropertyType();
+ }
+
+ /**
+ * Create a DeepResolvingBeanItem for a bean using pre-parsed bean metadata
+ * (based on {@link #getBeanType()}).
+ *
+ * @param bean
+ * the bean
+ * @return created {@link DeepResolvingBeanItem} or null if bean is null
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> createBeanItem(BEANTYPE bean) {
+ return bean == null ? null : new DeepResolvingBeanItem<BEANTYPE>(bean,
+ model);
+ }
+
+ /**
+ * Returns the type of beans this Container can contain.
+ *
+ * This comes from the bean type constructor parameter, and bean metadata
+ * (including container properties) is based on this.
+ *
+ * @return the bean type
+ */
+ public Class<? super BEANTYPE> getBeanType() {
+ return type;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#getContainerPropertyIds()
+ */
+ @Override
+ public Collection<String> getContainerPropertyIds() {
+ return model.keySet();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#removeAllItems()
+ */
+ @Override
+ public boolean removeAllItems() {
+ int origSize = size();
+
+ internalRemoveAllItems();
+
+ // detach listeners from all Items
+ for (Item item : itemIdToItem.values()) {
+ removeAllValueChangeListeners(item);
+ }
+ itemIdToItem.clear();
+
+ // fire event only if the visible view changed, regardless of whether
+ // filtered out items were removed or not
+ if (origSize != 0) {
+ fireItemSetChange();
+ }
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#getItem(java.lang.Object)
+ */
+ @Override
+ public DeepResolvingBeanItem<BEANTYPE> getItem(Object itemId) {
+ // TODO return only if visible?
+ return getUnfilteredItem(itemId);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#getUnfilteredItem(java.lang.Object)
+ */
+ @Override
+ protected DeepResolvingBeanItem<BEANTYPE> getUnfilteredItem(Object itemId) {
+ return itemIdToItem.get(itemId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#getItemIds()
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<IDTYPE> getItemIds() {
+ return (List<IDTYPE>) super.getItemIds();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object,
+ * java.lang.Object)
+ */
+ @Override
+ public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ Item item = getItem(itemId);
+ if (item == null) {
+ return null;
+ }
+ return item.getItemProperty(propertyId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container#removeItem(java.lang.Object)
+ */
+ @Override
+ public boolean removeItem(Object itemId) {
+ // TODO should also remove items that are filtered out
+ int origSize = size();
+ Item item = getItem(itemId);
+ int position = indexOfId(itemId);
+
+ if (internalRemoveItem(itemId)) {
+ // detach listeners from Item
+ removeAllValueChangeListeners(item);
+
+ // remove item
+ itemIdToItem.remove(itemId);
+
+ // fire event only if the visible view changed, regardless of
+ // whether filtered out items were removed or not
+ if (size() != origSize) {
+ fireItemRemoved(position, itemId);
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Re-filter the container when one of the monitored properties changes.
+ *
+ * @param event
+ * the event
+ */
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ // if a property that is used in a filter is changed, refresh filtering
+ filterAll();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.data.Container.Filterable#addContainerFilter(java.lang.Object,
+ * java.lang.String, boolean, boolean)
+ */
+ @Override
+ public void addContainerFilter(Object propertyId, String filterString,
+ boolean ignoreCase, boolean onlyMatchPrefix) {
+ try {
+ addFilter(new SimpleStringFilter(propertyId, filterString,
+ ignoreCase, onlyMatchPrefix));
+ } catch (UnsupportedFilterException e) {
+ // the filter instance created here is always valid for in-memory
+ // containers
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container.Filterable#removeAllContainerFilters()
+ */
+ @Override
+ public void removeAllContainerFilters() {
+ if (!getFilters().isEmpty()) {
+ for (Item item : itemIdToItem.values()) {
+ removeAllValueChangeListeners(item);
+ }
+ removeAllFilters();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.data.Container.Filterable#removeContainerFilters(java.lang
+ * .Object)
+ */
+ @Override
+ public void removeContainerFilters(Object propertyId) {
+ Collection<Filter> removedFilters = super.removeFilters(propertyId);
+ if (!removedFilters.isEmpty()) {
+ // stop listening to change events for the property
+ for (Item item : itemIdToItem.values()) {
+ removeValueChangeListener(item, propertyId);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Filterable#addContainerFilter(com.vaadin.data.Container.Filter)
+ */
+ @Override
+ public void addContainerFilter(Filter filter)
+ throws UnsupportedFilterException {
+ addFilter(filter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Filterable#removeContainerFilter(com.vaadin.data.Container.Filter)
+ */
+ @Override
+ public void removeContainerFilter(Filter filter) {
+ removeFilter(filter);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#hasContainerFilters()
+ */
+ @Override
+ public boolean hasContainerFilters() {
+ return super.hasContainerFilters();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#getContainerFilters()
+ */
+ @Override
+ public Collection<Filter> getContainerFilters() {
+ return super.getContainerFilters();
+ }
+
+ /**
+ * Make this container listen to the given property provided it notifies
+ * when its value changes.
+ *
+ * @param item
+ * The {@link Item} that contains the property
+ * @param propertyId
+ * The id of the property
+ */
+ @SuppressWarnings("deprecation")
+ private void addValueChangeListener(Item item, Object propertyId) {
+ Property<?> property = item.getItemProperty(propertyId);
+ if (property instanceof ValueChangeNotifier) {
+ // avoid multiple notifications for the same property if
+ // multiple filters are in use
+ ValueChangeNotifier notifier = (ValueChangeNotifier) property;
+ notifier.removeListener(this);
+ notifier.addListener(this);
+ }
+ }
+
+ /**
+ * Remove this container as a listener for the given property.
+ *
+ * @param item
+ * The {@link Item} that contains the property
+ * @param propertyId
+ * The id of the property
+ */
+ @SuppressWarnings("deprecation")
+ private void removeValueChangeListener(Item item, Object propertyId) {
+ Property<?> property = item.getItemProperty(propertyId);
+ if (property instanceof ValueChangeNotifier) {
+ ((ValueChangeNotifier) property).removeListener(this);
+ }
+ }
+
+ /**
+ * Remove this contains as a listener for all the properties in the given
+ * {@link Item}.
+ *
+ * @param item
+ * The {@link Item} that contains the properties
+ */
+ private void removeAllValueChangeListeners(Item item) {
+ for (Object propertyId : item.getItemPropertyIds()) {
+ removeValueChangeListener(item, propertyId);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
+ */
+ @Override
+ public Collection<?> getSortableContainerPropertyIds() {
+ return getSortablePropertyIds();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[],
+ * boolean[])
+ */
+ @Override
+ public void sort(Object[] propertyId, boolean[] ascending) {
+ sortContainer(propertyId, ascending);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#getItemSorter()
+ */
+ @Override
+ public ItemSorter getItemSorter() {
+ return super.getItemSorter();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#setItemSorter(com.vaadin.data.util.ItemSorter)
+ */
+ @Override
+ public void setItemSorter(ItemSorter itemSorter) {
+ super.setItemSorter(itemSorter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#registerNewItem(int, java.lang.Object, com.vaadin.data.Item)
+ */
+ @Override
+ protected void registerNewItem(int position, IDTYPE itemId,
+ DeepResolvingBeanItem<BEANTYPE> item) {
+ itemIdToItem.put(itemId, item);
+
+ // add listeners to be able to update filtering on property
+ // changes
+ for (Filter filter : getFilters()) {
+ for (String propertyId : getContainerPropertyIds()) {
+ if (filter.appliesToProperty(propertyId)) {
+ // addValueChangeListener avoids adding duplicates
+ addValueChangeListener(item, propertyId);
+ }
+ }
+ }
+ }
+
+ /**
+ * Check that a bean can be added to the container (is of the correct type
+ * for the container).
+ *
+ * @param bean
+ * the bean
+ * @return true, if successful
+ */
+ private boolean validateBean(BEANTYPE bean) {
+ return bean != null && getBeanType().isAssignableFrom(bean.getClass());
+ }
+
+ /**
+ * Adds the bean to the Container.
+ *
+ * Note: the behavior of this method changed in Vaadin 6.6 - now items are
+ * added at the very end of the unfiltered container and not after the last
+ * visible item if filtering is used.
+ *
+ * @param itemId
+ * the item id
+ * @param bean
+ * the bean
+ * @return the deep resolving bean item
+ * @see com.vaadin.data.Container#addItem(Object)
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addItem(IDTYPE itemId,
+ BEANTYPE bean) {
+ if (!validateBean(bean)) {
+ return null;
+ }
+ return internalAddItemAtEnd(itemId, createBeanItem(bean), true);
+ }
+
+ /**
+ * Adds the bean after the given bean.
+ *
+ * @param previousItemId
+ * the previous item id
+ * @param newItemId
+ * the new item id
+ * @param bean
+ * the bean
+ * @return the deep resolving bean item
+ * @see com.vaadin.data.Container.Ordered#addItemAfter(Object, Object)
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addItemAfter(
+ IDTYPE previousItemId, IDTYPE newItemId, BEANTYPE bean) {
+ if (!validateBean(bean)) {
+ return null;
+ }
+ return internalAddItemAfter(previousItemId, newItemId,
+ createBeanItem(bean), true);
+ }
+
+ /**
+ * Adds a new bean at the given index.
+ *
+ * The bean is used both as the item contents and as the item identifier.
+ *
+ * @param index
+ * Index at which the bean should be added.
+ * @param newItemId
+ * The item id for the bean to add to the container.
+ * @param bean
+ * The bean to add to the container.
+ *
+ * @return Returns the new DeepResolvingBeanItem or null if the operation
+ * fails.
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addItemAt(int index,
+ IDTYPE newItemId, BEANTYPE bean) {
+ if (!validateBean(bean)) {
+ return null;
+ }
+ return internalAddItemAt(index, newItemId, createBeanItem(bean), true);
+ }
+
+ /**
+ * Adds a bean to the container using the bean item id resolver to find its
+ * identifier.
+ *
+ * A bean id resolver must be set before calling this method.
+ *
+ * @param bean
+ * the bean to add
+ * @return DeepResolvingBeanItem&lt;BEANTYPE&gt; item added or null
+ * @throws IllegalStateException
+ * if no bean identifier resolver has been set
+ * @throws IllegalArgumentException
+ * if an identifier cannot be resolved for the bean
+ * @see #addItem(Object, Object)
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE bean)
+ throws IllegalStateException, IllegalArgumentException {
+ if (bean == null) {
+ return null;
+ }
+ IDTYPE itemId = resolveBeanId(bean);
+ if (itemId == null) {
+ throw new IllegalArgumentException(
+ "Resolved identifier for a bean must not be null");
+ }
+ return addItem(itemId, bean);
+ }
+
+ /**
+ * Adds a bean to the container after a specified item identifier, using the
+ * bean item id resolver to find its identifier.
+ *
+ * A bean id resolver must be set before calling this method.
+ *
+ * @param previousItemId
+ * the identifier of the bean after which this bean should be
+ * added, null to add to the beginning
+ * @param bean
+ * the bean to add
+ * @return DeepResolvingBeanItem&lt;BEANTYPE&gt; item added or null
+ * @throws IllegalStateException
+ * if no bean identifier resolver has been set
+ * @throws IllegalArgumentException
+ * if an identifier cannot be resolved for the bean
+ * @see #addItemAfter(Object, Object, Object)
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addBeanAfter(
+ IDTYPE previousItemId, BEANTYPE bean) throws IllegalStateException,
+ IllegalArgumentException {
+ if (bean == null) {
+ return null;
+ }
+ IDTYPE itemId = resolveBeanId(bean);
+ if (itemId == null) {
+ throw new IllegalArgumentException(
+ "Resolved identifier for a bean must not be null");
+ }
+ return addItemAfter(previousItemId, itemId, bean);
+ }
+
+ /**
+ * Adds a bean at a specified (filtered view) position in the container
+ * using the bean item id resolver to find its identifier.
+ *
+ * A bean id resolver must be set before calling this method.
+ *
+ * @param index
+ * the index (in the filtered view) at which to add the item
+ * @param bean
+ * the bean to add
+ * @return DeepResolvingBeanItem&lt;BEANTYPE&gt; item added or null
+ * @throws IllegalStateException
+ * if no bean identifier resolver has been set
+ * @throws IllegalArgumentException
+ * if an identifier cannot be resolved for the bean
+ * @see #addItemAfter(Object, Object, Object)
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addBeanAt(int index, BEANTYPE bean)
+ throws IllegalStateException, IllegalArgumentException {
+ if (bean == null) {
+ return null;
+ }
+ IDTYPE itemId = resolveBeanId(bean);
+ if (itemId == null) {
+ throw new IllegalArgumentException(
+ "Resolved identifier for a bean must not be null");
+ }
+ return addItemAt(index, itemId, bean);
+ }
+
+ /**
+ * Adds all the beans from a {@link Collection} in one operation using the
+ * bean item identifier resolver. More efficient than adding them one by
+ * one.
+ *
+ * A bean id resolver must be set before calling this method.
+ *
+ * Note: the behavior of this method changed in Vaadin 6.6 - now items are
+ * added at the very end of the unfiltered container and not after the last
+ * visible item if filtering is used.
+ *
+ * @param collection
+ * The collection of beans to add. Must not be null.
+ * @throws IllegalStateException
+ * if no bean identifier resolver has been set
+ * @throws IllegalArgumentException
+ * if the resolver returns a null itemId for one of the beans in
+ * the collection
+ */
+ protected void addAll(Collection<? extends BEANTYPE> collection)
+ throws IllegalStateException, IllegalArgumentException {
+ boolean modified = false;
+ for (BEANTYPE bean : collection) {
+ // TODO skipping invalid beans - should not allow them in javadoc?
+ if (bean == null
+ || !getBeanType().isAssignableFrom(bean.getClass())) {
+ continue;
+ }
+ IDTYPE itemId = resolveBeanId(bean);
+ if (itemId == null) {
+ throw new IllegalArgumentException(
+ "Resolved identifier for a bean must not be null");
+ }
+
+ if (internalAddItemAtEnd(itemId, createBeanItem(bean), false) != null) {
+ modified = true;
+ }
+ }
+
+ if (modified) {
+ // Filter the contents when all items have been added
+ if (isFiltered()) {
+ filterAll();
+ } else {
+ fireItemSetChange();
+ }
+ }
+ }
+
+ /**
+ * Use the bean resolver to get the identifier for a bean.
+ *
+ * @param bean
+ * the bean
+ * @return resolved bean identifier, null if could not be resolved
+ * @throws IllegalStateException
+ * if no bean resolver is set
+ */
+ protected IDTYPE resolveBeanId(BEANTYPE bean) {
+ if (beanIdResolver == null) {
+ throw new IllegalStateException(
+ "Bean item identifier resolver is required.");
+ }
+ return beanIdResolver.getIdForBean(bean);
+ }
+
+ /**
+ * Sets the resolver that finds the item id for a bean, or null not to use
+ * automatic resolving.
+ *
+ * Methods that add a bean without specifying an id must not be called if no
+ * resolver has been set.
+ *
+ * Note that methods taking an explicit id can be used whether a resolver
+ * has been defined or not.
+ *
+ * @param beanIdResolver
+ * to use or null to disable automatic id resolution
+ */
+ protected void setBeanIdResolver(
+ BeanIdResolver<IDTYPE, BEANTYPE> beanIdResolver) {
+ this.beanIdResolver = beanIdResolver;
+ }
+
+ /**
+ * Returns the resolver that finds the item ID for a bean.
+ *
+ * @return resolver used or null if automatic item id resolving is disabled
+ */
+ public BeanIdResolver<IDTYPE, BEANTYPE> getBeanIdResolver() {
+ return beanIdResolver;
+ }
+
+ /**
+ * Create an item identifier resolver using a named bean property.
+ *
+ * @param propertyId
+ * property identifier, which must map to a getter in BEANTYPE
+ * @return created resolver
+ */
+ protected BeanIdResolver<IDTYPE, BEANTYPE> createBeanPropertyResolver(
+ Object propertyId) {
+ return new PropertyBasedBeanIdResolver(propertyId);
+ }
+
+ /**
+ * Adds the listener.
+ *
+ * @param listener
+ * the listener
+ * @deprecated As of 7.0, replaced by {@link #addPropertySetChangeListener}
+ */
+ @Deprecated
+ @Override
+ public void addListener(Container.PropertySetChangeListener listener) {
+ addPropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)
+ */
+ @Override
+ public void addPropertySetChangeListener(
+ Container.PropertySetChangeListener listener) {
+ super.addPropertySetChangeListener(listener);
+ }
+
+ /**
+ * Removes the listener.
+ *
+ * @param listener
+ * the listener
+ * @deprecated As of 7.0, replaced by
+ * {@link #removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)}
+ */
+ @Deprecated
+ @Override
+ public void removeListener(Container.PropertySetChangeListener listener) {
+ removePropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)
+ */
+ @Override
+ public void removePropertySetChangeListener(
+ Container.PropertySetChangeListener listener) {
+ super.removePropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#addContainerProperty(java.lang.Object, java.lang.Class, java.lang.Object)
+ */
+ @Override
+ public boolean addContainerProperty(Object propertyId, Class<?> type,
+ Object defaultValue) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ "Use addNestedContainerProperty(String) to add container properties to a "
+ + getClass().getSimpleName());
+ }
+
+ /**
+ * Adds a property for the container and all its items.
+ *
+ * Primarily for internal use, may change in future versions.
+ *
+ * @param propertyId
+ * the property id
+ * @param propertyDescriptor
+ * the property descriptor
+ * @return true if the property was added
+ */
+ protected final boolean addContainerProperty(String propertyId,
+ VaadinPropertyDescriptor<BEANTYPE> propertyDescriptor) {
+ if (null == propertyId || null == propertyDescriptor) {
+ return false;
+ }
+
+ // Fails if the Property is already present
+ if (model.containsKey(propertyId)) {
+ return false;
+ }
+
+ model.put(propertyId, propertyDescriptor);
+ for (DeepResolvingBeanItem<BEANTYPE> item : itemIdToItem.values()) {
+ item.addItemProperty(propertyId,
+ propertyDescriptor.createProperty(item.getBean()));
+ }
+
+ // Sends a change event
+ fireContainerPropertySetChange();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.INestedPropertyAble#addNestedContainerProperty(java.lang.String)
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public boolean addNestedContainerProperty(String propertyId) {
+ return addContainerProperty(propertyId, new NestedPropertyDescriptor(
+ propertyId, type));
+ }
+
+ /**
+ * Adds a nested container properties for all sub-properties of a named
+ * property to the container. The named property itself is removed from the
+ * model as its subproperties are added.
+ *
+ * All intermediate getters must exist and should return non-null values
+ * when the property value is accessed. If an intermediate getter returns
+ * null, a null value will be returned.
+ *
+ * @param propertyId
+ * the property id
+ * @see NestedMethodProperty
+ * @see #addNestedContainerProperty(String)
+ */
+ @SuppressWarnings("unchecked")
+ public void addNestedContainerBean(String propertyId) {
+ Class<?> propertyType = getType(propertyId);
+ LinkedHashMap<String, VaadinPropertyDescriptor<Object>> pds = DeepResolvingBeanItem
+ .getPropertyDescriptors((Class<Object>) propertyType);
+ for (String subPropertyId : pds.keySet()) {
+ String qualifiedPropertyId = propertyId + "." + subPropertyId;
+ NestedPropertyDescriptor<BEANTYPE> pd = new NestedPropertyDescriptor<BEANTYPE>(
+ qualifiedPropertyId, (Class<BEANTYPE>) type);
+ model.put(qualifiedPropertyId, pd);
+ model.remove(propertyId);
+ for (DeepResolvingBeanItem<BEANTYPE> item : itemIdToItem.values()) {
+ item.addItemProperty(propertyId,
+ pd.createProperty(item.getBean()));
+ item.removeItemProperty(propertyId);
+ }
+ }
+
+ // Sends a change event
+ fireContainerPropertySetChange();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractInMemoryContainer#removeContainerProperty(java.lang.Object)
+ */
+ @Override
+ public boolean removeContainerProperty(Object propertyId)
+ throws UnsupportedOperationException {
+ // Fails if the Property is not present
+ if (!model.containsKey(propertyId)) {
+ return false;
+ }
+
+ // Removes the Property to Property list and types
+ model.remove(propertyId);
+
+ // If remove the Property from all Items
+ for (final Iterator<IDTYPE> i = getAllItemIds().iterator(); i.hasNext();) {
+ getUnfilteredItem(i.next()).removeItemProperty(propertyId);
+ }
+
+ // Sends a change event
+ fireContainerPropertySetChange();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.container.IEnhancedFilterableContainer#getUnfilteredItemIds()
+ */
+ @Override
+ public List<IDTYPE> getUnfilteredItemIds() {
+ return getAllItemIds();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.container.IEnhancedFilterableContainer#sizeUnfiltered()
+ */
+ @Override
+ public int sizeUnfiltered() {
+ return getAllItemIds().size();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java
new file mode 100644
index 0000000..51f54a9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/BeanServiceLazyLoadingContainer.java
@@ -0,0 +1,901 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.osbp.dsl.dto.lib.services.SortBy;
+import org.eclipse.osbp.dsl.dto.lib.services.SortOrder;
+import org.eclipse.osbp.runtime.common.annotations.DtoUtils;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.common.state.SharedStateUnitOfWork;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Filterable;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.data.Container.SimpleFilterable;
+import com.vaadin.data.Container.Sortable;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.AbstractContainer;
+import com.vaadin.data.util.NestedPropertyDescriptor;
+import com.vaadin.data.util.VaadinPropertyDescriptor;
+import com.vaadin.data.util.filter.SimpleStringFilter;
+import com.vaadin.data.util.filter.UnsupportedFilterException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BeanServiceLazyLoadingContainer.
+ *
+ * @param <BEANTYPE>
+ * the generic type
+ */
+@SuppressWarnings("serial")
+public class BeanServiceLazyLoadingContainer<BEANTYPE> extends
+ AbstractContainer implements Filterable, Indexed, SimpleFilterable,
+ ILazyRefreshFilterable, Sortable, ValueChangeListener,
+ Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier,
+ IClearable, INestedPropertyAble<BEANTYPE> {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(BeanServiceLazyLoadingContainer.class);
+
+ /** The service. */
+ private IBeanSearchService<BEANTYPE> service;
+
+ /** The sort order. */
+ private SortOrder sortOrder = new SortOrder();
+
+ /** The filters. */
+ private List<Filter> filters = new ArrayList<Filter>();
+
+ /** The type. */
+ private Class<BEANTYPE> type;
+
+ /** The sortable properties. */
+ private Set<String> sortableProperties = new HashSet<String>();
+
+ /** The model. */
+ private LinkedHashMap<String, VaadinPropertyDescriptor<BEANTYPE>> model;
+
+ /** The cache. */
+ private Map<Object, DeepResolvingBeanItem<BEANTYPE>> cache = new HashMap<Object, DeepResolvingBeanItem<BEANTYPE>>();
+
+ /** The external cache. */
+ // new records that have been added from outside -> new records
+ private Map<Object, DeepResolvingBeanItem<BEANTYPE>> externalCache = new HashMap<Object, DeepResolvingBeanItem<BEANTYPE>>();
+
+ /** The shared state. */
+ private final ISharedStateContext sharedState;
+
+ /**
+ * Instantiates a new bean service lazy loading container.
+ *
+ * @param service
+ * the service
+ * @param type
+ * the type
+ * @param sharedState
+ * the shared state
+ */
+ public BeanServiceLazyLoadingContainer(
+ IBeanSearchService<BEANTYPE> service, Class<BEANTYPE> type,
+ ISharedStateContext sharedState) {
+ this.service = service != null ? service
+ : new StatefulInMemoryBeanSearchService<BEANTYPE>(type);
+ this.type = type;
+ model = DeepResolvingBeanItem
+ .getPropertyDescriptors((Class<BEANTYPE>) type);
+
+ // create all sortable columns
+ for (String column : model.keySet()) {
+ if (DtoUtils.isDirtyField(type, column)) {
+ continue;
+ }
+ sortableProperties.add(column);
+ }
+ this.sharedState = sharedState;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#addListener(com.vaadin.data.Container.PropertySetChangeListener)
+ */
+ @Override
+ public void addListener(PropertySetChangeListener listener) {
+ super.addPropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#removeListener(com.vaadin.data.Container.PropertySetChangeListener)
+ */
+ @Override
+ public void removeListener(PropertySetChangeListener listener) {
+ super.removePropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#addListener(com.vaadin.data.Container.ItemSetChangeListener)
+ */
+ @Override
+ public void addListener(ItemSetChangeListener listener) {
+ super.addItemSetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#removeListener(com.vaadin.data.Container.ItemSetChangeListener)
+ */
+ @Override
+ public void removeListener(ItemSetChangeListener listener) {
+ super.removeItemSetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)
+ */
+ @Override
+ public void addPropertySetChangeListener(PropertySetChangeListener listener) {
+ super.addPropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)
+ */
+ @Override
+ public void removePropertySetChangeListener(
+ PropertySetChangeListener listener) {
+ super.removePropertySetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#addItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener)
+ */
+ @Override
+ public void addItemSetChangeListener(ItemSetChangeListener listener) {
+ super.addItemSetChangeListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.AbstractContainer#removeItemSetChangeListener(com.vaadin.data.Container.ItemSetChangeListener)
+ */
+ @Override
+ public void removeItemSetChangeListener(ItemSetChangeListener listener) {
+ super.removeItemSetChangeListener(listener);
+ }
+
+ /**
+ * Adds the item.
+ *
+ * @param itemId
+ * the item id
+ * @param bean
+ * the bean
+ * @return the deep resolving bean item
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addItem(Object itemId,
+ BEANTYPE bean) {
+ return addBean(bean);
+ }
+
+ /**
+ * Internal add item at end.
+ *
+ * @param newItemId
+ * the new item id
+ * @param item
+ * the item
+ * @return the deep resolving bean item
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> internalAddItemAtEnd(
+ Object newItemId, DeepResolvingBeanItem<BEANTYPE> item) {
+ if (externalCache.containsKey(newItemId)) {
+ cache.put(newItemId, externalCache.get(newItemId));
+ } else {
+ cache.put(newItemId, item);
+ }
+ return item;
+ }
+
+ /**
+ * Creates the bean item.
+ *
+ * @param bean
+ * the bean
+ * @return the deep resolving bean item
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> createBeanItem(BEANTYPE bean) {
+ return bean == null ? null : new DeepResolvingBeanItem<BEANTYPE>(bean,
+ model);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#nextItemId(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object nextItemId(final Object itemId) {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Object>() {
+ @Override
+ protected Object doExecute() {
+ return service.getNextBean((BEANTYPE) itemId, filters,
+ sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return mapToCachedId(service.getNextBean((BEANTYPE) itemId,
+ filters, sortOrder));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#prevItemId(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object prevItemId(final Object itemId) {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Object>() {
+ @Override
+ protected Object doExecute() {
+ return service.getPreviousBean((BEANTYPE) itemId, filters,
+ sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return mapToCachedId(service.getPreviousBean((BEANTYPE) itemId,
+ filters, sortOrder));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#firstItemId()
+ */
+ @Override
+ public Object firstItemId() {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Object>() {
+ @Override
+ protected Object doExecute() {
+ return service.getFirstBean(filters, sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return mapToCachedId(service.getFirstBean(filters, sortOrder));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#lastItemId()
+ */
+ @Override
+ public Object lastItemId() {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Object>() {
+ @Override
+ protected Object doExecute() {
+ return service.getLastBean(filters, sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return mapToCachedId(service.getLastBean(filters, sortOrder));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#isFirstId(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean isFirstId(final Object itemId) {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Boolean>() {
+ @Override
+ protected Boolean doExecute() {
+ return service.isFirstBean((BEANTYPE) itemId, filters,
+ sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return service.isFirstBean((BEANTYPE) itemId, filters, sortOrder);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#isLastId(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean isLastId(final Object itemId) {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Boolean>() {
+ @Override
+ protected Boolean doExecute() {
+ return service.isLastBean((BEANTYPE) itemId, filters,
+ sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return service.isLastBean((BEANTYPE) itemId, filters, sortOrder);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object)
+ */
+ @Override
+ public Object addItemAfter(Object previousItemId)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Ordered#addItemAfter(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public Item addItemAfter(Object previousItemId, Object newItemId)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#getItem(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Item getItem(Object itemId) {
+ if (cache.containsKey(itemId)) {
+ return cache.get(itemId);
+ } else if (externalCache.containsKey(itemId)) {
+ return externalCache.get(itemId);
+ }
+ return addBean((BEANTYPE) itemId);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#getContainerPropertyIds()
+ */
+ @Override
+ public Collection<?> getContainerPropertyIds() {
+ return model.keySet();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#getItemIds()
+ */
+ @Override
+ public Collection<?> getItemIds() {
+ // Due to directly call of this method by com.vaadin.ui.ListSelect
+ // without a previous calculation of pagesize a fix pagesize of 100
+ // elements will be set in this method.
+ @SuppressWarnings("unchecked")
+ // List<Object> itemIds = new ArrayList<Object>();
+ List<Object> itemIds = (List<Object>) getItemIds(0, 100);
+ if (itemIds.size() == 0) {
+ itemIds.addAll(cache.keySet());
+ itemIds.addAll(externalCache.keySet());
+ }
+ return itemIds;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ Item item = getItem(itemId);
+ if (item == null) {
+ return null;
+ }
+ return item.getItemProperty(propertyId);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#getType(java.lang.Object)
+ */
+ @Override
+ public Class<?> getType(Object propertyId) {
+ return model.get(propertyId).getPropertyType();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#size()
+ */
+ @Override
+ public int size() {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Integer>() {
+ @Override
+ protected Integer doExecute() {
+ return service.size(filters) + externalCache.size();
+ }
+ }.execute(sharedState);
+ } else {
+ return service.size(filters) + externalCache.size();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#containsId(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean containsId(final Object itemId) {
+ if (cache.containsKey(itemId) || externalCache.containsKey(itemId)) {
+ return true;
+ }
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Boolean>() {
+ @Override
+ protected Boolean doExecute() {
+ return service.contains((BEANTYPE) itemId, filters);
+ }
+ }.execute(sharedState);
+ } else {
+ return service.contains((BEANTYPE) itemId, filters);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#addItem(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Item addItem(Object itemId) throws UnsupportedOperationException {
+ // external data -> new record
+ return addBean((BEANTYPE) itemId, true);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#addItem()
+ */
+ @Override
+ public Object addItem() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException("Bean required for new item!");
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#removeItem(java.lang.Object)
+ */
+ @Override
+ public boolean removeItem(Object itemId)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ "Does not support deleting item!");
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#addContainerProperty(java.lang.Object, java.lang.Class, java.lang.Object)
+ */
+ @Override
+ public boolean addContainerProperty(Object propertyId, Class<?> type,
+ Object defaultValue) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#removeContainerProperty(java.lang.Object)
+ */
+ @Override
+ public boolean removeContainerProperty(Object propertyId)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.INestedPropertyAble#
+ * addNestedContainerProperty(java.lang.String)
+ */
+ @Override
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public boolean addNestedContainerProperty(String propertyId) {
+ return addContainerProperty(propertyId, new NestedPropertyDescriptor(
+ propertyId, type));
+ }
+
+ /**
+ * Adds a property for the container and all its items.
+ *
+ * Primarily for internal use, may change in future versions.
+ *
+ * @param propertyId
+ * the property id
+ * @param propertyDescriptor
+ * the property descriptor
+ * @return true if the property was added
+ */
+ protected final boolean addContainerProperty(String propertyId,
+ VaadinPropertyDescriptor<BEANTYPE> propertyDescriptor) {
+ if (null == propertyId || null == propertyDescriptor) {
+ return false;
+ }
+
+ // Fails if the Property is already present
+ if (model.containsKey(propertyId)) {
+ return false;
+ }
+
+ model.put(propertyId, propertyDescriptor);
+
+ // add to sortable properties
+ sortableProperties.add(propertyId);
+
+ // Sends a change event
+ fireContainerPropertySetChange();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container#removeAllItems()
+ */
+ @Override
+ public boolean removeAllItems() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ "Does not support deleting all items!");
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent)
+ */
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Sortable#sort(java.lang.Object[], boolean[])
+ */
+ @Override
+ public void sort(Object[] propertyIds, boolean[] ascending) {
+ sortOrder.clear();
+ for (int i = 0; i < propertyIds.length; i++) {
+ sortOrder.add(new SortBy((String) propertyIds[i], ascending[i]));
+ }
+ clearCache();
+
+ fireItemSetChange();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Sortable#getSortableContainerPropertyIds()
+ */
+ @Override
+ public Collection<?> getSortableContainerPropertyIds() {
+ return sortableProperties;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.SimpleFilterable#addContainerFilter(java.lang.Object, java.lang.String, boolean, boolean)
+ */
+ @Override
+ public void addContainerFilter(Object propertyId, String filterString,
+ boolean ignoreCase, boolean onlyMatchPrefix) {
+ addContainerFilter(new SimpleStringFilter(propertyId, filterString,
+ ignoreCase, onlyMatchPrefix));
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.SimpleFilterable#removeContainerFilters(java.lang.Object)
+ */
+ @Override
+ public void removeContainerFilters(Object propertyId) {
+ if (getFilters().isEmpty() || propertyId == null) {
+ return;
+ }
+ boolean result = false;
+ for (Iterator<Filter> iterator = getFilters().iterator(); iterator
+ .hasNext();) {
+ Filter f = iterator.next();
+ if (f.appliesToProperty(propertyId)) {
+ iterator.remove();
+ result = true;
+ }
+ }
+
+ if (result) {
+ clearCache();
+ }
+ }
+
+ /**
+ * Gets the filters.
+ *
+ * @return the filters
+ */
+ protected List<Filter> getFilters() {
+ return filters;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Filterable#addContainerFilter(com.vaadin.data.Container.Filter)
+ */
+ @Override
+ public void addContainerFilter(Filter filter)
+ throws UnsupportedFilterException {
+ if (!filters.contains(filter)) {
+ filters.add(filter);
+ clearCache();
+ }
+
+ fireItemSetChange();
+ }
+
+ /**
+ * Clear cache.
+ */
+ protected void clearCache() {
+ cache.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Filterable#removeContainerFilter(com.vaadin.data.Container.Filter)
+ */
+ @Override
+ public void removeContainerFilter(Filter filter) {
+ if (filters.remove(filter)) {
+ clearCache();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Filterable#removeAllContainerFilters()
+ */
+ @Override
+ public void removeAllContainerFilters() {
+ filters.clear();
+ clearCache();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Filterable#getContainerFilters()
+ */
+ @Override
+ public Collection<Filter> getContainerFilters() {
+ return Collections.unmodifiableList(filters);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable#refreshFilters()
+ */
+ @Override
+ public void refreshFilters() {
+ fireItemSetChange();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Indexed#indexOfId(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public int indexOfId(final Object itemId) {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<Integer>() {
+ @Override
+ protected Integer doExecute() {
+ return service.indexOf((BEANTYPE) itemId, filters,
+ sortOrder);
+ }
+ }.execute(sharedState);
+ } else {
+ return service.indexOf((BEANTYPE) itemId, filters, sortOrder);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Indexed#getIdByIndex(int)
+ */
+ @Override
+ public Object getIdByIndex(final int index) {
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<BEANTYPE>() {
+ @Override
+ protected BEANTYPE doExecute() {
+ BEANTYPE result = null;
+ result = (BEANTYPE) service.getBeanByIndex(index, filters,
+ sortOrder);
+ addBean(result);
+ return result;
+ }
+ }.execute(sharedState);
+ } else {
+ BEANTYPE result = null;
+ result = (BEANTYPE) service.getBeanByIndex(index, filters,
+ sortOrder);
+ if (isCached(result)) {
+ result = mapToCachedId(result);
+ } else {
+ addBean(result);
+ }
+ return result;
+ }
+ }
+
+ /**
+ * Tries to find the itemId in the cache. If it does so, the cached instance
+ * is returned.<br>
+ * This method will NOT add the itemId to the cache.
+ *
+ * @param itemId
+ * the item id
+ * @return the beantype
+ */
+ private BEANTYPE mapToCachedId(BEANTYPE itemId) {
+ if (!isCached(itemId)) {
+ return itemId;
+ }
+ if (cache.containsKey(itemId)) {
+ return cache.get(itemId).getBean();
+ } else if (externalCache.containsKey(itemId)) {
+ return externalCache.get(itemId).getBean();
+ }
+ return null;
+ }
+
+ /**
+ * Checks if is cached.
+ *
+ * @param bean
+ * the bean
+ * @return true, if is cached
+ */
+ protected boolean isCached(Object bean) {
+ return cache.containsKey(bean) || externalCache.containsKey(bean);
+ }
+
+ /**
+ * Adds the bean.
+ *
+ * @param result
+ * the result
+ * @return the deep resolving bean item
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE result) {
+ return addBean(result, false);
+ }
+
+ /**
+ * Adds the bean.
+ *
+ * @param result
+ * the result
+ * @param toExternalCache
+ * the to external cache
+ * @return the deep resolving bean item
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE result,
+ boolean toExternalCache) {
+ return addBean(result, result, toExternalCache);
+ }
+
+ /**
+ * Adds the bean.
+ *
+ * @param itemId
+ * the item id
+ * @param result
+ * the result
+ * @param toExternalCache
+ * the to external cache
+ * @return the deep resolving bean item
+ */
+ protected DeepResolvingBeanItem<BEANTYPE> addBean(Object itemId,
+ BEANTYPE result, boolean toExternalCache) {
+
+ if (cache.containsKey(itemId)) {
+ return cache.get(itemId);
+ }
+
+ if (externalCache.containsKey(itemId)) {
+ return externalCache.get(itemId);
+ }
+
+ DeepResolvingBeanItem<BEANTYPE> item = createBeanItem(result);
+ if (toExternalCache) {
+ externalCache.put(itemId, item);
+ }
+
+ return internalAddItemAtEnd(itemId, item);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Indexed#getItemIds(int, int)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<BEANTYPE> getItemIds(final int startIndex,
+ final int numberOfItems) {
+
+ LOGGER.debug(String.format(
+ "Fetching item ids: StartIndex:%d NumberOfItems:%d",
+ startIndex, numberOfItems));
+
+ if (sharedState != null) {
+ return new SharedStateUnitOfWork<List<BEANTYPE>>() {
+ @Override
+ protected List<BEANTYPE> doExecute() {
+ List<BEANTYPE> beans = new ArrayList<BEANTYPE>();
+ // beans.addAll((Collection<? extends BEANTYPE>)
+ // externalCache
+ // .keySet());
+ beans.addAll((List<BEANTYPE>) service.getBeansByIndex(
+ startIndex, numberOfItems, filters, sortOrder));
+ for (BEANTYPE bean : beans) {
+ addBean(bean);
+
+ LOGGER.debug(String.format("Fetched bean: %s",
+ bean.toString()));
+ }
+ return beans;
+ }
+ }.execute(sharedState);
+ } else {
+ List<BEANTYPE> beans = new ArrayList<BEANTYPE>();
+ beans.addAll((Collection<? extends BEANTYPE>) externalCache
+ .keySet());
+ // map the results to cached instances
+ for (BEANTYPE bean : service.getBeansByIndex(startIndex,
+ numberOfItems, filters, sortOrder)) {
+ if (isCached(bean)) {
+ beans.add(mapToCachedId(bean));
+ } else {
+ addBean(bean);
+ beans.add(bean);
+ }
+ }
+ return beans;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Indexed#addItemAt(int)
+ */
+ @Override
+ public Object addItemAt(int index) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.Container.Indexed#addItemAt(int, java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Item addItemAt(int index, Object newItemId)
+ throws UnsupportedOperationException {
+
+ // external data -> new record
+ return addBean((BEANTYPE) newItemId, true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.IClearable#clear()
+ */
+ @Override
+ public void clear() {
+ cache.clear();
+ externalCache.clear();
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItem.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItem.java
new file mode 100644
index 0000000..936d8fc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItem.java
@@ -0,0 +1,311 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ * Contributors:
+ * Florian Pirchner - copied from vaadin and changed implementations to meet requirements
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.util.MethodPropertyDescriptor;
+import com.vaadin.data.util.NestedMethodProperty;
+import com.vaadin.data.util.PropertysetItem;
+import com.vaadin.data.util.VaadinPropertyDescriptor;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A wrapper class for adding the Item interface to any Java Bean. It allows to
+ * access nested properties that are not visible in the bean item.
+ *
+ * @author Vaadin Ltd.
+ * @param <BT>
+ * the generic type
+ * @since 3.0
+ */
+@SuppressWarnings("serial")
+public class DeepResolvingBeanItem<BT> extends PropertysetItem {
+
+ /**
+ * The bean which this Item is based on.
+ */
+ private final BT bean;
+
+ /**
+ * <p>
+ * Creates a new instance of <code>DeepResolvingBeanItem</code> and adds all properties
+ * of a Java Bean to it. The properties are identified by their respective
+ * bean names.
+ *
+ *
+ * <p>
+ * Note : This version only supports introspectable bean properties and
+ * their getter and setter methods. Stand-alone <code>is</code> and
+ * <code>are</code> methods are not supported.
+ *
+ *
+ * @param bean
+ * the Java Bean to copy properties from.
+ *
+ */
+ @SuppressWarnings("unchecked")
+ public DeepResolvingBeanItem(BT bean) {
+ this(bean, getPropertyDescriptors((Class<BT>) bean.getClass()));
+ }
+
+ /**
+ * <p>
+ * Creates a new instance of <code>DeepResolvingBeanItem</code> using a pre-computed set
+ * of properties. The properties are identified by their respective bean
+ * names.
+ *
+ *
+ * @param bean
+ * the Java Bean to copy properties from.
+ * @param propertyDescriptors
+ * pre-computed property descriptors
+ */
+ public DeepResolvingBeanItem(BT bean,
+ Map<String, VaadinPropertyDescriptor<BT>> propertyDescriptors) {
+
+ this.bean = bean;
+
+ for (VaadinPropertyDescriptor<BT> pd : propertyDescriptors.values()) {
+ addItemProperty(pd.getName(), pd.createProperty(bean));
+ }
+ }
+
+ /**
+ * <p>
+ * Creates a new instance of <code>DeepResolvingBeanItem</code> and adds all listed
+ * properties of a Java Bean to it - in specified order. The properties are
+ * identified by their respective bean names.
+ *
+ *
+ * <p>
+ * Note : This version only supports introspectable bean properties and
+ * their getter and setter methods. Stand-alone <code>is</code> and
+ * <code>are</code> methods are not supported.
+ *
+ *
+ * @param bean
+ * the Java Bean to copy properties from.
+ * @param propertyIds
+ * id of the property.
+ */
+ @SuppressWarnings("unchecked")
+ public DeepResolvingBeanItem(BT bean, Collection<?> propertyIds) {
+
+ this.bean = bean;
+
+ // Create bean information
+ LinkedHashMap<String, VaadinPropertyDescriptor<BT>> pds = getPropertyDescriptors((Class<BT>) bean
+ .getClass());
+
+ // Add all the bean properties as MethodProperties to this Item
+ for (Object id : propertyIds) {
+ VaadinPropertyDescriptor<BT> pd = pds.get(id);
+ if (pd != null) {
+ addItemProperty(pd.getName(), pd.createProperty(bean));
+ }
+ }
+
+ }
+
+ /**
+ * <p>
+ * Creates a new instance of <code>DeepResolvingBeanItem</code> and adds all listed
+ * properties of a Java Bean to it - in specified order. The properties are
+ * identified by their respective bean names.
+ *
+ *
+ * <p>
+ * Note : This version only supports introspectable bean properties and
+ * their getter and setter methods. Stand-alone <code>is</code> and
+ * <code>are</code> methods are not supported.
+ *
+ *
+ * @param bean
+ * the Java Bean to copy properties from.
+ * @param propertyIds
+ * ids of the properties.
+ */
+ public DeepResolvingBeanItem(BT bean, String... propertyIds) {
+ this(bean, Arrays.asList(propertyIds));
+ }
+
+ /**
+ * <p>
+ * Perform introspection on a Java Bean class to find its properties.
+ *
+ *
+ * <p>
+ * Note : This version only supports introspectable bean properties and
+ * their getter and setter methods. Stand-alone <code>is</code> and
+ * <code>are</code> methods are not supported.
+ *
+ * @param <BT>
+ * the generic type
+ * @param beanClass
+ * the Java Bean class to get properties for.
+ * @return an ordered map from property names to property descriptors
+ */
+ public static <BT> LinkedHashMap<String, VaadinPropertyDescriptor<BT>> getPropertyDescriptors(
+ final Class<BT> beanClass) {
+ final LinkedHashMap<String, VaadinPropertyDescriptor<BT>> pdMap = new LinkedHashMap<String, VaadinPropertyDescriptor<BT>>();
+
+ // Try to introspect, if it fails, we just have an empty Item
+ try {
+ List<PropertyDescriptor> propertyDescriptors = getBeanPropertyDescriptor(beanClass);
+
+ // Add all the bean properties as MethodProperties to this Item
+ // later entries on the list overwrite earlier ones
+ for (PropertyDescriptor pd : propertyDescriptors) {
+ final Method getMethod = pd.getReadMethod();
+ if ((getMethod != null)
+ && getMethod.getDeclaringClass() != Object.class) {
+ VaadinPropertyDescriptor<BT> vaadinPropertyDescriptor = new MethodPropertyDescriptor<BT>(
+ pd.getName(), pd.getPropertyType(),
+ pd.getReadMethod(), pd.getWriteMethod());
+ pdMap.put(pd.getName(), vaadinPropertyDescriptor);
+ }
+ }
+ } catch (final java.beans.IntrospectionException ignored) {
+ }
+
+ return pdMap;
+ }
+
+ /**
+ * Returns the property descriptors of a class or an interface.
+ *
+ * For an interface, superinterfaces are also iterated as Introspector does
+ * not take them into account (Oracle Java bug 4275879), but in that case,
+ * both the setter and the getter for a property must be in the same
+ * interface and should not be overridden in subinterfaces for the discovery
+ * to work correctly.
+ *
+ * For interfaces, the iteration is depth first and the properties of
+ * superinterfaces are returned before those of their subinterfaces.
+ *
+ * @param beanClass
+ * the bean class
+ * @return the bean property descriptor
+ * @throws IntrospectionException
+ * the introspection exception
+ */
+ private static List<PropertyDescriptor> getBeanPropertyDescriptor(
+ final Class<?> beanClass) throws IntrospectionException {
+ // Oracle bug 4275879: Introspector does not consider superinterfaces of
+ // an interface
+ if (beanClass.isInterface()) {
+ List<PropertyDescriptor> propertyDescriptors = new ArrayList<PropertyDescriptor>();
+
+ for (Class<?> cls : beanClass.getInterfaces()) {
+ propertyDescriptors.addAll(getBeanPropertyDescriptor(cls));
+ }
+
+ BeanInfo info = Introspector.getBeanInfo(beanClass);
+ propertyDescriptors.addAll(Arrays.asList(info
+ .getPropertyDescriptors()));
+
+ return propertyDescriptors;
+ } else {
+ BeanInfo info = Introspector.getBeanInfo(beanClass);
+ return Arrays.asList(info.getPropertyDescriptors());
+ }
+ }
+
+ /**
+ * Expands nested bean properties by replacing a top-level property with
+ * some or all of its sub-properties. The expansion is not recursive.
+ *
+ * @param propertyId
+ * property id for the property whose sub-properties are to be
+ * expanded,
+ * @param subPropertyIds
+ * sub-properties to expand, all sub-properties are expanded if
+ * not specified
+ */
+ public void expandProperty(String propertyId, String... subPropertyIds) {
+ Set<String> subPropertySet = new HashSet<String>(
+ Arrays.asList(subPropertyIds));
+
+ if (0 == subPropertyIds.length) {
+ // Enumerate all sub-properties
+ Class<?> propertyType = getItemProperty(propertyId).getType();
+ Map<String, ?> pds = getPropertyDescriptors(propertyType);
+ subPropertySet.addAll(pds.keySet());
+ }
+
+ for (String subproperty : subPropertySet) {
+ String qualifiedPropertyId = propertyId + "." + subproperty;
+ addNestedProperty(qualifiedPropertyId);
+ }
+
+ removeItemProperty(propertyId);
+ }
+
+ /**
+ * Adds a nested property to the item. The property must not exist in the
+ * item already and must of form "field1.field2" where field2 is a field in
+ * the object referenced to by field1. If an intermediate property returns
+ * null, the property will return a null value
+ *
+ * @param nestedPropertyId
+ * property id to add.
+ */
+ public void addNestedProperty(String nestedPropertyId) {
+ addItemProperty(nestedPropertyId, new NestedMethodProperty<Object>(
+ getBean(), nestedPropertyId));
+ }
+
+ /**
+ * Gets the underlying JavaBean object.
+ *
+ * @return the bean object.
+ */
+ public BT getBean() {
+ return bean;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.PropertysetItem#getItemProperty(java.lang.Object)
+ */
+ @Override
+ public Property<?> getItemProperty(Object id) {
+ Property<?> result = super.getItemProperty(id);
+ if (result == null) {
+ // create a transient nested method property for filter issues
+ result = new NestedMethodProperty<Object>(getBean(), (String) id);
+ }
+
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java
new file mode 100644
index 0000000..1805aac
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/DeepResolvingBeanItemContainer.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.util.Collection;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An in-memory container for JavaBeans.
+ *
+ * <p>
+ * The properties of the container are determined automatically by introspecting
+ * the used JavaBean class. Only beans of the same type can be added to the
+ * container.
+ *
+ *
+ * <p>
+ * BeanItemContainer uses the beans themselves as identifiers. The
+ * {@link Object#hashCode()} of a bean is used when storing and looking up beans
+ * so it must not change during the lifetime of the bean (it should not depend
+ * on any part of the bean that can be modified). Typically this restricts the
+ * implementation of {@link Object#equals(Object)} as well in order for it to
+ * fulfill the contract between {@code equals()} and {@code hashCode()}.
+ *
+ *
+ * <p>
+ * To add items to the container, use the methods {@link #addBean(Object)},
+ * {@link #addBeanAfter(Object, Object)} and {@link #addBeanAt(int, Object)}.
+ * Also {@link #addItem(Object)}, {@link #addItemAfter(Object, Object)} and
+ * {@link #addItemAt(int, Object)} can be used as synonyms for them.
+ *
+ *
+ * <p>
+ * It is not possible to add additional properties to the container.
+ *
+ *
+ * @param <BEANTYPE>
+ * The type of the Bean
+ *
+ * @since 5.4
+ */
+@SuppressWarnings("serial")
+public class DeepResolvingBeanItemContainer<BEANTYPE> extends
+ AbstractDeepResolvingBeanContainer<BEANTYPE, BEANTYPE> {
+
+ /**
+ * Bean identity resolver that returns the bean itself as its item
+ * identifier.
+ *
+ * This corresponds to the old behavior of
+ * {@link DeepResolvingBeanItemContainer}, and requires suitable
+ * (identity-based) equals() and hashCode() methods on the beans.
+ *
+ * @param <BT>
+ * the generic type
+ * @since 6.5
+ */
+ private static class IdentityBeanIdResolver<BT> implements
+ BeanIdResolver<BT, BT> {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.AbstractDeepResolvingBeanContainer.BeanIdResolver#getIdForBean(java.lang.Object)
+ */
+ @Override
+ public BT getIdForBean(BT bean) {
+ return bean;
+ }
+
+ }
+
+ /**
+ * Constructs a {@code BeanItemContainer} for beans of the given type.
+ *
+ * @param type
+ * the type of the beans that will be added to the container.
+ * @throws IllegalArgumentException
+ * If {@code type} is null
+ */
+ public DeepResolvingBeanItemContainer(Class<? super BEANTYPE> type)
+ throws IllegalArgumentException {
+ super(type);
+ super.setBeanIdResolver(new IdentityBeanIdResolver<BEANTYPE>());
+ }
+
+ /**
+ * Constructs a {@code BeanItemContainer} and adds the given beans to it.
+ * The collection must not be empty.
+ * {@link DeepResolvingBeanItemContainer#DeepResolvingBeanItemContainer(Class)}
+ * can be used for creating an initially empty {@code BeanItemContainer}.
+ *
+ * Note that when using this constructor, the actual class of the first item
+ * in the collection is used to determine the bean properties supported by
+ * the container instance, and only beans of that class or its subclasses
+ * can be added to the collection. If this is problematic or empty
+ * collections need to be supported, use
+ * {@link #DeepResolvingBeanItemContainer(Class)} and
+ * {@link #addAll(Collection)} instead.
+ *
+ * @param collection
+ * a non empty {@link Collection} of beans.
+ * @throws IllegalArgumentException
+ * If the collection is null or empty.
+ *
+ * @deprecated As of 6.5, use
+ * {@link #DeepResolvingBeanItemContainer(Class, Collection)}
+ * instead
+ */
+ @SuppressWarnings("unchecked")
+ @Deprecated
+ public DeepResolvingBeanItemContainer(
+ Collection<? extends BEANTYPE> collection)
+ throws IllegalArgumentException {
+ // must assume the class is BT
+ // the class information is erased by the compiler
+ this((Class<BEANTYPE>) getBeanClassForCollection(collection),
+ collection);
+ }
+
+ /**
+ * Internal helper method to support the deprecated {@link Collection}
+ * container.
+ *
+ * @param <BT>
+ * the generic type
+ * @param collection
+ * the collection
+ * @return the bean class for collection
+ * @throws IllegalArgumentException
+ * the illegal argument exception
+ */
+ @SuppressWarnings("unchecked")
+ @Deprecated
+ private static <BT> Class<? extends BT> getBeanClassForCollection(
+ Collection<? extends BT> collection)
+ throws IllegalArgumentException {
+ if (collection == null || collection.isEmpty()) {
+ throw new IllegalArgumentException(
+ "The collection passed to BeanItemContainer constructor must not be null or empty. Use the other BeanItemContainer constructor.");
+ }
+ return (Class<? extends BT>) collection.iterator().next().getClass();
+ }
+
+ /**
+ * Constructs a {@code BeanItemContainer} and adds the given beans to it.
+ *
+ * @param type
+ * the type of the beans that will be added to the container.
+ * @param collection
+ * a {@link Collection} of beans (can be empty or null).
+ * @throws IllegalArgumentException
+ * If {@code type} is null
+ */
+ public DeepResolvingBeanItemContainer(Class<? super BEANTYPE> type,
+ Collection<? extends BEANTYPE> collection)
+ throws IllegalArgumentException {
+ super(type);
+ super.setBeanIdResolver(new IdentityBeanIdResolver<BEANTYPE>());
+
+ if (collection != null) {
+ addAll(collection);
+ }
+ }
+
+ /**
+ * Adds all the beans from a {@link Collection} in one go. More efficient
+ * than adding them one by one.
+ *
+ * @param collection
+ * The collection of beans to add. Must not be null.
+ */
+ @Override
+ public void addAll(Collection<? extends BEANTYPE> collection) {
+ super.addAll(collection);
+ }
+
+ /**
+ * Adds the bean after the given bean.
+ *
+ * The bean is used both as the item contents and as the item identifier.
+ *
+ * @param previousItemId
+ * the bean (of type BT) after which to add newItemId
+ * @param newItemId
+ * the bean (of type BT) to add (not null)
+ * @return the deep resolving bean item
+ * @throws IllegalArgumentException
+ * the illegal argument exception
+ * @see com.vaadin.data.Container.Ordered#addItemAfter(Object, Object)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public DeepResolvingBeanItem<BEANTYPE> addItemAfter(Object previousItemId,
+ Object newItemId) throws IllegalArgumentException {
+ return super.addBeanAfter((BEANTYPE) previousItemId,
+ (BEANTYPE) newItemId);
+ }
+
+ /**
+ * Adds a new bean at the given index.
+ *
+ * The bean is used both as the item contents and as the item identifier.
+ *
+ * @param index
+ * Index at which the bean should be added.
+ * @param newItemId
+ * The bean to add to the container.
+ * @return Returns the new DeepResolvingBeanItem or null if the operation
+ * fails.
+ * @throws IllegalArgumentException
+ * the illegal argument exception
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public DeepResolvingBeanItem<BEANTYPE> addItemAt(int index, Object newItemId)
+ throws IllegalArgumentException {
+ return super.addBeanAt(index, (BEANTYPE) newItemId);
+ }
+
+ /**
+ * Adds the bean to the Container.
+ *
+ * The bean is used both as the item contents and as the item identifier.
+ *
+ * @param itemId
+ * the item id
+ * @return the deep resolving bean item
+ * @see com.vaadin.data.Container#addItem(Object)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public DeepResolvingBeanItem<BEANTYPE> addItem(Object itemId) {
+ return super.addBean((BEANTYPE) itemId);
+ }
+
+ /**
+ * Adds the bean to the Container.
+ *
+ * The bean is used both as the item contents and as the item identifier.
+ *
+ * @param bean
+ * the bean
+ * @return the deep resolving bean item
+ * @see com.vaadin.data.Container#addItem(Object)
+ */
+ @Override
+ public DeepResolvingBeanItem<BEANTYPE> addBean(BEANTYPE bean) {
+ return addItem(bean);
+ }
+
+ /**
+ * Unsupported in BeanItemContainer.
+ *
+ * @param beanIdResolver
+ * the bean id resolver
+ * @throws UnsupportedOperationException
+ * the unsupported operation exception
+ */
+ @Override
+ protected void setBeanIdResolver(
+ AbstractDeepResolvingBeanContainer.BeanIdResolver<BEANTYPE, BEANTYPE> beanIdResolver)
+ throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(
+ "BeanItemContainer always uses an IdentityBeanIdResolver");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.common.data.ILazyRefreshFilterable#refreshFilters()
+ */
+ @Override
+ public void refreshFilters() {
+ // not used in this scenario since container applies filter immediately
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java
new file mode 100644
index 0000000..c30e38e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchService.java
@@ -0,0 +1,172 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.util.List;
+
+import org.eclipse.osbp.dsl.dto.lib.services.SortOrder;
+
+import com.vaadin.data.Container.Filter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IBeanSearchService.
+ *
+ * @param <BEAN>
+ * the generic type
+ */
+public interface IBeanSearchService<BEAN> {
+
+ /**
+ * Returns the count of all bean matching the filter.
+ *
+ * @param filters
+ * the filters
+ * @return the int
+ */
+ int size(List<Filter> filters);
+
+ /**
+ * Returns true, if the the bean exists for the given filter.
+ *
+ * @param bean
+ * the bean
+ * @param filters
+ * the filters
+ * @return true, if successful
+ */
+ boolean contains(BEAN bean, List<Filter> filters);
+
+ /**
+ * Returns the next bean for the given one using the filter and the
+ * sortOrder.
+ *
+ * @param bean
+ * the bean
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the next bean
+ */
+ BEAN getNextBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns the previous bean for the given one using the filter and the
+ * sortOrder.
+ *
+ * @param bean
+ * the bean
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the previous bean
+ */
+ BEAN getPreviousBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder);
+
+ /**
+ * Returns the first bean for the given filter and the sortOrder.
+ *
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the first bean
+ */
+ BEAN getFirstBean(List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns the last bean for the given filter and the sortOrder.
+ *
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the last bean
+ */
+ BEAN getLastBean(List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns true, if the given bean is the first one for the filter and
+ * sortOrder.
+ *
+ * @param bean
+ * the bean
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return true, if is first bean
+ */
+ boolean isFirstBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns true, if the given bean is the last one for the filter and
+ * sortOrder.
+ *
+ * @param bean
+ * the bean
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return true, if is last bean
+ */
+ boolean isLastBean(BEAN bean, List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns the index of the given bean for the filter and sortOrder.
+ *
+ * @param bean
+ * the bean
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the int
+ */
+ int indexOf(BEAN bean, List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns the bean for the given index, filter and sortOrder.
+ *
+ * @param index
+ * the index
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the bean by index
+ */
+ BEAN getBeanByIndex(int index, List<Filter> filters, SortOrder sortOrder);
+
+ /**
+ * Returns a list of beans with size &lt;= numberOfItems, starting from the
+ * startIndex in respect to the filter and sortOrder.
+ *
+ * @param startIndex
+ * the start index
+ * @param numberOfItems
+ * the number of items
+ * @param filters
+ * the filters
+ * @param sortOrder
+ * the sort order
+ * @return the beans by index
+ */
+ List<BEAN> getBeansByIndex(int startIndex, int numberOfItems,
+ List<Filter> filters, SortOrder sortOrder);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactory.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactory.java
new file mode 100644
index 0000000..56dc7dd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactory.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+
+
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+// TODO: Auto-generated Javadoc
+/**
+ * This factory is exposed as an OSGi service and will return new bean search
+ * service instances for the given bean type.
+ */
+public interface IBeanSearchServiceFactory {
+
+ /**
+ * Returns the {@link IBeanSearchService} for the given type. If no proper
+ * implementation could be found, an in memory service will be returned.
+ *
+ * @param <BEAN>
+ * the generic type
+ * @param type
+ * the type
+ * @return the i bean search service&lt; bea n&gt;
+ */
+ <BEAN> IBeanSearchService<BEAN> createService(Class<BEAN> type);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactoryDelegate.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactoryDelegate.java
new file mode 100644
index 0000000..95c4494
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IBeanSearchServiceFactoryDelegate.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+
+
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Implementations are factories used by the {@link IBeanSearchServiceFactory}.
+ * Delegates are hooked up by {@link IBeanSearchServiceFactory} and requests for
+ * proper services are delegated to the delegates.
+ */
+public interface IBeanSearchServiceFactoryDelegate {
+
+ /**
+ * Returns the {@link IBeanSearchService} for the given type. If no proper
+ * implementation could be found, <code>null</code> must be returned.
+ *
+ * @param <BEAN>
+ * the generic type
+ * @param bean
+ * the bean
+ * @return the i bean search service
+ */
+ <BEAN> IBeanSearchService<BEAN> createService(Class<BEAN> bean);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IClearable.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IClearable.java
new file mode 100644
index 0000000..c08b446
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/IClearable.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+/**
+ * Marks a clear able container.
+ */
+public interface IClearable {
+
+ /**
+ * Clears the container.
+ */
+ void clear();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/ILazyRefreshFilterable.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/ILazyRefreshFilterable.java
new file mode 100644
index 0000000..a30568f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/ILazyRefreshFilterable.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import com.vaadin.data.Container.Filterable;
+
+/**
+ * Used to remove the container filter without notification. Notifications are
+ * sent by adding filters or by calling {@link #refreshFilters()}.
+ */
+public interface ILazyRefreshFilterable extends Filterable {
+
+ /**
+ * Will refresh the filter.
+ */
+ void refreshFilters();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/INestedPropertyAble.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/INestedPropertyAble.java
new file mode 100644
index 0000000..73a9659
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/INestedPropertyAble.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import com.vaadin.data.util.NestedMethodProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface INestedPropertyAble.
+ *
+ * @param <BEANTYPE>
+ * the generic type
+ */
+public interface INestedPropertyAble<BEANTYPE> {
+
+ /**
+ * Adds a nested container property for the container, e.g.
+ * "manager.address.street".
+ *
+ * All intermediate getters must exist and should return non-null values
+ * when the property value is accessed. If an intermediate getter returns
+ * null, a null value will be returned.
+ *
+ * @param propertyId
+ * the property id
+ * @return true if the property was added
+ * @see NestedMethodProperty
+ */
+ public abstract boolean addNestedContainerProperty(String propertyId);
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java
new file mode 100644
index 0000000..d88dd0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchService.java
@@ -0,0 +1,175 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.util.List;
+
+import org.eclipse.osbp.dsl.dto.lib.services.IDTOService;
+import org.eclipse.osbp.dsl.dto.lib.services.IQuery;
+import org.eclipse.osbp.dsl.dto.lib.services.Query;
+import org.eclipse.osbp.dsl.dto.lib.services.SortOrder;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter;
+import org.eclipse.osbp.runtime.web.vaadin.common.services.filter.LFilterConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.filter.And;
+
+public class StatefulDelegatingDtoSearchService<BEAN> implements
+ IBeanSearchService<BEAN> {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(StatefulDelegatingDtoSearchService.class);
+
+ private final LFilterConverter converter = new LFilterConverter();
+ private final IDTOService<BEAN> delegate;
+ private final Class<BEAN> type;
+
+ public StatefulDelegatingDtoSearchService(IDTOService<BEAN> delegate,
+ Class<BEAN> type) {
+ this.delegate = delegate;
+ this.type = type;
+
+ if (delegate == null) {
+ LOGGER.error("Delegate could not be found for " + type);
+ }
+ }
+
+ private boolean checkDelegate() {
+ if (delegate == null) {
+ LOGGER.error("Delegate could not be found for " + type);
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int size(List<Filter> filters) {
+ if (!checkDelegate()) {
+ return 0;
+ }
+
+ return delegate.size(createQuery(filters));
+ }
+
+ /**
+ * Creats a query for the given filters.
+ *
+ * @param filters
+ * @return
+ */
+ private IQuery createQuery(List<Filter> filters) {
+ And vAnd = new And(filters.toArray(new Filter[filters.size()]));
+ ILFilter lAnd = converter.convert(vAnd);
+ return new Query(lAnd);
+ }
+
+ /**
+ * Creates a query for the given filter and sortOrder.
+ *
+ * @param filters
+ * @param sortOrder
+ * @return
+ */
+ private IQuery createQuery(List<Filter> filters, SortOrder sortOrder) {
+ And vAnd = new And(filters.toArray(new Filter[filters.size()]));
+ ILFilter lAnd = converter.convert(vAnd);
+ return new Query(lAnd, sortOrder);
+ }
+
+ @Override
+ public boolean contains(BEAN bean, List<Filter> filters) {
+ if (!checkDelegate()) {
+ return false;
+ }
+
+ return delegate.contains(bean, createQuery(filters));
+ }
+
+ @Override
+ public BEAN getNextBean(BEAN bean, List<Filter> filters, SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return null;
+ }
+ return delegate.getNext(bean, createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public BEAN getPreviousBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return null;
+ }
+ return delegate.getPrevious(bean, createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public BEAN getFirstBean(List<Filter> filters, SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return null;
+ }
+ return delegate.getFirst(createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public BEAN getLastBean(List<Filter> filters, SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return null;
+ }
+ return delegate.getLast(createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public boolean isFirstBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return false;
+ }
+ return delegate.isFirst(bean, createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public boolean isLastBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return false;
+ }
+ return delegate.isLast(bean, createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public int indexOf(BEAN bean, List<Filter> filters, SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return 0;
+ }
+ return delegate.indexOf(bean, createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public BEAN getBeanByIndex(int index, List<Filter> filters,
+ SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return null;
+ }
+ return delegate.getByIndex(index, createQuery(filters, sortOrder));
+ }
+
+ @Override
+ public List<BEAN> getBeansByIndex(int startIndex, int numberOfItems,
+ List<Filter> filters, SortOrder sortOrder) {
+ if (!checkDelegate()) {
+ return null;
+ }
+ return delegate.getByIndex(startIndex, numberOfItems,
+ createQuery(filters, sortOrder));
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java
new file mode 100644
index 0000000..15e8046
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulDelegatingDtoSearchServiceFactoryDelegate.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import org.eclipse.osbp.dsl.dto.lib.impl.DtoServiceAccess;
+import org.eclipse.osbp.dsl.dto.lib.services.IDTOService;
+import org.osgi.service.component.annotations.Component;
+
+/**
+ * Tries to create a bean search service backed by a DTO-Service.
+ */
+@SuppressWarnings("restriction")
+@Component
+public class StatefulDelegatingDtoSearchServiceFactoryDelegate implements
+ IBeanSearchServiceFactoryDelegate {
+
+ @Override
+ public <BEAN> IBeanSearchService<BEAN> createService(Class<BEAN> bean) {
+ // if a service that delegates to the database could be found, use it.
+ IDTOService<BEAN> service = DtoServiceAccess.getService(bean);
+ if (service != null) {
+ return new StatefulDelegatingDtoSearchService<BEAN>(service, bean);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java
new file mode 100644
index 0000000..cae29b2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/StatefulInMemoryBeanSearchService.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.osbp.dsl.dto.lib.services.SortOrder;
+
+import com.vaadin.data.Container.Filter;
+
+public class StatefulInMemoryBeanSearchService<BEAN> implements
+ IBeanSearchService<BEAN> {
+
+ private DeepResolvingBeanItemContainer<BEAN> delegate;
+
+ public StatefulInMemoryBeanSearchService(Class<BEAN> type) {
+ delegate = new DeepResolvingBeanItemContainer<BEAN>(type);
+ }
+
+ public void addBean(BEAN bean) {
+ delegate.addBean(bean);
+ }
+
+ public void addBeans(Collection<BEAN> beans) {
+ delegate.addAll(beans);
+ }
+
+ @Override
+ public int size(List<Filter> filters) {
+ setupContainer(filters);
+ return delegate.size();
+ }
+
+ @Override
+ public boolean contains(BEAN bean, List<Filter> filters) {
+ setupContainer(filters);
+ return delegate.containsId(bean);
+ }
+
+ protected void setupContainer(List<Filter> filters) {
+ delegate.removeAllContainerFilters();
+ for (Filter filter : filters) {
+ delegate.addContainerFilter(filter);
+ }
+ }
+
+ @Override
+ public BEAN getNextBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.nextItemId(bean);
+ }
+
+ @Override
+ public BEAN getPreviousBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.prevItemId(bean);
+ }
+
+ @Override
+ public BEAN getFirstBean(List<Filter> filters, SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.firstItemId();
+ }
+
+ @Override
+ public BEAN getLastBean(List<Filter> filters, SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.lastItemId();
+ }
+
+ @Override
+ public boolean isFirstBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.isFirstId(bean);
+ }
+
+ @Override
+ public boolean isLastBean(BEAN bean, List<Filter> filters,
+ SortOrder sortOrder) {
+ return delegate.isLastId(bean);
+ }
+
+ @Override
+ public int indexOf(BEAN bean, List<Filter> filters, SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.indexOfId(bean);
+ }
+
+ @Override
+ public BEAN getBeanByIndex(int index, List<Filter> filters,
+ SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.getIdByIndex(index);
+ }
+
+ @Override
+ public List<BEAN> getBeansByIndex(int startIndex, int numberOfItems,
+ List<Filter> filters, SortOrder sortOrder) {
+ setupContainer(filters);
+ return delegate.getItemIds(startIndex, numberOfItems);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/CollectionUtil.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/CollectionUtil.java
new file mode 100644
index 0000000..3c09532
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/CollectionUtil.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2009-2013 Oy Vaadin Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data.filter;
+
+import java.lang.reflect.Array;
+import java.util.Collection;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class CollectionUtil.
+ */
+public class CollectionUtil {
+
+ /** Converts a typed {@link Collection} to a typed array.
+ *
+ * @param <T>
+ * the generic type
+ * @param type
+ * the type class
+ * @param collection
+ * the collection to convert to an array.
+ * @return the array.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T[] toArray(Class<T> type, Collection<T> collection) {
+ return collection.toArray((T[]) Array.newInstance(type,
+ collection.size()));
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/Filters.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/Filters.java
new file mode 100644
index 0000000..7b44a23
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/Filters.java
@@ -0,0 +1,342 @@
+/**
+ * Copyright 2009-2013 Oy Vaadin Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Contributor: Florian Pirchner - Extracted Interface and converted to OSGi-service
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data.filter;
+
+import java.util.List;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.filter.And;
+import com.vaadin.data.util.filter.Between;
+import com.vaadin.data.util.filter.Compare.Equal;
+import com.vaadin.data.util.filter.Compare.Greater;
+import com.vaadin.data.util.filter.Compare.GreaterOrEqual;
+import com.vaadin.data.util.filter.Compare.Less;
+import com.vaadin.data.util.filter.Compare.LessOrEqual;
+import com.vaadin.data.util.filter.IsNull;
+import com.vaadin.data.util.filter.Like;
+import com.vaadin.data.util.filter.Not;
+import com.vaadin.data.util.filter.Or;
+import com.vaadin.data.util.filter.SimpleStringFilter;
+
+/**
+ * Utility class for creating filter instances.
+ *
+ * @author Petter Holmström (Vaadin Ltd)
+ * @since 1.0
+ */
+public final class Filters {
+
+ public Filters() {
+ // To prevent applications from creating instances of this class.
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#isNull(java
+ * .lang.Object)
+ */
+
+ public Filter isNull(Object propertyId) {
+ return new IsNull(propertyId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#isNotNull(
+ * java.lang.Object)
+ */
+
+ public Filter isNotNull(Object propertyId) {
+ return new Not(isNull(propertyId));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#isEmpty(java
+ * .lang.Object)
+ */
+
+ public Filter isEmpty(Object propertyId) {
+ return new Equal(propertyId, "");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#isNotEmpty
+ * (java.lang.Object)
+ */
+
+ public Filter isNotEmpty(Object propertyId) {
+ return new Not(isEmpty(propertyId));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#eq(java.lang
+ * .Object, java.lang.String, boolean)
+ */
+
+ public Filter eq(Object propertyId, String value, boolean caseSensitive) {
+ return new SimpleStringFilter(propertyId, value, !caseSensitive, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#like(java.
+ * lang.Object, java.lang.String, boolean)
+ */
+
+ public Filter like(Object propertyId, String value, boolean caseSensitive) {
+ return new Like(propertyId.toString(), value, caseSensitive);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#eq(java.lang
+ * .Object, java.lang.Object)
+ */
+
+ public Filter eq(Object propertyId, Object value) {
+ return new Equal(propertyId, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#gteq(java.
+ * lang.Object, java.lang.Object)
+ */
+
+ public Filter gteq(Object propertyId, Object value) {
+ return new GreaterOrEqual(propertyId, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#gt(java.lang
+ * .Object, java.lang.Object)
+ */
+
+ public Filter gt(Object propertyId, Object value) {
+ return new Greater(propertyId, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#lteq(java.
+ * lang.Object, java.lang.Object)
+ */
+
+ public Filter lteq(Object propertyId, Object value) {
+ return new LessOrEqual(propertyId, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#lt(java.lang
+ * .Object, java.lang.Object)
+ */
+
+ public Filter lt(Object propertyId, Object value) {
+ return new Less(propertyId, value);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#between(java
+ * .lang.Object, java.lang.Comparable, java.lang.Comparable)
+ */
+
+ public Filter between(Object propertyId, Comparable<?> startingPoint,
+ Comparable<?> endingPoint) {
+ return new Between(propertyId, startingPoint, endingPoint);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#between(java
+ * .lang.Object, java.lang.Object, java.lang.Object, boolean, boolean)
+ */
+
+ public Filter between(Object propertyId, Object startingPoint,
+ Object endingPoint, boolean includeStartingPoint,
+ boolean includeEndingPoint) {
+ return new And((includeStartingPoint ? new GreaterOrEqual(propertyId,
+ startingPoint) : new Greater(propertyId, startingPoint)),
+ (includeEndingPoint ? new LessOrEqual(propertyId, endingPoint)
+ : new Less(propertyId, endingPoint)));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#betweenInclusive
+ * (java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+
+ public Filter betweenInclusive(Object propertyId, Object startingPoint,
+ Object endingPoint) {
+ return between(propertyId, startingPoint, endingPoint, true, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#betweenExlusive
+ * (java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+
+ public Filter betweenExlusive(Object propertyId, Object startingPoint,
+ Object endingPoint) {
+ return between(propertyId, startingPoint, endingPoint, false, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#outside(java
+ * .lang.Object, java.lang.Object, java.lang.Object, boolean, boolean)
+ */
+
+ public Filter outside(Object propertyId, Object startingPoint,
+ Object endingPoint, boolean includeStartingPoint,
+ boolean includeEndingPoint) {
+ return new Or((includeStartingPoint ? new LessOrEqual(propertyId,
+ startingPoint) : new Less(propertyId, startingPoint)),
+ (includeEndingPoint ? new GreaterOrEqual(propertyId,
+ endingPoint) : new Greater(propertyId, endingPoint)));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#outsideInclusive
+ * (java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+
+ public Filter outsideInclusive(Object propertyId, Object startingPoint,
+ Object endingPoint) {
+ return outside(propertyId, startingPoint, endingPoint, true, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#outsideExclusive
+ * (java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+
+ public Filter outsideExclusive(Object propertyId, Object startingPoint,
+ Object endingPoint) {
+ return outside(propertyId, startingPoint, endingPoint, false, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#not(com.vaadin
+ * .data.Container.Filter)
+ */
+
+ public Filter not(Filter filter) {
+ return new Not(filter);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#and(com.vaadin
+ * .data.Container.Filter)
+ */
+
+ public And and(Filter... filters) {
+ return new And(filters);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#and(java.util
+ * .List)
+ */
+
+ public And and(List<Filter> filters) {
+ return new And(CollectionUtil.toArray(Filter.class, filters));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#or(com.vaadin
+ * .data.Container.Filter)
+ */
+
+ public Or or(Filter... filters) {
+ return new Or(filters);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osbp.runtime.web.vaadin.filter.jpa.IFilterProvider#or(java.util
+ * .List)
+ */
+ public Or or(List<Filter> filters) {
+ return new Or(CollectionUtil.toArray(Filter.class, filters));
+ }
+
+ public JoinFilter joinFilter(String joinProperty, Filter... filters) {
+ return new JoinFilter(joinProperty, filters);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java
new file mode 100644
index 0000000..8363e5e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/data/filter/JoinFilter.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2009-2013 Oy Vaadin Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.data.filter;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.Item;
+import com.vaadin.data.util.filter.AbstractJunctionFilter;
+
+/**
+ * This filter allows you to implement filtering on joined tables using
+ * Hibernate, which lacks support for automatic joins. EclipseLink supports
+ * automatic joins, which allows you to filter by e.g.
+ * <code>new Equal("skills.skill", s)</code>, while Hibernate requires you to do
+ * the same using this filter e.g.
+ * <code>new JoinFilter("skills", new Equal("skill", s))</code>
+ */
+@SuppressWarnings("serial")
+public class JoinFilter extends AbstractJunctionFilter {
+
+ private final String joinProperty;
+
+ /**
+ * Constructs a HibernateJoin filter.
+ *
+ * @param joinProperty
+ * the property that should be joined
+ * @param filters
+ * a set of filters filtering on the joined property. By default
+ * all filters much pass for the item to be matched.
+ */
+ public JoinFilter(String joinProperty, Filter... filters) {
+ super(filters);
+ this.joinProperty = joinProperty;
+ }
+
+ /**
+ * @return the property that is joined on
+ */
+ public String getJoinProperty() {
+ return joinProperty;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.Container.Filter#passesFilter(java.lang.Object,
+ * com.vaadin.data.Item)
+ */
+ public boolean passesFilter(Object itemId, Item item)
+ throws UnsupportedOperationException {
+ for (Filter f : getFilters()) {
+ if (!f.passesFilter(itemId, item)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/IResourceProvider.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/IResourceProvider.java
new file mode 100644
index 0000000..b1c9722
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/IResourceProvider.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.resource;
+
+import com.vaadin.server.Resource;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IResourceProvider.
+ */
+public interface IResourceProvider {
+
+ /**
+ * Returns the vaadin resource for the given path.
+ *
+ * @param resourcePath
+ * the resource path
+ * @return the resource
+ */
+ Resource getResource(String resourcePath);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/impl/ThemeResourceProvider.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/impl/ThemeResourceProvider.java
new file mode 100644
index 0000000..efd2796
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/resource/impl/ThemeResourceProvider.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.common.resource.impl;
+
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+import org.osgi.service.component.annotations.Component;
+
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+
+/**
+ * Default implementation.
+ */
+@Component(service = IResourceProvider.class)
+public class ThemeResourceProvider implements IResourceProvider {
+
+ @Override
+ public Resource getResource(String resourcePath) {
+ return new ThemeResource(resourcePath);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java
new file mode 100644
index 0000000..0e0b98c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToOSBPFilterConverter.java
@@ -0,0 +1,121 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.services.filter;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LCompare;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot;
+import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraint;
+import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraints;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Converts filter annotations to osbp filters.
+ */
+public class AnnotationToOSBPFilterConverter {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(AnnotationToOSBPFilterConverter.class);
+
+ /**
+ * Creates zero or more filters for the given annotation. If more filters
+ * are being created, they will be put into an And-Filter.<br>
+ * Returns <code>null</code> if no filter have been created.
+ *
+ * @param annotation
+ * the annotation
+ * @return the IL filter
+ */
+ public static ILFilter createFilter(TargetEnumConstraints annotation) {
+ if (annotation != null) {
+ Set<ILFilter> filters = new HashSet<ILFilter>();
+ for (TargetEnumConstraint constraint : annotation.constraints()) {
+ ILFilter filter = createFilterFor(constraint);
+ if (filter != null) {
+ filters.add(filter);
+ }
+ }
+ if (filters.size() == 1) {
+ return filters.iterator().next();
+ } else if (filters.size() > 1) {
+ return new LAnd(filters.toArray(new ILFilter[filters.size()]));
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Creates one filter for the given annotation.
+ *
+ * @param constraint
+ * the constraint
+ * @return the IL filter
+ */
+ public static ILFilter createFilterFor(TargetEnumConstraint constraint) {
+ if (constraint == null) {
+ return null;
+ }
+ Enum<?> enumLiteral = null;
+ try {
+ @SuppressWarnings("unchecked")
+ Class<Enum<?>> enumClass = (Class<Enum<?>>) constraint.enumClass();
+ for (Enum<?> enumx : enumClass.getEnumConstants()) {
+ if (enumx.name().equals(enumLiteral)) {
+ enumLiteral = enumx;
+ break;
+ }
+ }
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ }
+
+ if (enumLiteral == null) {
+ return null;
+ }
+
+ ILFilter result = null;
+ switch (constraint.compareType()) {
+ case EQUALS:
+ result = new LCompare.Equal(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case GREATER:
+ result = new LCompare.Greater(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case GREATER_EQ:
+ result = new LCompare.GreaterOrEqual(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case LOWER:
+ result = new LCompare.Less(constraint.targetProperty(), enumLiteral);
+ break;
+ case LOWER_EQ:
+ result = new LCompare.LessOrEqual(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case NOT_EQ:
+ result = new LNot(new LCompare.Equal(constraint.targetProperty(),
+ enumLiteral));
+ break;
+ }
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToVaadinFilterConverter.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToVaadinFilterConverter.java
new file mode 100644
index 0000000..9322e83
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/AnnotationToVaadinFilterConverter.java
@@ -0,0 +1,121 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.services.filter;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraint;
+import org.eclipse.osbp.runtime.common.annotations.TargetEnumConstraints;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.filter.And;
+import com.vaadin.data.util.filter.Compare;
+import com.vaadin.data.util.filter.Not;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Converts filter annotations to vaadin filters.
+ */
+public class AnnotationToVaadinFilterConverter {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(AnnotationToVaadinFilterConverter.class);
+
+ /**
+ * Creates zero or more filters for the given annotation. If more filters
+ * are being created, they will be put into an And-Filter.<br>
+ * Returns <code>null</code> if no filter have been created.
+ *
+ * @param annotation
+ * the annotation
+ * @return the filter
+ */
+ public static Filter createFilter(TargetEnumConstraints annotation) {
+ if (annotation != null) {
+ Set<Filter> filters = new HashSet<Filter>();
+ for (TargetEnumConstraint constraint : annotation.constraints()) {
+ Filter filter = createFilterFor(constraint);
+ if (filter != null) {
+ filters.add(filter);
+ }
+ }
+ if (filters.size() == 1) {
+ return filters.iterator().next();
+ } else if (filters.size() > 1) {
+ return new And(filters.toArray(new Filter[filters.size()]));
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Creates one filter for the given annotation.
+ *
+ * @param constraint
+ * the constraint
+ * @return the filter
+ */
+ public static Filter createFilterFor(TargetEnumConstraint constraint) {
+ if (constraint == null) {
+ return null;
+ }
+ Enum<?> enumLiteral = null;
+ try {
+ @SuppressWarnings("unchecked")
+ Class<Enum<?>> enumClass = (Class<Enum<?>>) constraint.enumClass();
+ for (Enum<?> enumx : enumClass.getEnumConstants()) {
+ if (enumx.name().equals(constraint.enumLiteral())) {
+ enumLiteral = enumx;
+ break;
+ }
+ }
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ }
+
+ if (enumLiteral == null) {
+ return null;
+ }
+
+ Filter result = null;
+ switch (constraint.compareType()) {
+ case EQUALS:
+ result = new Compare.Equal(constraint.targetProperty(), enumLiteral);
+ break;
+ case GREATER:
+ result = new Compare.Greater(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case GREATER_EQ:
+ result = new Compare.GreaterOrEqual(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case LOWER:
+ result = new Compare.Less(constraint.targetProperty(), enumLiteral);
+ break;
+ case LOWER_EQ:
+ result = new Compare.LessOrEqual(constraint.targetProperty(),
+ enumLiteral);
+ break;
+ case NOT_EQ:
+ result = new Not(new Compare.Equal(constraint.targetProperty(),
+ enumLiteral));
+ break;
+ }
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend
new file mode 100644
index 0000000..019ec19
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.xtend
@@ -0,0 +1,106 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.services.filter
+
+import com.vaadin.data.Container
+import com.vaadin.data.util.filter.And
+import com.vaadin.data.util.filter.Between
+import com.vaadin.data.util.filter.Compare
+import com.vaadin.data.util.filter.IsNull
+import com.vaadin.data.util.filter.Like
+import com.vaadin.data.util.filter.Not
+import com.vaadin.data.util.filter.Or
+import com.vaadin.data.util.filter.SimpleStringFilter
+import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LBetween
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LCompare
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LIsNull
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LLike
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LOr
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LSimpleStringFilter
+
+/**
+ * This converter will convert from Vaadin-Filters to OSBP-Filters.
+ * OSBP-Filters are more common and used by the data services. For instance
+ * JPAServices to access data.
+ */
+class LFilterConverter {
+
+ def dispatch ILFilter convert(Container.Filter vFilter) {
+ throw new UnsupportedOperationException("Not a valid type: " + vFilter)
+ }
+
+ def dispatch ILFilter convert(And vFilter) {
+
+ val children = newArrayList()
+ vFilter.filters.forEach [
+ children += it.convert
+ ]
+
+ val result = new LAnd(children)
+ return result;
+ }
+
+ def dispatch ILFilter convert(Or vFilter) {
+
+ val children = newArrayList()
+ vFilter.filters.forEach [
+ children += it.convert
+ ]
+
+ val result = new LOr(children)
+ return result;
+ }
+
+ def dispatch ILFilter convert(Between vFilter) {
+ return new LBetween(vFilter.propertyId, vFilter.startValue, vFilter.endValue)
+ }
+
+ def dispatch ILFilter convert(Compare.Equal vFilter) {
+ return new LCompare.Equal(vFilter.propertyId, vFilter.value)
+ }
+
+ def dispatch ILFilter convert(Compare.Greater vFilter) {
+ return new LCompare.Greater(vFilter.propertyId, vFilter.value)
+ }
+
+ def dispatch ILFilter convert(Compare.GreaterOrEqual vFilter) {
+ return new LCompare.GreaterOrEqual(vFilter.propertyId, vFilter.value)
+ }
+
+ def dispatch ILFilter convert(Compare.Less vFilter) {
+ return new LCompare.Less(vFilter.propertyId, vFilter.value)
+ }
+
+ def dispatch ILFilter convert(Compare.LessOrEqual vFilter) {
+ return new LCompare.LessOrEqual(vFilter.propertyId, vFilter.value)
+ }
+
+ def dispatch ILFilter convert(IsNull vFilter) {
+ return new LIsNull(vFilter.propertyId)
+ }
+
+ def dispatch ILFilter convert(Like vFilter) {
+ return new LLike(vFilter.propertyId, vFilter.value)
+ }
+
+ def dispatch ILFilter convert(Not vFilter) {
+ return new LNot(vFilter.filter.convert)
+ }
+
+ def dispatch ILFilter convert(SimpleStringFilter vFilter) {
+ return new LSimpleStringFilter(vFilter.propertyId, vFilter.filterString, vFilter.ignoreCase,
+ vFilter.onlyMatchPrefix)
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/sharedState/SharedStateUtil.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/sharedState/SharedStateUtil.java
new file mode 100644
index 0000000..8eadf67
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/sharedState/SharedStateUtil.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.sharedState;
+
+import java.util.Map;
+
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Vaadin util to find a shared state if available.
+ */
+public class SharedStateUtil {
+
+ /**
+ * Tries to find the {@link ISharedStateContext} registered with the Vaadin
+ * component. It also iterates the parents recursively to find it.
+ *
+ * @param component
+ * the component
+ * @return the shared state
+ */
+ public static ISharedStateContext getSharedState(Component component) {
+ if (component == null) {
+ return null;
+ }
+ if (component instanceof AbstractComponent) {
+ AbstractComponent comp = (AbstractComponent) component;
+ if (comp.getData() != null && (comp.getData() instanceof Map)) {
+ @SuppressWarnings("unchecked")
+ Map<Object, Object> map = (Map<Object, Object>) comp.getData();
+ ISharedStateContext sharedState = (ISharedStateContext) map
+ .get(ISharedStateContext.class);
+ if (sharedState != null) {
+ return sharedState;
+ }
+ }
+ }
+ return getSharedState(component.getParent());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutHandler.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutHandler.java
new file mode 100644
index 0000000..7aa4ac7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutHandler.java
@@ -0,0 +1,152 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.shortcuts;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.eclipse.osbp.runtime.common.keystroke.KeyStrokeCallback;
+import org.eclipse.osbp.runtime.common.keystroke.KeyStrokeDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.event.ActionManager;
+import com.vaadin.event.ShortcutListener;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Panel;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Is responsible to add shortcut listeners to the root panel. And to remove
+ * them too.
+ * <p>
+ * Attention: There must be a panel in the parent hierarchy of the component be
+ * available. Otherwise an Exception is thrown during activate.
+ */
+public class ShortcutHandler {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(ShortcutHandler.class);
+
+ /** The def. */
+ private KeyStrokeDefinition def;
+
+ /** The callback. */
+ private KeyStrokeCallback callback;
+
+ /** The component. */
+ private Component component;
+
+ /** The root panel. */
+ private Panel rootPanel;
+
+ /** The listener. */
+ private ShortcutListener listener;
+
+ /**
+ * Instantiates a new shortcut handler.
+ *
+ * @param def
+ * the def
+ * @param callback
+ * the callback
+ * @param component
+ * the component
+ */
+ public ShortcutHandler(KeyStrokeDefinition def, KeyStrokeCallback callback,
+ Component component) {
+ super();
+ this.def = def;
+ this.callback = callback;
+ this.component = component;
+ }
+
+ /**
+ * Tries to find a panel in the parent hierarchy.
+ *
+ * @param component
+ * the component
+ * @return the panel
+ */
+ protected Panel findPanel(Component component) {
+
+ if (component == null) {
+ return null;
+ }
+
+ if (component instanceof Panel) {
+ return (Panel) component;
+ }
+
+ return findPanel(component.getParent());
+ }
+
+ /**
+ * Activate.
+ */
+ @SuppressWarnings("serial")
+ public void activate() {
+
+ if (rootPanel == null) {
+ this.rootPanel = findPanel(component);
+
+ if (rootPanel == null) {
+ throw new IllegalStateException(
+ "No root panel found. Can not attach shortcutListener to component.");
+ }
+ }
+
+ if (listener == null) {
+ this.listener = new ShortcutListener(def.getCaption(),
+ def.getKeyCode(), def.getModifierKeys()) {
+ @Override
+ public void handleAction(Object sender, Object target) {
+ callback.callback(sender, target);
+ }
+ };
+ }
+
+ ActionManager manager = getActionManager();
+ manager.addAction(listener);
+ }
+
+ /**
+ * Deactivate.
+ */
+ public void deactivate() {
+ ActionManager manager = getActionManager();
+ manager.removeAction(listener);
+ }
+
+ /**
+ * Gets the action manager.
+ *
+ * @return the action manager
+ */
+ protected ActionManager getActionManager() {
+ ActionManager actionManager = null;
+ try {
+ Method m = AbstractComponent.class.getDeclaredMethod(
+ "getActionManager", new Class[0]);
+ if (!m.isAccessible()) {
+ m.setAccessible(true);
+ }
+ actionManager = (ActionManager) m.invoke(rootPanel, new Object[0]);
+ } catch (NoSuchMethodException | IllegalAccessException
+ | InvocationTargetException e) {
+ LOGGER.error("{}", e);
+ }
+ return actionManager;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutManager.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutManager.java
new file mode 100644
index 0000000..f3be289
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/shortcuts/ShortcutManager.java
@@ -0,0 +1,140 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.shortcuts;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Handles ShortcutHandlers.
+ */
+public class ShortcutManager {
+
+ /** The handlers. */
+ private Map<Component, Set<ShortcutHandler>> handlers = new HashMap<Component, Set<ShortcutHandler>>();
+
+ /** The active component. */
+ private Component activeComponent;
+
+ /**
+ * Registers a new handler for the component.
+ *
+ * @param component
+ * the component
+ * @param handler
+ * the handler
+ */
+ public void register(Component component, ShortcutHandler handler) {
+
+ if (!handlers.containsKey(component)) {
+ handlers.put(component, new HashSet<ShortcutHandler>());
+ }
+
+ Set<ShortcutHandler> temp = handlers.get(component);
+ temp.add(handler);
+ }
+
+ /**
+ * Unregisters the handler for the component. The handler will be
+ * deactivated.
+ *
+ * @param component
+ * the component
+ * @param handler
+ * the handler
+ */
+ public void unregister(Component component, ShortcutHandler handler) {
+
+ if (!handlers.containsKey(component)) {
+ return;
+ }
+
+ Set<ShortcutHandler> temp = handlers.get(component);
+ temp.remove(handler);
+
+ // deactivate handler
+ handler.deactivate();
+ }
+
+ /**
+ * Unregisters all handlers for the component. Handlers will be deactivated.
+ *
+ * @param component
+ * the component
+ */
+ public void unregister(Component component) {
+ Set<ShortcutHandler> temp = handlers.remove(component);
+ for (ShortcutHandler handler : temp) {
+ handler.deactivate();
+ }
+ }
+
+ /**
+ * Activates all handlers for the component.
+ *
+ * @param component
+ * the component
+ */
+ public void activate(Component component) {
+ if (this.activeComponent != null) {
+ deactivate(this.activeComponent);
+ }
+
+ this.activeComponent = component;
+
+ if (!handlers.containsKey(component)) {
+ return;
+ }
+
+ Set<ShortcutHandler> temp = handlers.get(component);
+ for (ShortcutHandler handler : temp) {
+ handler.activate();
+ }
+ }
+
+ /**
+ * Deactivates all handlers for the component.
+ *
+ * @param component
+ * the component
+ */
+ public void deactivate(Component component) {
+
+ if (this.activeComponent == component) {
+ this.activeComponent = null;
+ }
+
+ if (!handlers.containsKey(component)) {
+ return;
+ }
+
+ Set<ShortcutHandler> temp = handlers.get(component);
+ for (ShortcutHandler handler : temp) {
+ handler.deactivate();
+ }
+ }
+
+ /**
+ * Checks if is handled.
+ *
+ * @param component
+ * the component
+ * @return true, if is handled
+ */
+ public boolean isHandled(Component component) {
+ return handlers.containsKey(component);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/validator/BeanValidationValidator.java b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/validator/BeanValidationValidator.java
new file mode 100644
index 0000000..f89aa0f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/src/org/eclipse/osbp/runtime/web/vaadin/common/validator/BeanValidationValidator.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.validator;
+
+import com.vaadin.data.validator.AbstractValidator;
+
+@SuppressWarnings("serial")
+public class BeanValidationValidator<T> extends AbstractValidator<T> {
+
+ public BeanValidationValidator(String errorMessage) {
+ super(errorMessage);
+
+ }
+
+ @Override
+ protected boolean isValidValue(T value) {
+ return false;
+ }
+
+ @Override
+ public Class<T> getType() {
+ return null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java
new file mode 100644
index 0000000..f7a75d9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.common/xtend-gen/org/eclipse/osbp/runtime/web/vaadin/common/services/filter/LFilterConverter.java
@@ -0,0 +1,171 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.common.services.filter;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.filter.And;
+import com.vaadin.data.util.filter.Between;
+import com.vaadin.data.util.filter.Compare;
+import com.vaadin.data.util.filter.IsNull;
+import com.vaadin.data.util.filter.Like;
+import com.vaadin.data.util.filter.Not;
+import com.vaadin.data.util.filter.Or;
+import com.vaadin.data.util.filter.SimpleStringFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.function.Consumer;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.ILFilter;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LAnd;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LBetween;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LCompare;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LIsNull;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LLike;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LNot;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LOr;
+import org.eclipse.osbp.dsl.dto.lib.services.filters.LSimpleStringFilter;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.eclipse.xtext.xbase.lib.Conversions;
+
+/**
+ * This converter will convert from Vaadin-Filters to OSBP-Filters.
+ * OSBP-Filters are more common and used by the data services. For instance
+ * JPAServices to access data.
+ */
+@SuppressWarnings("all")
+public class LFilterConverter {
+ protected ILFilter _convert(final Container.Filter vFilter) {
+ throw new UnsupportedOperationException(("Not a valid type: " + vFilter));
+ }
+
+ protected ILFilter _convert(final And vFilter) {
+ final ArrayList<ILFilter> children = CollectionLiterals.<ILFilter>newArrayList();
+ Collection<Container.Filter> _filters = vFilter.getFilters();
+ final Consumer<Container.Filter> _function = new Consumer<Container.Filter>() {
+ public void accept(final Container.Filter it) {
+ ILFilter _convert = LFilterConverter.this.convert(it);
+ children.add(_convert);
+ }
+ };
+ _filters.forEach(_function);
+ final LAnd result = new LAnd(((ILFilter[])Conversions.unwrapArray(children, ILFilter.class)));
+ return result;
+ }
+
+ protected ILFilter _convert(final Or vFilter) {
+ final ArrayList<ILFilter> children = CollectionLiterals.<ILFilter>newArrayList();
+ Collection<Container.Filter> _filters = vFilter.getFilters();
+ final Consumer<Container.Filter> _function = new Consumer<Container.Filter>() {
+ public void accept(final Container.Filter it) {
+ ILFilter _convert = LFilterConverter.this.convert(it);
+ children.add(_convert);
+ }
+ };
+ _filters.forEach(_function);
+ final LOr result = new LOr(((ILFilter[])Conversions.unwrapArray(children, ILFilter.class)));
+ return result;
+ }
+
+ protected ILFilter _convert(final Between vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ Comparable<?> _startValue = vFilter.getStartValue();
+ Comparable<?> _endValue = vFilter.getEndValue();
+ return new LBetween(_propertyId, _startValue, _endValue);
+ }
+
+ protected ILFilter _convert(final Compare.Equal vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ Object _value = vFilter.getValue();
+ return new LCompare.Equal(_propertyId, _value);
+ }
+
+ protected ILFilter _convert(final Compare.Greater vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ Object _value = vFilter.getValue();
+ return new LCompare.Greater(_propertyId, _value);
+ }
+
+ protected ILFilter _convert(final Compare.GreaterOrEqual vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ Object _value = vFilter.getValue();
+ return new LCompare.GreaterOrEqual(_propertyId, _value);
+ }
+
+ protected ILFilter _convert(final Compare.Less vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ Object _value = vFilter.getValue();
+ return new LCompare.Less(_propertyId, _value);
+ }
+
+ protected ILFilter _convert(final Compare.LessOrEqual vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ Object _value = vFilter.getValue();
+ return new LCompare.LessOrEqual(_propertyId, _value);
+ }
+
+ protected ILFilter _convert(final IsNull vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ return new LIsNull(_propertyId);
+ }
+
+ protected ILFilter _convert(final Like vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ String _value = vFilter.getValue();
+ return new LLike(_propertyId, _value);
+ }
+
+ protected ILFilter _convert(final Not vFilter) {
+ Container.Filter _filter = vFilter.getFilter();
+ ILFilter _convert = this.convert(_filter);
+ return new LNot(_convert);
+ }
+
+ protected ILFilter _convert(final SimpleStringFilter vFilter) {
+ Object _propertyId = vFilter.getPropertyId();
+ String _filterString = vFilter.getFilterString();
+ boolean _isIgnoreCase = vFilter.isIgnoreCase();
+ boolean _isOnlyMatchPrefix = vFilter.isOnlyMatchPrefix();
+ return new LSimpleStringFilter(_propertyId, _filterString, _isIgnoreCase, _isOnlyMatchPrefix);
+ }
+
+ public ILFilter convert(final Container.Filter vFilter) {
+ if (vFilter instanceof And) {
+ return _convert((And)vFilter);
+ } else if (vFilter instanceof Compare.Equal) {
+ return _convert((Compare.Equal)vFilter);
+ } else if (vFilter instanceof Compare.Greater) {
+ return _convert((Compare.Greater)vFilter);
+ } else if (vFilter instanceof Compare.GreaterOrEqual) {
+ return _convert((Compare.GreaterOrEqual)vFilter);
+ } else if (vFilter instanceof Compare.Less) {
+ return _convert((Compare.Less)vFilter);
+ } else if (vFilter instanceof Compare.LessOrEqual) {
+ return _convert((Compare.LessOrEqual)vFilter);
+ } else if (vFilter instanceof Or) {
+ return _convert((Or)vFilter);
+ } else if (vFilter instanceof Between) {
+ return _convert((Between)vFilter);
+ } else if (vFilter instanceof IsNull) {
+ return _convert((IsNull)vFilter);
+ } else if (vFilter instanceof Like) {
+ return _convert((Like)vFilter);
+ } else if (vFilter instanceof Not) {
+ return _convert((Not)vFilter);
+ } else if (vFilter instanceof SimpleStringFilter) {
+ return _convert((SimpleStringFilter)vFilter);
+ } else if (vFilter != null) {
+ return _convert(vFilter);
+ } else {
+ throw new IllegalArgumentException("Unhandled parameter types: " +
+ Arrays.<Object>asList(vFilter).toString());
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project
new file mode 100644
index 0000000..b5acbae
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.components.widget</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.components.widget/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..7f6bf3a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.components.widget
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.components.widget
+Bundle-Version: 0.9.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.osbp.runtime.web.vaadin.components.widget;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.widget.client;version="0.9.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse OSBP
+Import-Package: org.slf4j;version="1.7.2"
+Require-Bundle: com.vaadin.client;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ org.jsoup;bundle-version="1.7.2"
+OSBP-ECView-I18nProvider:
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.html b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.ini b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.properties b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.properties
new file mode 100644
index 0000000..b924c06
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.components.widget
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/build.properties b/org.eclipse.osbp.runtime.web.vaadin.components.widget/build.properties
new file mode 100644
index 0000000..66d168d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/build.properties
@@ -0,0 +1,10 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ .classpath,\
+ .project,\
+ .settings/,\
+ src/,\
+ LICENSE.txt
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml
new file mode 100644
index 0000000..2f7f167
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml
@@ -0,0 +1,190 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.components.widget</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <vaadin.version>7.5.7</vaadin.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared-deps</artifactId>
+ <scope>provided</scope>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <!-- This add sources, .gwt.xml files etc to jar from source directory.
+ Not quite maven convention byt easiest to setup this way. -->
+ <directory>src</directory>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ </resource>
+ </resources>
+ <sourceDirectory>src</sourceDirectory>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+<!-- <includes> -->
+<<<<<<< HEAD:org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml
+<!-- <include>org/osbp/runtime/web/vaadin/components/widgets/*.java</include> -->
+=======
+<!-- <include>org.eclipse.osbp/runtime/web/vaadin/components/widgets/*.java</include> -->
+>>>>>>> development:org.eclipse.osbp.runtime.web.vaadin.components.widget/pom-compileWidgetset.xml
+<!-- </includes> -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
+ <!-- <runTarget>mobilemail</runTarget> -->
+ <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
+ way compatible with Vaadin eclipse plugin. -->
+ <webappDirectory>${basedir}/VAADIN/widgetsets
+ </webappDirectory>
+ <hostedWebapp>${basedir}/VAADIN/widgetsets
+ </hostedWebapp>
+ <noServer>true</noServer>
+ <!-- Remove draftCompile when project is ready -->
+ <draftCompile>true</draftCompile>
+ <strict>true</strict>
+ <compileReport>false</compileReport>
+ <style>PRETTY</style>
+ <logLevel>INFO</logLevel>
+ <runTarget>http://localhost:8080/</runTarget>
+
+ <!-- Remove these when going to release dependencies -->
+ <force>true</force>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
+ <!-- directory is cleaned properly -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${basedir}/VAADIN/widgetsets</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml
new file mode 100644
index 0000000..50b27ab
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/pom.xml
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.components.widget</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <vaadin.version>7.5.7</vaadin.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared-deps</artifactId>
+ <scope>provided</scope>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <!-- This add sources, .gwt.xml files etc to jar from source directory.
+ Not quite maven convention byt easiest to setup this way. -->
+ <directory>src</directory>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ </resource>
+ </resources>
+ <sourceDirectory>src</sourceDirectory>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <!-- <includes> -->
+ <!-- <include>org/eclipse/osbp/runtime/web/vaadin/components/widgets/*.java</include> -->
+ <!-- </includes> -->
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
+ <!-- <runTarget>mobilemail</runTarget> -->
+ <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
+ way compatible with Vaadin eclipse plugin. -->
+ <webappDirectory>${basedir}/VAADIN/widgetsets
+ </webappDirectory>
+ <hostedWebapp>${basedir}/VAADIN/widgetsets
+ </hostedWebapp>
+ <noServer>true</noServer>
+ <!-- Remove draftCompile when project is ready -->
+ <draftCompile>true</draftCompile>
+ <strict>true</strict>
+ <compileReport>false</compileReport>
+ <style>PRETTY</style>
+ <logLevel>INFO</logLevel>
+ <runTarget>http://localhost:8080/</runTarget>
+
+ <!-- Remove these when going to release dependencies -->
+ <force>true</force>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
+ <!-- directory is cleaned properly -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${basedir}/VAADIN/widgetsets</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-compiler-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <compilerVersion>1.8</compilerVersion>
+ <encoding>UTF-8</encoding>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldClientRpc.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldClientRpc.java
new file mode 100644
index 0000000..1f12aeb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldClientRpc.java
@@ -0,0 +1,10 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.vaadin.shared.communication.ClientRpc;
+
+public interface EntityFieldClientRpc extends ClientRpc {
+
+ // TODO example API
+ public void alert(String message);
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldConnector.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldConnector.java
new file mode 100644
index 0000000..7c9540e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/EntityFieldConnector.java
@@ -0,0 +1,170 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.EntityField;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.shared.EntityFieldState;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.VTooltip;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.Icon;
+import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
+import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
+import com.vaadin.shared.ui.Connect;
+
+@Connect(EntityField.class)
+public class EntityFieldConnector extends AbstractFieldConnector implements
+ FocusHandler, BlurHandler, ClickHandler, ChangeHandler, KeyDownHandler,
+ MouseUpHandler {
+
+ private ShortcutActionHandlerOwner hasShortcutActionHandler;
+
+ @Override
+ public boolean delegateCaptionHandling() {
+ return false;
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ getWidget().init(this);
+ getWidget().client = getConnection();
+ getWidget().id = getConnectorId();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+
+ if (null != getState().errorMessage) {
+
+ if (getWidget().errorIndicatorElement == null) {
+ getWidget().errorIndicatorElement = DOM.createSpan();
+ getWidget().errorIndicatorElement.setInnerHTML("&nbsp;");
+ DOM.setElementProperty(getWidget().errorIndicatorElement,
+ "className", "v-errorindicator");
+ DOM.appendChild(getWidget().getElement(),
+ getWidget().errorIndicatorElement);
+ DOM.sinkEvents(getWidget().errorIndicatorElement,
+ VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
+ } else {
+ DOM.setStyleAttribute(getWidget().errorIndicatorElement,
+ "display", "");
+ }
+ } else if (getWidget().errorIndicatorElement != null) {
+ DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display",
+ "none");
+
+ }
+
+ if (isReadOnly()) {
+ getWidget().setEditable(false);
+ }
+
+ if (getIcon() != null) {
+ if (getWidget().icon == null) {
+ getWidget().icon = new Icon(getConnection());
+ DOM.insertChild(getWidget().getElement(),
+ getWidget().icon.getElement(), 1);
+ getWidget().icon.sinkEvents(VTooltip.TOOLTIP_EVENTS);
+ getWidget().icon.sinkEvents(Event.ONCLICK);
+ }
+ getWidget().icon.setUri(getIcon());
+ } else if (getWidget().icon != null) {
+ // detach icon
+ DOM.removeChild(getWidget().getElement(),
+ getWidget().icon.getElement());
+ getWidget().icon = null;
+ }
+
+ // Set text
+ getWidget().entityNumber = getState().entityNumber;
+ getWidget().entityDescription = getState().entityDescription;
+ getWidget().entityId = getState().entityId;
+ getWidget().immediate = getState().immediate;
+ }
+
+ @Override
+ public EntityFieldState getState() {
+ return (EntityFieldState) super.getState();
+ }
+
+ @Override
+ public VEntityField getWidget() {
+ return (VEntityField) super.getWidget();
+ }
+
+ @Override
+ public void onFocus(FocusEvent event) {
+ // EventHelper.updateFocusHandler ensures that this is called only when
+ // there is a listener on server side
+ getRpcProxy(FocusAndBlurServerRpc.class).focus();
+ }
+
+ @Override
+ public void onBlur(BlurEvent event) {
+ // EventHelper.updateFocusHandler ensures that this is called only when
+ // there is a listener on server side
+ getRpcProxy(FocusAndBlurServerRpc.class).blur();
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ // if (!isEnabled()) {
+ // return;
+ // }
+ //
+ // getState().checked = getWidget().getValue();
+ //
+ // // Add mouse details
+ // MouseEventDetails details = MouseEventDetailsBuilder
+ // .buildMouseEventDetails(event.getNativeEvent(), getWidget()
+ // .getElement());
+ // getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked,
+ // details);
+
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+
+ }
+
+ @Override
+ public void onChange(ChangeEvent event) {
+
+ }
+
+ @Override
+ public void onMouseUp(MouseUpEvent event) {
+
+ }
+
+ private ShortcutActionHandlerOwner getShortcutHandlerOwner() {
+ if (hasShortcutActionHandler == null) {
+ Widget parent = getWidget().getParent();
+ while (parent != null) {
+ if (parent instanceof ShortcutActionHandlerOwner) {
+ break;
+ }
+ parent = parent.getParent();
+ }
+ hasShortcutActionHandler = (ShortcutActionHandlerOwner) parent;
+ }
+ return hasShortcutActionHandler;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityField.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityField.java
new file mode 100644
index 0000000..2314a21
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityField.java
@@ -0,0 +1,218 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.StyleConstants;
+import com.vaadin.client.ui.Field;
+import com.vaadin.client.ui.Icon;
+
+public class VEntityField extends Composite implements Field, KeyPressHandler,
+ KeyDownHandler, Focusable {
+
+ public static final String CLASSNAME = "l-entityfield";
+
+ private final FlowPanel fp = new FlowPanel();
+
+ private EntityFieldConnector connector;
+
+ private VEntityTextField textField;
+ private VEntityLink link;
+ private Widget activeField;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String id;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean immediate;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Element errorIndicatorElement;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Icon icon;
+
+ public String entityNumber;
+ public String entityDescription;
+ public Object entityId;
+
+ public VEntityField() {
+ super();
+ setStyleName(CLASSNAME);
+ addStyleName(StyleConstants.UI_LAYOUT);
+ initWidget(fp);
+ }
+
+ public void init(EntityFieldConnector connector) {
+ this.connector = connector;
+
+ swapEditable(true);
+ }
+
+ // public HandlerRegistration addChangeHandler(ChangeHandler handler) {
+ // return addHandler(handler, ChangeEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
+ // return addHandler(handler, KeyDownEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addFocusHandler(FocusHandler handler) {
+ // return addHandler(handler, FocusEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addBlurHandler(BlurHandler handler) {
+ // return addHandler(handler, BlurEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addClickHandler(ClickHandler handler) {
+ // return addHandler(handler, ClickEvent.getType());
+ // }
+
+ /**
+ * If true, then the widget is editable. False otherwise.
+ *
+ * @param editable
+ */
+ public void setEditable(boolean editable) {
+ swapEditable(editable);
+ }
+
+ private void swapEditable(boolean editable) {
+ if (editable) {
+ if (textField == null) {
+ textField = new VEntityTextField();
+ textField.addChangeHandler(connector);
+ textField.addFocusHandler(connector);
+ textField.addBlurHandler(connector);
+ textField.addKeyDownHandler(connector);
+ }
+
+ if (link != null) {
+ fp.remove(link);
+ }
+ fp.add(textField);
+ } else {
+ if (link == null) {
+ link = new VEntityLink();
+ link.addMouseUpHandler(connector);
+ }
+
+ if (textField != null) {
+ fp.remove(textField);
+ }
+ fp.add(link);
+ }
+ }
+
+ /**
+ * Returns true, if the field is editable.
+ *
+ * @return
+ */
+ private boolean isEditable() {
+ return textField != null && textField.isAttached();
+ }
+
+ @Override
+ public int getTabIndex() {
+ return textField.getTabIndex();
+ }
+
+ @Override
+ public void setAccessKey(char key) {
+ textField.setAccessKey(key);
+ }
+
+ @Override
+ public void setFocus(boolean focused) {
+ /*
+ * Similar issue as with selectAll. Focusing must happen before possible
+ * selectall, so keep the timeout here lower.
+ */
+ new Timer() {
+ @Override
+ public void run() {
+ textField.setFocus(true);
+ }
+ }.schedule(300);
+ }
+
+ @Override
+ public void setTabIndex(int index) {
+ textField.setTabIndex(index);
+ }
+
+ public void setEntityNumber(String value) {
+ if (textField.isAttached()) {
+ textField.setValue(value);
+ }
+ }
+
+ /**
+ * Get the value the text area
+ */
+ public String getEntityNumber() {
+ if (textField.isAttached()) {
+ return textField.getValue();
+ }
+ return "";
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+
+ }
+
+ @Override
+ public void onKeyPress(KeyPressEvent event) {
+
+ }
+
+ // @Override
+ // public void onKeyDown(KeyDownEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onBlur(BlurEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onFocus(FocusEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onChange(ChangeEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onMouseUp(MouseUpEvent event) {
+ // if (!isEditable()) {
+ //
+ // }
+ // }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityLink.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityLink.java
new file mode 100644
index 0000000..83d23af
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityLink.java
@@ -0,0 +1,126 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.Icon;
+import com.vaadin.shared.ui.BorderStyle;
+
+public class VEntityLink extends HTML implements ClickHandler {
+
+ public static final String CLASSNAME = "l-entitylink";
+
+ @Deprecated
+ protected static final BorderStyle BORDER_STYLE_DEFAULT = BorderStyle.DEFAULT;
+
+ @Deprecated
+ protected static final BorderStyle BORDER_STYLE_MINIMAL = BorderStyle.MINIMAL;
+
+ @Deprecated
+ protected static final BorderStyle BORDER_STYLE_NONE = BorderStyle.NONE;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String src;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String target;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public BorderStyle borderStyle = BorderStyle.DEFAULT;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean enabled;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public int targetWidth;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public int targetHeight;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Element errorIndicatorElement;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public final Element anchor = DOM.createAnchor();
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public final Element captionElement = DOM.createSpan();
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Icon icon;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ public VEntityLink() {
+ super();
+ getElement().appendChild(anchor);
+ anchor.appendChild(captionElement);
+ addClickHandler(this);
+ setStyleName(CLASSNAME);
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ if (enabled) {
+ if (target == null) {
+ target = "_self";
+ }
+ String features;
+ switch (borderStyle) {
+ case NONE:
+ features = "menubar=no,location=no,status=no";
+ break;
+ case MINIMAL:
+ features = "menubar=yes,location=no,status=no";
+ break;
+ default:
+ features = "";
+ break;
+ }
+
+ if (targetWidth > 0) {
+ features += (features.length() > 0 ? "," : "") + "width="
+ + targetWidth;
+ }
+ if (targetHeight > 0) {
+ features += (features.length() > 0 ? "," : "") + "height="
+ + targetHeight;
+ }
+
+ if (features.length() > 0) {
+ // if 'special features' are set, use window.open(), unless
+ // a modifier key is held (ctrl to open in new tab etc)
+ Event e = DOM.eventGetCurrentEvent();
+ if (!e.getCtrlKey() && !e.getAltKey() && !e.getShiftKey()
+ && !e.getMetaKey()) {
+ Window.open(src, target, features);
+ e.preventDefault();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onBrowserEvent(Event event) {
+ final Element target = DOM.eventGetTarget(event);
+ if (event.getTypeInt() == Event.ONLOAD) {
+ Util.notifyParentOfSizeChange(this, true);
+ }
+ if (target == captionElement || target == anchor
+ || (icon != null && target == icon.getElement())) {
+ super.onBrowserEvent(event);
+ }
+ if (!enabled) {
+ event.preventDefault();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityTextField.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityTextField.java
new file mode 100644
index 0000000..085c478
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/client/VEntityTextField.java
@@ -0,0 +1,432 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.TextBoxBase;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.BrowserInfo;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.Field;
+import com.vaadin.shared.EventId;
+import com.vaadin.shared.ui.textfield.TextFieldConstants;
+
+public class VEntityTextField extends TextBoxBase implements Field,
+ ChangeHandler, FocusHandler, BlurHandler, KeyDownHandler {
+
+ /**
+ * The input node CSS classname.
+ */
+ public static final String CLASSNAME = "v-entitytextfield";
+ /**
+ * This CSS classname is added to the input node on hover.
+ */
+ public static final String CLASSNAME_FOCUS = "focus";
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String paintableId;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String valueBeforeEdit = null;
+
+ /**
+ * Set to false if a text change event has been sent since the last value
+ * change event. This means that {@link #valueBeforeEdit} should not be
+ * trusted when determining whether a text change even should be sent.
+ */
+ private boolean valueBeforeEditIsSynced = true;
+
+ private boolean immediate = false;
+ private int maxLength = -1;
+
+ private static final String CLASSNAME_PROMPT = "prompt";
+ private static final String TEXTCHANGE_MODE_TIMEOUT = "TIMEOUT";
+
+ private String inputPrompt = null;
+ private boolean prompting = false;
+ private int lastCursorPos = -1;
+
+ public VEntityTextField() {
+ this(DOM.createInputText());
+ }
+
+ protected VEntityTextField(Element node) {
+ super(node);
+ setStyleName(CLASSNAME);
+ addChangeHandler(this);
+ if (BrowserInfo.get().isIE()) {
+ // IE does not send change events when pressing enter in a text
+ // input so we handle it using a key listener instead
+ addKeyDownHandler(this);
+ }
+ addFocusHandler(this);
+ addBlurHandler(this);
+ }
+
+ /**
+ * For internal use only. May be removed or replaced in the future.
+ * <p>
+ * TODO When GWT adds ONCUT, add it there and remove workaround. See
+ * http://code.google.com/p/google-web-toolkit/issues/detail?id=4030
+ * <p>
+ * Also note that the cut/paste are not totally crossbrowsers compatible.
+ * E.g. in Opera mac works via context menu, but on via File->Paste/Cut.
+ * Opera might need the polling method for 100% working textchanceevents.
+ * Eager polling for a change is bit dum and heavy operation, so I guess we
+ * should first try to survive without.
+ */
+ public static final int TEXTCHANGE_EVENTS = Event.ONPASTE | Event.KEYEVENTS
+ | Event.ONMOUSEUP;
+
+ @Override
+ public void onBrowserEvent(Event event) {
+ super.onBrowserEvent(event);
+
+ if (listenTextChangeEvents
+ && (event.getTypeInt() & TEXTCHANGE_EVENTS) == event
+ .getTypeInt()) {
+ deferTextChangeEvent();
+ }
+
+ }
+
+ /*
+ * TODO optimize this so that only changes are sent + make the value change
+ * event just a flag that moves the current text to value
+ */
+ private String lastTextChangeString = null;
+
+ private String getLastCommunicatedString() {
+ return lastTextChangeString;
+ }
+
+ private void communicateTextValueToServer() {
+ String text = getText();
+ if (prompting) {
+ // Input prompt visible, text is actually ""
+ text = "";
+ }
+ if (!text.equals(getLastCommunicatedString())) {
+ if (valueBeforeEditIsSynced && text.equals(valueBeforeEdit)) {
+ /*
+ * Value change for the current text has been enqueued since the
+ * last text change event was sent, but we can't know that it
+ * has been sent to the server. Ensure that all pending changes
+ * are sent now. Sending a value change without a text change
+ * will simulate a TextChangeEvent on the server.
+ */
+ client.sendPendingVariableChanges();
+ } else {
+ // Default case - just send an immediate text change message
+ client.updateVariable(paintableId,
+ TextFieldConstants.VAR_CUR_TEXT, text, true);
+
+ // Shouldn't investigate valueBeforeEdit to avoid duplicate text
+ // change events as the states are not in sync any more
+ valueBeforeEditIsSynced = false;
+ }
+ lastTextChangeString = text;
+ }
+ }
+
+ private Timer textChangeEventTrigger = new Timer() {
+
+ @Override
+ public void run() {
+ if (isAttached()) {
+ updateCursorPosition();
+ communicateTextValueToServer();
+ scheduled = false;
+ }
+ }
+ };
+
+ private boolean scheduled = false;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean listenTextChangeEvents;
+ /** For internal use only. May be removed or replaced in the future. */
+ public String textChangeEventMode;
+ public int textChangeEventTimeout;
+
+ private void deferTextChangeEvent() {
+ if (textChangeEventMode.equals(TEXTCHANGE_MODE_TIMEOUT) && scheduled) {
+ return;
+ } else {
+ textChangeEventTrigger.cancel();
+ }
+ textChangeEventTrigger.schedule(getTextChangeEventTimeout());
+ scheduled = true;
+ }
+
+ private int getTextChangeEventTimeout() {
+ return textChangeEventTimeout;
+ }
+
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ boolean wasReadOnly = isReadOnly();
+
+ if (readOnly) {
+ setTabIndex(-1);
+ } else if (wasReadOnly && !readOnly && getTabIndex() == -1) {
+ /*
+ * Need to manually set tab index to 0 since server will not send
+ * the tab index if it is 0.
+ */
+ setTabIndex(0);
+ }
+
+ super.setReadOnly(readOnly);
+ }
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public void updateFieldContent(final String text) {
+ setPrompting(inputPrompt != null && focusedTextField != this
+ && (text.equals("")));
+
+ String fieldValue;
+ if (prompting) {
+ fieldValue = isReadOnly() ? "" : inputPrompt;
+ addStyleDependentName(CLASSNAME_PROMPT);
+ } else {
+ fieldValue = text;
+ removeStyleDependentName(CLASSNAME_PROMPT);
+ }
+ setText(fieldValue);
+
+ lastTextChangeString = valueBeforeEdit = text;
+ valueBeforeEditIsSynced = true;
+ }
+
+ protected void onCut() {
+ if (listenTextChangeEvents) {
+ deferTextChangeEvent();
+ }
+ }
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public native void attachCutEventListener(Element el)
+ /*-{
+ var me = this;
+ el.oncut = $entry(function() {
+ me.@com.vaadin.client.ui.VTextField::onCut()();
+ });
+ }-*/;
+
+ protected native void detachCutEventListener(Element el)
+ /*-{
+ el.oncut = null;
+ }-*/;
+
+ @Override
+ protected void onDetach() {
+ super.onDetach();
+ detachCutEventListener(getElement());
+ if (focusedTextField == this) {
+ focusedTextField = null;
+ }
+ }
+
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ if (listenTextChangeEvents) {
+ detachCutEventListener(getElement());
+ }
+ }
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public void setMaxLength(int newMaxLength) {
+ if (newMaxLength == maxLength) {
+ return;
+ }
+ maxLength = newMaxLength;
+ updateMaxLength(maxLength);
+ }
+
+ /**
+ * This method is responsible for updating the DOM or otherwise ensuring
+ * that the given max length is enforced. Called when the max length for the
+ * field has changed.
+ *
+ * @param maxLength
+ * The new max length
+ */
+ protected void updateMaxLength(int maxLength) {
+ if (maxLength >= 0) {
+ getElement().setPropertyInt("maxLength", maxLength);
+ } else {
+ getElement().removeAttribute("maxLength");
+
+ }
+ setMaxLengthToElement(maxLength);
+ }
+
+ protected void setMaxLengthToElement(int newMaxLength) {
+ if (newMaxLength >= 0) {
+ getElement().setPropertyInt("maxLength", newMaxLength);
+ } else {
+ getElement().removeAttribute("maxLength");
+ }
+ }
+
+ public int getMaxLength() {
+ return maxLength;
+ }
+
+ @Override
+ public void onChange(ChangeEvent event) {
+ valueChange(false);
+ }
+
+ /**
+ * Called when the field value might have changed and/or the field was
+ * blurred. These are combined so the blur event is sent in the same batch
+ * as a possible value change event (these are often connected).
+ *
+ * @param blurred
+ * true if the field was blurred
+ */
+ public void valueChange(boolean blurred) {
+ if (client != null && paintableId != null) {
+ boolean sendBlurEvent = false;
+ boolean sendValueChange = false;
+
+ if (blurred && client.hasEventListeners(this, EventId.BLUR)) {
+ sendBlurEvent = true;
+ client.updateVariable(paintableId, EventId.BLUR, "", false);
+ }
+
+ String newText = getText();
+ if (!prompting && newText != null
+ && !newText.equals(valueBeforeEdit)) {
+ sendValueChange = immediate;
+ client.updateVariable(paintableId, "text", newText, false);
+ valueBeforeEdit = newText;
+ valueBeforeEditIsSynced = true;
+ }
+
+ /*
+ * also send cursor position, no public api yet but for easier
+ * extension
+ */
+ updateCursorPosition();
+
+ if (sendBlurEvent || sendValueChange) {
+ /*
+ * Avoid sending text change event as we will simulate it on the
+ * server side before value change events.
+ */
+ textChangeEventTrigger.cancel();
+ scheduled = false;
+ client.sendPendingVariableChanges();
+ }
+ }
+ }
+
+ /**
+ * Updates the cursor position variable if it has changed since the last
+ * update.
+ *
+ * @return true iff the value was updated
+ */
+ protected boolean updateCursorPosition() {
+ if (Util.isAttachedAndDisplayed(this)) {
+ int cursorPos = getCursorPos();
+ if (lastCursorPos != cursorPos) {
+ client.updateVariable(paintableId,
+ TextFieldConstants.VAR_CURSOR, cursorPos, false);
+ lastCursorPos = cursorPos;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static VEntityTextField focusedTextField;
+
+ public static void flushChangesFromFocusedTextField() {
+ if (focusedTextField != null) {
+ focusedTextField.onChange(null);
+ }
+ }
+
+ @Override
+ public void onFocus(FocusEvent event) {
+ addStyleDependentName(CLASSNAME_FOCUS);
+ if (prompting) {
+ setText("");
+ removeStyleDependentName(CLASSNAME_PROMPT);
+ setPrompting(false);
+ }
+ focusedTextField = this;
+ if (client != null && client.hasEventListeners(this, EventId.FOCUS)) {
+ client.updateVariable(paintableId, EventId.FOCUS, "", true);
+ }
+ }
+
+ @Override
+ public void onBlur(BlurEvent event) {
+ // this is called twice on Chrome when e.g. changing tab while prompting
+ // field focused - do not change settings on the second time
+ if (focusedTextField != this) {
+ return;
+ }
+ removeStyleDependentName(CLASSNAME_FOCUS);
+ focusedTextField = null;
+ String text = getText();
+ setPrompting(inputPrompt != null && (text == null || "".equals(text)));
+ if (prompting) {
+ setText(isReadOnly() ? "" : inputPrompt);
+ addStyleDependentName(CLASSNAME_PROMPT);
+ }
+
+ valueChange(true);
+ }
+
+ private void setPrompting(boolean prompting) {
+ this.prompting = prompting;
+ }
+
+ public void setColumns(int columns) {
+ if (columns <= 0) {
+ return;
+ }
+
+ setWidth(columns + "em");
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+ valueChange(false);
+ }
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public void setInputPrompt(String inputPrompt) {
+ this.inputPrompt = inputPrompt;
+ }
+
+ protected boolean isWordwrap() {
+ String wrap = getElement().getAttribute("wrap");
+ return !"off".equals(wrap);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityField.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityField.java
new file mode 100644
index 0000000..89b5570
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityField.java
@@ -0,0 +1,123 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.shared.EntityFieldState;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CustomField;
+
+@SuppressWarnings("serial")
+public class EntityField extends CustomField<String> {
+
+ public static final String CLASSNAME = "entityfield";
+
+ private Class<?> entityClass;
+ private final boolean isUUID;
+
+ public EntityField() {
+ this(true);
+ }
+
+ public EntityField(boolean isUUID) {
+ setStyleName(CLASSNAME);
+ this.isUUID = isUUID;
+ }
+
+ @Override
+ protected Component initContent() {
+ return null;
+ }
+
+ @Override
+ public EntityFieldState getState() {
+ return (EntityFieldState) super.getState();
+ }
+
+ @Override
+ public Class<? extends String> getType() {
+ return String.class;
+ }
+
+ /**
+ * @return the entityId
+ */
+ public long getEntityId() {
+ if (isUUID) {
+ throw new IllegalStateException(
+ "The entity field was defined as a UUID field. Can not be cast to long!");
+ }
+ try {
+ return (Long) getState().entityId;
+ } catch (Exception e) {
+ throw new IllegalStateException(getState().entityId
+ + " can not be cast to Long!");
+ }
+ }
+
+ /**
+ * @param entityId
+ * the entityId to set
+ */
+ public void setEntityId(long entityId) {
+ getState().entityId = entityId;
+ }
+
+ /**
+ * @return the entityUUID
+ */
+ public String getEntityUUID() {
+ try {
+ return (String) getState().entityId;
+ } catch (Exception e) {
+ throw new IllegalStateException(getState().entityId
+ + " can not be cast to String!");
+ }
+ }
+
+ /**
+ * @param entityUUID
+ * the entityUUID to set
+ */
+ public void setEntityUUID(String entityUUID) {
+ getState().entityId = entityUUID;
+ }
+
+ /**
+ * @return the entityClass
+ */
+ public Class<?> getEntityClass() {
+ return entityClass;
+ }
+
+ /**
+ * @param entityClass
+ * the entityClass to set
+ */
+ public void setEntityClass(Class<?> entityClass) {
+ this.entityClass = entityClass;
+ }
+
+ /**
+ * @return the searchEnabled
+ */
+ public boolean isSearchEnabled() {
+ return getState().searchEnabled;
+ }
+
+ /**
+ * @param searchEnabled
+ * the searchEnabled to set
+ */
+ public void setSearchEnabled(boolean searchEnabled) {
+ getState().searchEnabled = searchEnabled;
+ }
+
+ /**
+ * Returns true, if the id of the field is an UUID.
+ *
+ * @return the isUUID
+ */
+ public boolean isUUID() {
+ return isUUID;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityFieldServerRpc.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityFieldServerRpc.java
new file mode 100644
index 0000000..4110e25
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/server/EntityFieldServerRpc.java
@@ -0,0 +1,9 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+public interface EntityFieldServerRpc extends ServerRpc {
+
+ public void searchTriggered();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/shared/EntityFieldState.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/shared/EntityFieldState.java
new file mode 100644
index 0000000..5fe8eb0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/saveForlater/shared/EntityFieldState.java
@@ -0,0 +1,36 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.shared;
+
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.annotations.DelegateToWidget;
+
+@SuppressWarnings("serial")
+public class EntityFieldState extends AbstractFieldState {
+ {
+ primaryStyleName = "l-entityfield";
+ }
+
+ /**
+ * The business key of the entity.
+ */
+ @DelegateToWidget
+ public String entityNumber;
+
+ /**
+ * The description of the entity.
+ */
+ @DelegateToWidget
+ public String entityDescription;
+
+ /**
+ * The object representation of the entity id.
+ */
+ @DelegateToWidget
+ public Object entityId;
+
+ /**
+ * True if the search icon should be visible.
+ */
+ @DelegateToWidget
+ public boolean searchEnabled;
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/LazyLoadingComboBox.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/LazyLoadingComboBox.java
new file mode 100644
index 0000000..2fcfad9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/LazyLoadingComboBox.java
@@ -0,0 +1,971 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.components.widget;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.filter.SimpleStringFilter;
+import com.vaadin.event.FieldEvents;
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
+import com.vaadin.server.PaintException;
+import com.vaadin.server.PaintTarget;
+import com.vaadin.server.Resource;
+import com.vaadin.shared.ui.combobox.ComboBoxConstants;
+import com.vaadin.shared.ui.combobox.FilteringMode;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.OptionGroup;
+import com.vaadin.ui.TwinColSelect;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Patches OSBP:<br>
+ * The need to patch the ComboBox was to remove the container#indexOf(itemId)
+ * call. JPA does not provide any functionality for it.
+ *
+ *
+ * A filtering dropdown single-select. Suitable for newItemsAllowed, but it's
+ * turned of by default to avoid mistakes. Items are filtered based on user
+ * input, and loaded dynamically ("lazy-loading") from the server. You can turn
+ * on newItemsAllowed and change filtering mode (and also turn it off), but you
+ * can not turn on multi-select mode.
+ *
+ */
+@SuppressWarnings("serial")
+public class LazyLoadingComboBox extends AbstractSelect implements
+ AbstractSelect.Filtering, FieldEvents.BlurNotifier,
+ FieldEvents.FocusNotifier {
+
+ /** The input prompt. */
+ private String inputPrompt = null;
+
+ /**
+ * Holds value of property pageLength. 0 disables paging.
+ */
+ protected int pageLength = 10;
+
+ /** The current page. */
+ // Current page when the user is 'paging' trough options
+ private int currentPage = -1;
+
+ /** The filtering mode. */
+ private FilteringMode filteringMode = FilteringMode.STARTSWITH;
+
+ /** The filterstring. */
+ private String filterstring;
+
+ /** The prevfilterstring. */
+ private String prevfilterstring;
+
+ /**
+ * Number of options that pass the filter, excluding the null item if any.
+ */
+ private int filteredSize;
+
+ /**
+ * Cache of filtered options, used only by the in-memory filtering system.
+ */
+ private List<Object> filteredOptions;
+
+ /** Flag to indicate that request repaint is called by filter request only. */
+ private boolean optionRequest;
+
+ /**
+ * True while painting to suppress item set change notifications that could
+ * be caused by temporary filtering.
+ */
+ private boolean isPainting;
+
+ /**
+ * Flag to indicate whether to scroll the selected item visible (select the
+ * page on which it is) when opening the popup or not. Only applies to
+ * single select mode.
+ *
+ * This requires finding the index of the item, which can be expensive in
+ * many large lazy loading containers.
+ */
+ private boolean scrollToSelectedItem = true;
+
+ /**
+ * If text input is not allowed, the ComboBox behaves like a pretty
+ * NativeSelect - the user can not enter any text and clicking the text
+ * field opens the drop down with options.
+ */
+ private boolean textInputAllowed = true;
+
+ /**
+ * Instantiates a new lazy loading combo box.
+ */
+ public LazyLoadingComboBox() {
+ initDefaults();
+ }
+
+ /**
+ * Instantiates a new lazy loading combo box.
+ *
+ * @param caption
+ * the caption
+ * @param options
+ * the options
+ */
+ public LazyLoadingComboBox(String caption, Collection<?> options) {
+ super(caption, options);
+ initDefaults();
+ }
+
+ /**
+ * Instantiates a new lazy loading combo box.
+ *
+ * @param caption
+ * the caption
+ * @param dataSource
+ * the data source
+ */
+ public LazyLoadingComboBox(String caption, Container dataSource) {
+ super(caption, dataSource);
+ initDefaults();
+ }
+
+ /**
+ * Instantiates a new lazy loading combo box.
+ *
+ * @param caption
+ * the caption
+ */
+ public LazyLoadingComboBox(String caption) {
+ super(caption);
+ initDefaults();
+ }
+
+ /**
+ * Initialize the ComboBox with default settings.
+ */
+ private void initDefaults() {
+ setNewItemsAllowed(false);
+ setImmediate(true);
+ }
+
+ /**
+ * Gets the current input prompt.
+ *
+ * @return the current input prompt, or null if not enabled
+ * @see #setInputPrompt(String)
+ */
+ public String getInputPrompt() {
+ return inputPrompt;
+ }
+
+ /**
+ * Sets the input prompt - a textual prompt that is displayed when the
+ * select would otherwise be empty, to prompt the user for input.
+ *
+ * @param inputPrompt
+ * the desired input prompt, or null to disable
+ */
+ public void setInputPrompt(String inputPrompt) {
+ this.inputPrompt = inputPrompt;
+ markAsDirty();
+ }
+
+ /**
+ * Checks if is filtering needed.
+ *
+ * @return true, if is filtering needed
+ */
+ private boolean isFilteringNeeded() {
+ return filterstring != null && filterstring.length() > 0
+ && filteringMode != FilteringMode.OFF;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#paintContent(com.vaadin.server.PaintTarget)
+ */
+ @Override
+ public void paintContent(PaintTarget target) throws PaintException {
+ isPainting = true;
+ try {
+ if (inputPrompt != null) {
+ target.addAttribute(ComboBoxConstants.ATTR_INPUTPROMPT,
+ inputPrompt);
+ }
+
+ if (!textInputAllowed) {
+ target.addAttribute(ComboBoxConstants.ATTR_NO_TEXT_INPUT, true);
+ }
+
+ // clear caption change listeners
+ getCaptionChangeListener().clear();
+
+ // The tab ordering number
+ if (getTabIndex() != 0) {
+ target.addAttribute("tabindex", getTabIndex());
+ }
+
+ // If the field is modified, but not committed, set modified
+ // attribute
+ if (isModified()) {
+ target.addAttribute("modified", true);
+ }
+
+ if (isNewItemsAllowed()) {
+ target.addAttribute("allownewitem", true);
+ }
+
+ boolean needNullSelectOption = false;
+ if (isNullSelectionAllowed()) {
+ target.addAttribute("nullselect", true);
+ needNullSelectOption = (getNullSelectionItemId() == null);
+ if (!needNullSelectOption) {
+ target.addAttribute("nullselectitem", true);
+ }
+ }
+
+ // Constructs selected keys array
+ String[] selectedKeys = new String[(getValue() == null
+ && getNullSelectionItemId() == null ? 0 : 1)];
+
+ target.addAttribute("pagelength", pageLength);
+
+ target.addAttribute("filteringmode", getFilteringMode().toString());
+
+ // Paints the options and create array of selected id keys
+ int keyIndex = 0;
+
+ target.startTag("options");
+
+ if (currentPage < 0) {
+ optionRequest = false;
+ currentPage = 0;
+ filterstring = "";
+ }
+
+ boolean nullFilteredOut = isFilteringNeeded();
+ // null option is needed and not filtered out, even if not on
+ // current
+ // page
+ boolean nullOptionVisible = needNullSelectOption
+ && !nullFilteredOut;
+
+ // first try if using container filters is possible
+ List<?> options = getOptionsWithFilter(nullOptionVisible);
+ if (null == options) {
+ // not able to use container filters, perform explicit in-memory
+ // filtering
+ options = getFilteredOptions();
+ filteredSize = options.size();
+ options = sanitetizeList(options, nullOptionVisible);
+ }
+
+ final boolean paintNullSelection = needNullSelectOption
+ && currentPage == 0 && !nullFilteredOut;
+
+ if (paintNullSelection) {
+ target.startTag("so");
+ target.addAttribute("caption", "");
+ target.addAttribute("key", "");
+ target.endTag("so");
+ }
+
+ final Iterator<?> i = options.iterator();
+ // Paints the available selection options from data source
+
+ while (i.hasNext()) {
+
+ Object id = i.next();
+
+ if (!isNullSelectionAllowed() && id != null
+ && id.equals(getNullSelectionItemId())
+ && !isSelected(id)) {
+ continue;
+ }
+
+ if (id == null) {
+ if (isNullSelectionAllowed()) {
+ id = getNullSelectionItemId();
+ } else {
+ continue;
+ }
+ }
+
+ // Gets the option attribute values
+ final String key = itemIdMapper.key(id);
+ final String caption = getItemCaption(id);
+ final Resource icon = getItemIcon(id);
+ getCaptionChangeListener().addNotifierForItem(id);
+
+ // Paints the option
+ target.startTag("so");
+ if (icon != null) {
+ target.addAttribute("icon", icon);
+ }
+ if(caption != null) {
+ target.addAttribute("caption", caption);
+ }
+ if (id != null && id.equals(getNullSelectionItemId())) {
+ target.addAttribute("nullselection", true);
+ }
+ target.addAttribute("key", key);
+ if (keyIndex < selectedKeys.length && isSelected(id)) {
+ // at most one item can be selected at a time
+ selectedKeys[keyIndex++] = key;
+ }
+ target.endTag("so");
+ }
+ target.endTag("options");
+
+ target.addAttribute("totalitems", size()
+ + (needNullSelectOption ? 1 : 0));
+ if (filteredSize > 0 || nullOptionVisible) {
+ target.addAttribute("totalMatches", filteredSize
+ + (nullOptionVisible ? 1 : 0));
+ }
+
+ // Paint variables
+ target.addVariable(this, "selected", selectedKeys);
+ if (isNewItemsAllowed()) {
+ target.addVariable(this, "newitem", "");
+ }
+
+ target.addVariable(this, "filter", filterstring);
+ target.addVariable(this, "page", currentPage);
+
+ currentPage = -1; // current page is always set by client
+
+ optionRequest = true;
+ } finally {
+ isPainting = false;
+ }
+
+ }
+
+ /**
+ * Sets whether it is possible to input text into the field or whether the
+ * field area of the component is just used to show what is selected. By
+ * disabling text input, the comboBox will work in the same way as a
+ * {@link NativeSelect}
+ *
+ * @param textInputAllowed
+ * true to allow entering text, false to just show the current
+ * selection
+ * @see #isTextInputAllowed()
+ */
+ public void setTextInputAllowed(boolean textInputAllowed) {
+ this.textInputAllowed = textInputAllowed;
+ markAsDirty();
+ }
+
+ /**
+ * Returns true if the user can enter text into the field to either filter
+ * the selections or enter a new value if {@link #isNewItemsAllowed()}
+ * returns true. If text input is disabled, the comboBox will work in the
+ * same way as a {@link NativeSelect}
+ *
+ * @return the if text input is not allowed, the ComboBox behaves like a
+ * pretty NativeSelect - the user can not enter any text and
+ * clicking the text field opens the drop down with options
+ */
+ public boolean isTextInputAllowed() {
+ return textInputAllowed;
+ }
+
+ /**
+ * Returns the filtered options for the current page using a container
+ * filter.
+ *
+ * As a size effect, {@link #filteredSize} is set to the total number of
+ * items passing the filter.
+ *
+ * The current container must be {@link Filterable } and {@link Indexed}, and
+ * the filtering mode must be suitable for container filtering.
+ *
+ * Use {@link #getFilteredOptions()} and
+ * {@link #sanitetizeList(List, boolean)} if this is not the case.
+ *
+ * @param needNullSelectOption
+ * the need null select option
+ * @return filtered list of options (may be empty) or null if cannot use
+ * container filters
+ */
+ protected List<?> getOptionsWithFilter(boolean needNullSelectOption) {
+ Container container = getContainerDataSource();
+
+ if (pageLength == 0 && !isFilteringNeeded()) {
+ // no paging or filtering: return all items
+ filteredSize = container.size();
+ assert filteredSize >= 0;
+ return new ArrayList<Object>(container.getItemIds());
+ }
+
+ if (!(container instanceof Filterable)
+ || !(container instanceof Indexed)
+ || getItemCaptionMode() != ITEM_CAPTION_MODE_PROPERTY) {
+ return null;
+ }
+
+ Filterable filterable = (Filterable) container;
+
+ Filter filter = buildFilter(filterstring, filteringMode);
+
+ // adding and removing filters leads to extraneous item set
+ // change events from the underlying container, but the ComboBox does
+ // not process or propagate them based on the flag filteringContainer
+ if (filter != null) {
+ filterable.addContainerFilter(filter);
+ }
+
+ // try-finally to ensure that the filter is removed from container even
+ // if a exception is thrown...
+ try {
+ Indexed indexed = (Indexed) container;
+
+ // We always start from index zero. But we additionally add the
+ // selected value to the current page.
+ int indexToEnsureInView = 0;
+
+ // if not an option request (item list when user changes page), go
+ // to page with the selected item after filtering if accepted by
+ // filter
+ Object selection = getValue();
+ // if (isScrollToSelectedItem() && !optionRequest && selection !=
+ // null) {
+ // // ensure proper page
+ // indexToEnsureInView = indexed.indexOfId(selection);
+ // }
+
+ filteredSize = container.size();
+ assert filteredSize >= 0;
+ currentPage = adjustCurrentPage(currentPage, needNullSelectOption,
+ -1, filteredSize);
+ int first = getFirstItemIndexOnCurrentPage(needNullSelectOption,
+ filteredSize);
+ int last = getLastItemIndexOnCurrentPage(needNullSelectOption,
+ filteredSize, first);
+
+ // Compute the number of items to fetch from the indexes given or
+ // based on the filtered size of the container
+ int lastItemToFetch = Math.min(last, filteredSize - 1);
+ int nrOfItemsToFetch = (lastItemToFetch + 1) - first;
+
+ List<?> options = indexed.getItemIds(first, nrOfItemsToFetch);
+
+ List<Object> optionsWithCurrentValue = new ArrayList<>(options);
+ optionsWithCurrentValue.add(0, selection);
+
+ return optionsWithCurrentValue;
+ } finally {
+ // to the outside, filtering should not be visible
+ if (filter != null) {
+ filterable.removeContainerFilter(filter);
+ }
+ }
+ }
+
+ /**
+ * Constructs a filter instance to use when using a Filterable container in
+ * the <code>ITEM_CAPTION_MODE_PROPERTY</code> mode.
+ *
+ * Note that the client side implementation expects the filter string to
+ * apply to the item caption string it sees, so changing the behavior of
+ * this method can cause problems.
+ *
+ * @param filterString
+ * the filter string
+ * @param filteringMode
+ * the filtering mode
+ * @return the filter
+ */
+ protected Filter buildFilter(String filterString,
+ FilteringMode filteringMode) {
+ Filter filter = null;
+
+ if (null != filterString && !"".equals(filterString)) {
+ switch (filteringMode) {
+ case OFF:
+ break;
+ case STARTSWITH:
+ filter = new SimpleStringFilter(getItemCaptionPropertyId(),
+ filterString, true, true);
+ break;
+ case CONTAINS:
+ filter = new SimpleStringFilter(getItemCaptionPropertyId(),
+ filterString, true, false);
+ break;
+ }
+ }
+ return filter;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect#containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent)
+ */
+ @Override
+ public void containerItemSetChange(Container.ItemSetChangeEvent event) {
+ if (!isPainting) {
+ super.containerItemSetChange(event);
+ }
+ }
+
+ /**
+ * Makes correct sublist of given list of options.
+ *
+ * If paint is not an option request (affected by page or filter change),
+ * page will be the one where possible selection exists.
+ *
+ * Detects proper first and last item in list to return right page of
+ * options. Also, if the current page is beyond the end of the list, it will
+ * be adjusted.
+ *
+ * @param options
+ * the options
+ * @param needNullSelectOption
+ * flag to indicate if nullselect option needs to be taken into
+ * consideration
+ * @return the list
+ */
+ private List<?> sanitetizeList(List<?> options, boolean needNullSelectOption) {
+
+ if (pageLength != 0 && options.size() > pageLength) {
+
+ int indexToEnsureInView = -1;
+
+ // if not an option request (item list when user changes page), go
+ // to page with the selected item after filtering if accepted by
+ // filter
+ Object selection = getValue();
+ if (isScrollToSelectedItem() && !optionRequest && selection != null) {
+ // ensure proper page
+ indexToEnsureInView = options.indexOf(selection);
+ }
+
+ int size = options.size();
+ currentPage = adjustCurrentPage(currentPage, needNullSelectOption,
+ indexToEnsureInView, size);
+ int first = getFirstItemIndexOnCurrentPage(needNullSelectOption,
+ size);
+ int last = getLastItemIndexOnCurrentPage(needNullSelectOption,
+ size, first);
+ return options.subList(first, last + 1);
+ } else {
+ return options;
+ }
+ }
+
+ /**
+ * Returns the index of the first item on the current page. The index is to
+ * the underlying (possibly filtered) contents. The null item, if any, does
+ * not have an index but takes up a slot on the first page.
+ *
+ * @param needNullSelectOption
+ * true if a null option should be shown before any other options
+ * (takes up the first slot on the first page, not counted in
+ * index)
+ * @param size
+ * number of items after filtering (not including the null item,
+ * if any)
+ * @return first item to show on the UI (index to the filtered list of
+ * options, not taking the null item into consideration if any)
+ */
+ private int getFirstItemIndexOnCurrentPage(boolean needNullSelectOption,
+ int size) {
+ // Not all options are visible, find out which ones are on the
+ // current "page".
+ int first = currentPage * pageLength;
+ if (needNullSelectOption && currentPage > 0) {
+ first--;
+ }
+ return first;
+ }
+
+ /**
+ * Returns the index of the last item on the current page. The index is to
+ * the underlying (possibly filtered) contents. If needNullSelectOption is
+ * true, the null item takes up the first slot on the first page,
+ * effectively reducing the first page size by one.
+ *
+ * @param needNullSelectOption
+ * true if a null option should be shown before any other options
+ * (takes up the first slot on the first page, not counted in
+ * index)
+ * @param size
+ * number of items after filtering (not including the null item,
+ * if any)
+ * @param first
+ * index in the filtered view of the first item of the page
+ * @return index in the filtered view of the last item on the page
+ */
+ private int getLastItemIndexOnCurrentPage(boolean needNullSelectOption,
+ int size, int first) {
+ // page length usable for non-null items
+ int effectivePageLength = pageLength
+ - (needNullSelectOption && (currentPage == 0) ? 1 : 0);
+ return Math.min(size - 1, first + effectivePageLength - 1);
+ }
+
+ /**
+ * Adjusts the index of the current page if necessary: make sure the current
+ * page is not after the end of the contents, and optionally go to the page
+ * containg a specific item. There are no side effects but the adjusted page
+ * index is returned.
+ *
+ * @param page
+ * page number to use as the starting point
+ * @param needNullSelectOption
+ * true if a null option should be shown before any other options
+ * (takes up the first slot on the first page, not counted in
+ * index)
+ * @param indexToEnsureInView
+ * index of an item that should be included on the page (in the
+ * data set, not counting the null item if any), -1 for none
+ * @param size
+ * number of items after filtering (not including the null item,
+ * if any)
+ * @return the int
+ */
+ private int adjustCurrentPage(int page, boolean needNullSelectOption,
+ int indexToEnsureInView, int size) {
+ if (indexToEnsureInView != -1) {
+ int newPage = (indexToEnsureInView + (needNullSelectOption ? 1 : 0))
+ / pageLength;
+ page = newPage;
+ }
+ // adjust the current page if beyond the end of the list
+ if (page * pageLength > size) {
+ page = (size + (needNullSelectOption ? 1 : 0)) / pageLength;
+ }
+ return page;
+ }
+
+ /**
+ * Filters the options in memory and returns the full filtered list.
+ *
+ * This can be less efficient than using container filters, so use
+ * {@link #getOptionsWithFilter(boolean)} if possible (filterable container
+ * and suitable item caption mode etc.).
+ *
+ * @return the cache of filtered options, used only by the in-memory
+ * filtering system
+ */
+ protected List<?> getFilteredOptions() {
+ if (!isFilteringNeeded()) {
+ prevfilterstring = null;
+ filteredOptions = new LinkedList<Object>(getItemIds());
+ return filteredOptions;
+ }
+
+ if (filterstring.equals(prevfilterstring)) {
+ return filteredOptions;
+ }
+
+ Collection<?> items;
+ if (prevfilterstring != null
+ && filterstring.startsWith(prevfilterstring)) {
+ items = filteredOptions;
+ } else {
+ items = getItemIds();
+ }
+ prevfilterstring = filterstring;
+
+ filteredOptions = new LinkedList<Object>();
+ for (final Iterator<?> it = items.iterator(); it.hasNext();) {
+ final Object itemId = it.next();
+ String caption = getItemCaption(itemId);
+ if (caption == null || caption.equals("")) {
+ continue;
+ } else {
+ caption = caption.toLowerCase();
+ }
+ switch (filteringMode) {
+ case CONTAINS:
+ if (caption.indexOf(filterstring) > -1) {
+ filteredOptions.add(itemId);
+ }
+ break;
+ case STARTSWITH:
+ default:
+ if (caption.startsWith(filterstring)) {
+ filteredOptions.add(itemId);
+ }
+ break;
+ }
+ }
+
+ return filteredOptions;
+ }
+//TODO: check @see reference
+ /**
+ * Invoked when the value of a variable has changed.
+ *
+ * see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
+ * java.util.Map)
+ *
+ * @param source
+ * the source
+ * @param variables
+ * the variables
+ */
+ @Override
+ public void changeVariables(Object source, Map<String, Object> variables) {
+ // Not calling super.changeVariables due the history of select
+ // component hierarchy
+
+ // Selection change
+ if (variables.containsKey("selected")) {
+ final String[] ka = (String[]) variables.get("selected");
+
+ // Single select mode
+ if (ka.length == 0) {
+
+ // Allows deselection only if the deselected item is visible
+ final Object current = getValue();
+ final Collection<?> visible = getVisibleItemIds();
+ if (visible != null && visible.contains(current)) {
+ setValue(null, true);
+ }
+ } else {
+ final Object id = itemIdMapper.get(ka[0]);
+ if (id != null && id.equals(getNullSelectionItemId())) {
+ setValue(null, true);
+ } else {
+ setValue(id, true);
+ }
+ }
+ }
+
+ String newFilter;
+ if ((newFilter = (String) variables.get("filter")) != null) {
+ // this is a filter request
+ currentPage = ((Integer) variables.get("page")).intValue();
+ filterstring = newFilter.toLowerCase();
+ requestRepaint();
+ } else if (isNewItemsAllowed()) {
+ // New option entered (and it is allowed)
+ final String newitem = (String) variables.get("newitem");
+ if (newitem != null && newitem.length() > 0) {
+ getNewItemHandler().addNewItem(newitem);
+ // rebuild list
+ filterstring = null;
+ prevfilterstring = null;
+ }
+ }
+
+ if (variables.containsKey(FocusEvent.EVENT_ID)) {
+ fireEvent(new FocusEvent(this));
+ }
+ if (variables.containsKey(BlurEvent.EVENT_ID)) {
+ fireEvent(new BlurEvent(this));
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect.Filtering#setFilteringMode(com.vaadin.shared.ui.combobox.FilteringMode)
+ */
+ @Override
+ public void setFilteringMode(FilteringMode filteringMode) {
+ this.filteringMode = filteringMode;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractSelect.Filtering#getFilteringMode()
+ */
+ @Override
+ public FilteringMode getFilteringMode() {
+ return filteringMode;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.event.FieldEvents.BlurNotifier#addBlurListener(com.vaadin.event.FieldEvents.BlurListener)
+ */
+ @Override
+ public void addBlurListener(BlurListener listener) {
+ addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener,
+ BlurListener.blurMethod);
+ }
+
+ /**
+ * Adds the listener.
+ *
+ * @param listener
+ * the listener
+ * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)}
+ */
+ @Override
+ @Deprecated
+ public void addListener(BlurListener listener) {
+ addBlurListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.event.FieldEvents.BlurNotifier#removeBlurListener(com.vaadin.event.FieldEvents.BlurListener)
+ */
+ @Override
+ public void removeBlurListener(BlurListener listener) {
+ removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
+ }
+
+ /**
+ * Removes the listener.
+ *
+ * @param listener
+ * the listener
+ * @deprecated As of 7.0, replaced by
+ * {@link #removeBlurListener(BlurListener)}
+ */
+ @Override
+ @Deprecated
+ public void removeListener(BlurListener listener) {
+ removeBlurListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.event.FieldEvents.FocusNotifier#addFocusListener(com.vaadin.event.FieldEvents.FocusListener)
+ */
+ @Override
+ public void addFocusListener(FocusListener listener) {
+ addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener,
+ FocusListener.focusMethod);
+ }
+
+ /**
+ * Adds the listener.
+ *
+ * @param listener
+ * the listener
+ * @deprecated As of 7.0, replaced by
+ * {@link #addFocusListener(FocusListener)}
+ */
+ @Override
+ @Deprecated
+ public void addListener(FocusListener listener) {
+ addFocusListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.event.FieldEvents.FocusNotifier#removeFocusListener(com.vaadin.event.FieldEvents.FocusListener)
+ */
+ @Override
+ public void removeFocusListener(FocusListener listener) {
+ removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
+ }
+
+ /**
+ * Removes the listener.
+ *
+ * @param listener
+ * the listener
+ * @deprecated As of 7.0, replaced by
+ * {@link #removeFocusListener(FocusListener)}
+ */
+ @Override
+ @Deprecated
+ public void removeListener(FocusListener listener) {
+ removeFocusListener(listener);
+ }
+
+ /**
+ * ComboBox does not support multi select mode.
+ *
+ * @param multiSelect
+ * the new multi select
+ * @throws UnsupportedOperationException
+ * if trying to activate multiselect mode
+ * @see com.vaadin.ui.AbstractSelect#setMultiSelect(boolean)
+ * @deprecated As of 7.0, use {@link ListSelect}, {@link OptionGroup} or
+ * {@link TwinColSelect} instead
+ */
+ @Deprecated
+ @Override
+ public void setMultiSelect(boolean multiSelect) {
+ if (multiSelect) {
+ throw new UnsupportedOperationException("Multiselect not supported");
+ }
+ }
+
+ /**
+ * ComboBox does not support multi select mode.
+ *
+ * @return false
+ * @see com.vaadin.ui.AbstractSelect#isMultiSelect()
+ * @deprecated As of 7.0, use {@link ListSelect}, {@link OptionGroup} or
+ * {@link TwinColSelect} instead
+ */
+ @Deprecated
+ @Override
+ public boolean isMultiSelect() {
+ return false;
+ }
+
+ /**
+ * Returns the page length of the suggestion popup.
+ *
+ * @return the pageLength
+ */
+ public int getPageLength() {
+ return pageLength;
+ }
+
+ /**
+ * Sets the page length for the suggestion popup. Setting the page length to
+ * 0 will disable suggestion popup paging (all items visible).
+ *
+ * @param pageLength
+ * the pageLength to set
+ */
+ public void setPageLength(int pageLength) {
+ this.pageLength = pageLength;
+ markAsDirty();
+ }
+
+ /**
+ * Sets whether to scroll the selected item visible (directly open the page
+ * on which it is) when opening the combo box popup or not. Only applies to
+ * single select mode.
+ *
+ * This requires finding the index of the item, which can be expensive in
+ * many large lazy loading containers.
+ *
+ * @param scrollToSelectedItem
+ * true to find the page with the selected item when opening the
+ * selection popup
+ */
+ public void setScrollToSelectedItem(boolean scrollToSelectedItem) {
+ this.scrollToSelectedItem = scrollToSelectedItem;
+ }
+
+ /**
+ * Returns true if the select should find the page with the selected item
+ * when opening the popup (single select combo box only).
+ *
+ * @return true if the page with the selected item will be shown when
+ * opening the popup
+ * @see #setScrollToSelectedItem(boolean)
+ */
+ public boolean isScrollToSelectedItem() {
+ return scrollToSelectedItem;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetset.gwt.xml b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetset.gwt.xml
new file mode 100644
index 0000000..1ff3789
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetset.gwt.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Vaadin//DTD Vaadin 7//EN" "https://raw.github.com/vaadin/gwt/master/distro-source/core/src/gwt-module.dtd">
+<module>
+ <inherits name="com.vaadin.DefaultWidgetSet" />
+ <source path="client" />
+ <source path="shared" />
+ <collapse-all-properties />
+<!-- <set-property name="compiler.useSymbolMaps" value="true" /> -->
+
+</module>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetsetUI.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetsetUI.java
new file mode 100644
index 0000000..964ab06
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/OSBPWidgetsWidgetsetUI.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.components.widget;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+@SuppressWarnings("serial")
+@Theme("clientsidewidget")
+public class OSBPWidgetsWidgetsetUI extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ setContent(layout);
+
+ Button button = new Button("Click Me");
+ button.addClickListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ layout.addComponent(new Label("Thank you for clicking"));
+ }
+ });
+ layout.addComponent(button);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/client/LazyLoadingComboBoxConnector.java b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/client/LazyLoadingComboBoxConnector.java
new file mode 100644
index 0000000..7f11194
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/client/LazyLoadingComboBoxConnector.java
@@ -0,0 +1,339 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.widget.client;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.widget.LazyLoadingComboBox;
+
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.Paintable;
+import com.vaadin.client.UIDL;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.SimpleManagedLayout;
+import com.vaadin.client.ui.VFilterSelect;
+import com.vaadin.client.ui.VFilterSelect.FilterSelectSuggestion;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.combobox.ComboBoxConstants;
+import com.vaadin.shared.ui.combobox.ComboBoxState;
+import com.vaadin.shared.ui.combobox.FilteringMode;
+
+@Connect(LazyLoadingComboBox.class)
+public class LazyLoadingComboBoxConnector extends AbstractFieldConnector
+ implements Paintable, SimpleManagedLayout {
+
+ // oldSuggestionTextMatchTheOldSelection is used to detect when it's safe to
+ // update textbox text by a changed item caption.
+ private boolean oldSuggestionTextMatchTheOldSelection;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.Paintable#updateFromUIDL(com.vaadin.client.UIDL,
+ * com.vaadin.client.ApplicationConnection)
+ */
+ @Override
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+ // Save details
+ getWidget().client = client;
+ getWidget().paintableId = uidl.getId();
+
+ getWidget().readonly = isReadOnly();
+ getWidget().updateReadOnly();
+
+ if (!isRealUpdate(uidl)) {
+ return;
+ }
+
+ // Inverse logic here to make the default case (text input enabled)
+ // work without additional UIDL messages
+ boolean noTextInput = uidl
+ .hasAttribute(ComboBoxConstants.ATTR_NO_TEXT_INPUT)
+ && uidl.getBooleanAttribute(ComboBoxConstants.ATTR_NO_TEXT_INPUT);
+ getWidget().setTextInputEnabled(!noTextInput);
+
+ // not a FocusWidget -> needs own tabindex handling
+ getWidget().tb.setTabIndex(getState().tabIndex);
+
+ if (uidl.hasAttribute("filteringmode")) {
+ getWidget().filteringmode = FilteringMode.valueOf(uidl
+ .getStringAttribute("filteringmode"));
+ }
+
+ getWidget().immediate = getState().immediate;
+
+ getWidget().nullSelectionAllowed = uidl.hasAttribute("nullselect");
+
+ getWidget().nullSelectItem = uidl.hasAttribute("nullselectitem")
+ && uidl.getBooleanAttribute("nullselectitem");
+
+ getWidget().currentPage = uidl.getIntVariable("page");
+
+ if (uidl.hasAttribute("pagelength")) {
+ getWidget().pageLength = uidl.getIntAttribute("pagelength");
+ }
+
+ if (uidl.hasAttribute(ComboBoxConstants.ATTR_INPUTPROMPT)) {
+ // input prompt changed from server
+ getWidget().inputPrompt = uidl
+ .getStringAttribute(ComboBoxConstants.ATTR_INPUTPROMPT);
+ } else {
+ getWidget().inputPrompt = "";
+ }
+
+ getWidget().suggestionPopup.updateStyleNames(uidl, getState());
+
+ getWidget().allowNewItem = uidl.hasAttribute("allownewitem");
+ getWidget().lastNewItemString = null;
+
+ final UIDL options = uidl.getChildUIDL(0);
+ if (uidl.hasAttribute("totalMatches")) {
+ getWidget().totalMatches = uidl.getIntAttribute("totalMatches");
+ } else {
+ getWidget().totalMatches = 0;
+ }
+
+ List<FilterSelectSuggestion> newSuggestions = new ArrayList<FilterSelectSuggestion>();
+
+ for (final Iterator<?> i = options.getChildIterator(); i.hasNext();) {
+ final UIDL optionUidl = (UIDL) i.next();
+ final FilterSelectSuggestion suggestion = getWidget().new FilterSelectSuggestion(
+ optionUidl);
+ newSuggestions.add(suggestion);
+ }
+
+ // only close the popup if the suggestions list has actually changed
+ boolean suggestionsChanged = !getWidget().initDone
+ || !newSuggestions.equals(getWidget().currentSuggestions);
+
+ // An ItemSetChangeEvent on server side clears the current suggestion
+ // popup. Popup needs to be repopulated with suggestions from UIDL.
+ boolean popupOpenAndCleared = false;
+
+ oldSuggestionTextMatchTheOldSelection = false;
+
+ if (suggestionsChanged) {
+ oldSuggestionTextMatchTheOldSelection = isWidgetsCurrentSelectionTextInTextBox();
+ getWidget().currentSuggestions.clear();
+
+ if (!getWidget().waitingForFilteringResponse) {
+ /*
+ * Clear the current suggestions as the server response always
+ * includes the new ones. Exception is when filtering, then we
+ * need to retain the value if the user does not select any of
+ * the options matching the filter.
+ */
+ getWidget().currentSuggestion = null;
+ /*
+ * Also ensure no old items in menu. Unless cleared the old
+ * values may cause odd effects on blur events. Suggestions in
+ * menu might not necessary exist in select at all anymore.
+ */
+ getWidget().suggestionPopup.menu.clearItems();
+ popupOpenAndCleared = getWidget().suggestionPopup.isAttached();
+
+ }
+
+ for (FilterSelectSuggestion suggestion : newSuggestions) {
+ getWidget().currentSuggestions.add(suggestion);
+ }
+ }
+
+ // handle selection (null or a single value)
+ if (uidl.hasVariable("selected")
+
+ // In case we're switching page no need to update the selection as the
+ // selection process didn't finish.
+ // && getWidget().selectPopupItemWhenResponseIsReceived ==
+ // VFilterSelect.Select.NONE
+ //
+ ) {
+
+ String[] selectedKeys = uidl.getStringArrayVariable("selected");
+ if (selectedKeys.length > 0) {
+ performSelection(selectedKeys[0]);
+ } else {
+ resetSelection();
+ }
+ }
+
+ if ((getWidget().waitingForFilteringResponse && getWidget().lastFilter
+ .toLowerCase().equals(uidl.getStringVariable("filter")))
+ || popupOpenAndCleared) {
+
+ getWidget().suggestionPopup.showSuggestions(
+ getWidget().currentSuggestions, getWidget().currentPage,
+ getWidget().totalMatches);
+
+ getWidget().waitingForFilteringResponse = false;
+
+ if (!getWidget().popupOpenerClicked
+ && getWidget().selectPopupItemWhenResponseIsReceived != VFilterSelect.Select.NONE) {
+
+ // we're paging w/ arrows
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ navigateItemAfterPageChange();
+ }
+ });
+ }
+
+ if (getWidget().updateSelectionWhenReponseIsReceived) {
+ getWidget().suggestionPopup.menu
+ .doPostFilterSelectedItemAction();
+ }
+ }
+
+ // Calculate minimum textarea width
+ getWidget().updateSuggestionPopupMinWidth();
+
+ getWidget().popupOpenerClicked = false;
+
+ /*
+ * if this is our first time we need to recalculate the root width.
+ */
+ if (!getWidget().initDone) {
+
+ getWidget().updateRootWidth();
+ }
+
+ // Focus dependent style names are lost during the update, so we add
+ // them here back again
+ if (getWidget().focused) {
+ getWidget().addStyleDependentName("focus");
+ }
+
+ getWidget().initDone = true;
+ }
+
+ /*
+ * This method navigates to the proper item in the combobox page. This
+ * should be executed after setSuggestions() method which is called from
+ * vFilterSelect.showSuggestions(). ShowSuggestions() method builds the page
+ * content. As far as setSuggestions() method is called as deferred,
+ * navigateItemAfterPageChange method should be also be called as deferred.
+ * #11333
+ */
+ private void navigateItemAfterPageChange() {
+ if (getWidget().selectPopupItemWhenResponseIsReceived == VFilterSelect.Select.LAST) {
+ getWidget().suggestionPopup.selectLastItem();
+ } else {
+ getWidget().suggestionPopup.selectFirstItem();
+ }
+
+ // If you're in between 2 requests both changing the page back and
+ // forth, you don't want this here, instead you need it before any
+ // other request.
+ // getWidget().selectPopupItemWhenResponseIsReceived =
+ // VFilterSelect.Select.NONE; // reset
+ }
+
+ private void performSelection(String selectedKey) {
+ // some item selected
+ for (FilterSelectSuggestion suggestion : getWidget().currentSuggestions) {
+ String suggestionKey = suggestion.getOptionKey();
+ if (!suggestionKey.equals(selectedKey)) {
+ continue;
+ }
+ if (!getWidget().waitingForFilteringResponse
+ || getWidget().popupOpenerClicked) {
+ if (!suggestionKey.equals(getWidget().selectedOptionKey)
+ || suggestion.getReplacementString().equals(
+ getWidget().tb.getText())
+ || oldSuggestionTextMatchTheOldSelection) {
+ // Update text field if we've got a new
+ // selection
+ // Also update if we've got the same text to
+ // retain old text selection behavior
+ // OR if selected item caption is changed.
+ getWidget().setPromptingOff(
+ suggestion.getReplacementString());
+ getWidget().selectedOptionKey = suggestionKey;
+ }
+ }
+ getWidget().currentSuggestion = suggestion;
+ getWidget().setSelectedItemIcon(suggestion.getIconUri());
+ // only a single item can be selected
+ break;
+ }
+ }
+
+ private boolean isWidgetsCurrentSelectionTextInTextBox() {
+ return getWidget().currentSuggestion != null
+ && getWidget().currentSuggestion.getReplacementString().equals(
+ getWidget().tb.getText());
+ }
+
+ private void resetSelection() {
+ if (!getWidget().waitingForFilteringResponse
+ || getWidget().popupOpenerClicked) {
+ // select nulled
+ if (!getWidget().focused) {
+ /*
+ * client.updateComponent overwrites all styles so we must
+ * ALWAYS set the prompting style at this point, even though we
+ * think it has been set already...
+ */
+ getWidget().setPromptingOff("");
+ if (getWidget().enabled && !getWidget().readonly) {
+ getWidget().setPromptingOn();
+ }
+ } else {
+ // we have focus in field, prompting can't be set on, instead
+ // just clear the input if the value has changed from something
+ // else to null
+ if (getWidget().selectedOptionKey != null
+ || (getWidget().allowNewItem && !getWidget().tb
+ .getValue().isEmpty())) {
+ getWidget().tb.setValue("");
+ }
+ }
+ getWidget().setSelectedItemIcon(null);
+ getWidget().selectedOptionKey = null;
+ }
+ }
+
+ @Override
+ public VFilterSelect getWidget() {
+ return (VFilterSelect) super.getWidget();
+ }
+
+ @Override
+ public ComboBoxState getState() {
+ return (ComboBoxState) super.getState();
+ }
+
+ @Override
+ public void layout() {
+ VFilterSelect widget = getWidget();
+ if (widget.initDone) {
+ widget.updateRootWidth();
+ }
+ }
+
+ @Override
+ public void setWidgetEnabled(boolean widgetEnabled) {
+ super.setWidgetEnabled(widgetEnabled);
+ getWidget().enabled = widgetEnabled;
+ getWidget().tb.setEnabled(widgetEnabled);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/public/runtimeweb-components/styles.css b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/public/runtimeweb-components/styles.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components.widget/src/org/eclipse/osbp/runtime/web/vaadin/components/widget/public/runtimeweb-components/styles.css
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/.project b/org.eclipse.osbp.runtime.web.vaadin.components/.project
new file mode 100644
index 0000000..aa9bc6a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/.project
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.components</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.components/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e537a71
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/META-INF/MANIFEST.MF
@@ -0,0 +1,51 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.components
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.components
+Bundle-Version: 0.9.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.osbp.runtime.web.vaadin.components.container;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.converter;
+ uses:="com.vaadin.data.util.converter";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.dialogs;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.fields;
+ uses:="org.eclipse.osbp.runtime.web.vaadin.components.converter,
+ com.vaadin.data,
+ org.eclipse.osbp.runtime.web.vaadin.common.data,
+ com.vaadin.data.util,
+ com.vaadin.ui";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+ uses:="com.vaadin.data,
+ org.eclipse.core.databinding,
+ com.vaadin.data.util.converter,
+ org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter,
+ com.vaadin.ui";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;
+ uses:="com.vaadin.data";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.validator;
+ uses:="com.vaadin.data.validator";version="0.9.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse OSBP
+Import-Package: org.apache.commons.lang,
+ org.osgi.framework;version="1.8.0",
+ org.osgi.service.component;version="1.2.2",
+ org.osgi.service.component.annotations;version="1.2.0"
+Require-Bundle: com.vaadin.client;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.google.guava;bundle-version="[10.0.0,19.0.0)",
+ org.eclipse.core.databinding;bundle-version="[1.4.1,1.5.0)",
+ org.eclipse.core.databinding.beans;bundle-version="[1.2.200,1.5.0)",
+ org.eclipse.core.databinding.observable;bundle-version="[1.4.1,1.5.0)",
+ org.eclipse.core.databinding.property;bundle-version="[1.4.200,1.5.0)",
+ org.eclipse.osbp.runtime.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.apache.commons.collections;bundle-version="3.2.0",
+ org.eclipse.osbp.dsl.dto.lib;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.ecview.core.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.osbp.runtime.web.vaadin.components.widget;bundle-version="[0.9.0,0.10.0)",
+ org.jsoup;bundle-version="1.7.2",
+ org.slf4j.api;bundle-version="1.7.2"
+Service-Component: OSGI-INF/*.xml
+OSBP-ECView-I18nProvider:
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml
new file mode 100644
index 0000000..b2818ea
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.components.container.DatasourceServiceFactoryDelegate"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate"/>
+ </service>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml
new file mode 100644
index 0000000..3ce2aaf
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.components.fields.BeanSearchServiceFactory"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory"/>
+ </service>
+ <reference bind="addDelegate" cardinality="0..n" interface="org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate" name="Delegate" policy="dynamic" unbind="removeDelegate"/>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/about.html b/org.eclipse.osbp.runtime.web.vaadin.components/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/about.ini b/org.eclipse.osbp.runtime.web.vaadin.components/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.components/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/about.properties b/org.eclipse.osbp.runtime.web.vaadin.components/about.properties
new file mode 100644
index 0000000..174cf2d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.components
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/build.properties b/org.eclipse.osbp.runtime.web.vaadin.components/build.properties
new file mode 100644
index 0000000..4beb06f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/build.properties
@@ -0,0 +1,11 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ OSGI-INF/,\
+ i18n/,\
+ .classpath,\
+ .project,\
+ .settings/,\
+ LICENSE.txt
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/i18n/i18n.properties b/org.eclipse.osbp.runtime.web.vaadin.components/i18n/i18n.properties
new file mode 100644
index 0000000..988dd94
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/i18n/i18n.properties
@@ -0,0 +1,29 @@
+
+# General
+org.eclipse.osbp.dialogs.options.cancel=Cancel
+org.eclipse.osbp.dialogs.options.cancel.description=Cancels the action
+
+# Delete
+org.eclipse.osbp.dialogs.acceptdelete.title=Accept delete
+org.eclipse.osbp.dialogs.acceptdelete.message=Please accept delete of data. Undo is not possible
+org.eclipse.osbp.dialogs.acceptdelete.description=Avoids deleting of data
+org.eclipse.osbp.dialogs.options.acceptdelete=Delete
+org.eclipse.osbp.dialogs.options.acceptdelete.description=Clicking this button will delete the data
+
+# Reload if dirty
+org.eclipse.osbp.dialogs.acceptreload.title=Accept reload of dirty data
+org.eclipse.osbp.dialogs.acceptreload.message=Please accept the reload of data. Changes will be lost!
+org.eclipse.osbp.dialogs.acceptreload.description=Since reloading will cause lost data, please accept reload
+org.eclipse.osbp.dialogs.options.acceptreload=Reload
+org.eclipse.osbp.dialogs.options.acceptreload.description=Clicking this button will reload the data
+
+# Reload if dirty
+org.eclipse.osbp.dialogs.acceptloosingdata.title=Accept loosing data
+org.eclipse.osbp.dialogs.acceptloosingdata.message=There are unsaved changes in the view. If you proceed, the data will maybe become lost
+org.eclipse.osbp.dialogs.acceptloosingdata.description=There are unsaved changes in the view. If you proceed, the data will maybe become lost
+org.eclipse.osbp.dialogs.options.acceptloosingdata=Proceed
+org.eclipse.osbp.dialogs.options.acceptloosingdata.description=Clicking this button will proceed the operation
+
+#
+# no images defined here. Images depend on the type of resource and different applications may specific resource types
+#
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.components/pom.xml
new file mode 100644
index 0000000..f940e2f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/pom.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.components</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <description>Contains different fields like NumericField, DecimalField, ...</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+<!-- <scope>provided</scope> -->
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client</artifactId>
+<!-- <scope>provided</scope> -->
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+<!-- <scope>provided</scope> -->
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared</artifactId>
+<!-- <scope>provided</scope> -->
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared-deps</artifactId>
+<!-- <scope>provided</scope> -->
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+<!-- <scope>provided</scope> -->
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <!-- <dependency> -->
+ <!-- <groupId>com.vaadin</groupId> -->
+ <!-- <artifactId>vaadin-testbench</artifactId> -->
+ <!-- <version>3.0.4</version> -->
+ <!-- <scope>test</scope> -->
+ <!-- </dependency> -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+<!-- <scope>provided</scope> -->
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+<!-- Quickfix until we move to 1.8 in releng -->
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-compiler-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <compilerVersion>1.8</compilerVersion>
+ <encoding>UTF-8</encoding>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+<!-- End Quickfix -->
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldClientRpc.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldClientRpc.java
new file mode 100644
index 0000000..1f12aeb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldClientRpc.java
@@ -0,0 +1,10 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.vaadin.shared.communication.ClientRpc;
+
+public interface EntityFieldClientRpc extends ClientRpc {
+
+ // TODO example API
+ public void alert(String message);
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldConnector.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldConnector.java
new file mode 100644
index 0000000..7c9540e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/EntityFieldConnector.java
@@ -0,0 +1,170 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.EntityField;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.shared.EntityFieldState;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.VTooltip;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.Icon;
+import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
+import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
+import com.vaadin.shared.ui.Connect;
+
+@Connect(EntityField.class)
+public class EntityFieldConnector extends AbstractFieldConnector implements
+ FocusHandler, BlurHandler, ClickHandler, ChangeHandler, KeyDownHandler,
+ MouseUpHandler {
+
+ private ShortcutActionHandlerOwner hasShortcutActionHandler;
+
+ @Override
+ public boolean delegateCaptionHandling() {
+ return false;
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ getWidget().init(this);
+ getWidget().client = getConnection();
+ getWidget().id = getConnectorId();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+
+ if (null != getState().errorMessage) {
+
+ if (getWidget().errorIndicatorElement == null) {
+ getWidget().errorIndicatorElement = DOM.createSpan();
+ getWidget().errorIndicatorElement.setInnerHTML("&nbsp;");
+ DOM.setElementProperty(getWidget().errorIndicatorElement,
+ "className", "v-errorindicator");
+ DOM.appendChild(getWidget().getElement(),
+ getWidget().errorIndicatorElement);
+ DOM.sinkEvents(getWidget().errorIndicatorElement,
+ VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
+ } else {
+ DOM.setStyleAttribute(getWidget().errorIndicatorElement,
+ "display", "");
+ }
+ } else if (getWidget().errorIndicatorElement != null) {
+ DOM.setStyleAttribute(getWidget().errorIndicatorElement, "display",
+ "none");
+
+ }
+
+ if (isReadOnly()) {
+ getWidget().setEditable(false);
+ }
+
+ if (getIcon() != null) {
+ if (getWidget().icon == null) {
+ getWidget().icon = new Icon(getConnection());
+ DOM.insertChild(getWidget().getElement(),
+ getWidget().icon.getElement(), 1);
+ getWidget().icon.sinkEvents(VTooltip.TOOLTIP_EVENTS);
+ getWidget().icon.sinkEvents(Event.ONCLICK);
+ }
+ getWidget().icon.setUri(getIcon());
+ } else if (getWidget().icon != null) {
+ // detach icon
+ DOM.removeChild(getWidget().getElement(),
+ getWidget().icon.getElement());
+ getWidget().icon = null;
+ }
+
+ // Set text
+ getWidget().entityNumber = getState().entityNumber;
+ getWidget().entityDescription = getState().entityDescription;
+ getWidget().entityId = getState().entityId;
+ getWidget().immediate = getState().immediate;
+ }
+
+ @Override
+ public EntityFieldState getState() {
+ return (EntityFieldState) super.getState();
+ }
+
+ @Override
+ public VEntityField getWidget() {
+ return (VEntityField) super.getWidget();
+ }
+
+ @Override
+ public void onFocus(FocusEvent event) {
+ // EventHelper.updateFocusHandler ensures that this is called only when
+ // there is a listener on server side
+ getRpcProxy(FocusAndBlurServerRpc.class).focus();
+ }
+
+ @Override
+ public void onBlur(BlurEvent event) {
+ // EventHelper.updateFocusHandler ensures that this is called only when
+ // there is a listener on server side
+ getRpcProxy(FocusAndBlurServerRpc.class).blur();
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ // if (!isEnabled()) {
+ // return;
+ // }
+ //
+ // getState().checked = getWidget().getValue();
+ //
+ // // Add mouse details
+ // MouseEventDetails details = MouseEventDetailsBuilder
+ // .buildMouseEventDetails(event.getNativeEvent(), getWidget()
+ // .getElement());
+ // getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked,
+ // details);
+
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+
+ }
+
+ @Override
+ public void onChange(ChangeEvent event) {
+
+ }
+
+ @Override
+ public void onMouseUp(MouseUpEvent event) {
+
+ }
+
+ private ShortcutActionHandlerOwner getShortcutHandlerOwner() {
+ if (hasShortcutActionHandler == null) {
+ Widget parent = getWidget().getParent();
+ while (parent != null) {
+ if (parent instanceof ShortcutActionHandlerOwner) {
+ break;
+ }
+ parent = parent.getParent();
+ }
+ hasShortcutActionHandler = (ShortcutActionHandlerOwner) parent;
+ }
+ return hasShortcutActionHandler;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityField.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityField.java
new file mode 100644
index 0000000..2314a21
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityField.java
@@ -0,0 +1,218 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.StyleConstants;
+import com.vaadin.client.ui.Field;
+import com.vaadin.client.ui.Icon;
+
+public class VEntityField extends Composite implements Field, KeyPressHandler,
+ KeyDownHandler, Focusable {
+
+ public static final String CLASSNAME = "l-entityfield";
+
+ private final FlowPanel fp = new FlowPanel();
+
+ private EntityFieldConnector connector;
+
+ private VEntityTextField textField;
+ private VEntityLink link;
+ private Widget activeField;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String id;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean immediate;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Element errorIndicatorElement;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Icon icon;
+
+ public String entityNumber;
+ public String entityDescription;
+ public Object entityId;
+
+ public VEntityField() {
+ super();
+ setStyleName(CLASSNAME);
+ addStyleName(StyleConstants.UI_LAYOUT);
+ initWidget(fp);
+ }
+
+ public void init(EntityFieldConnector connector) {
+ this.connector = connector;
+
+ swapEditable(true);
+ }
+
+ // public HandlerRegistration addChangeHandler(ChangeHandler handler) {
+ // return addHandler(handler, ChangeEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
+ // return addHandler(handler, KeyDownEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addFocusHandler(FocusHandler handler) {
+ // return addHandler(handler, FocusEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addBlurHandler(BlurHandler handler) {
+ // return addHandler(handler, BlurEvent.getType());
+ // }
+ //
+ // public HandlerRegistration addClickHandler(ClickHandler handler) {
+ // return addHandler(handler, ClickEvent.getType());
+ // }
+
+ /**
+ * If true, then the widget is editable. False otherwise.
+ *
+ * @param editable
+ */
+ public void setEditable(boolean editable) {
+ swapEditable(editable);
+ }
+
+ private void swapEditable(boolean editable) {
+ if (editable) {
+ if (textField == null) {
+ textField = new VEntityTextField();
+ textField.addChangeHandler(connector);
+ textField.addFocusHandler(connector);
+ textField.addBlurHandler(connector);
+ textField.addKeyDownHandler(connector);
+ }
+
+ if (link != null) {
+ fp.remove(link);
+ }
+ fp.add(textField);
+ } else {
+ if (link == null) {
+ link = new VEntityLink();
+ link.addMouseUpHandler(connector);
+ }
+
+ if (textField != null) {
+ fp.remove(textField);
+ }
+ fp.add(link);
+ }
+ }
+
+ /**
+ * Returns true, if the field is editable.
+ *
+ * @return
+ */
+ private boolean isEditable() {
+ return textField != null && textField.isAttached();
+ }
+
+ @Override
+ public int getTabIndex() {
+ return textField.getTabIndex();
+ }
+
+ @Override
+ public void setAccessKey(char key) {
+ textField.setAccessKey(key);
+ }
+
+ @Override
+ public void setFocus(boolean focused) {
+ /*
+ * Similar issue as with selectAll. Focusing must happen before possible
+ * selectall, so keep the timeout here lower.
+ */
+ new Timer() {
+ @Override
+ public void run() {
+ textField.setFocus(true);
+ }
+ }.schedule(300);
+ }
+
+ @Override
+ public void setTabIndex(int index) {
+ textField.setTabIndex(index);
+ }
+
+ public void setEntityNumber(String value) {
+ if (textField.isAttached()) {
+ textField.setValue(value);
+ }
+ }
+
+ /**
+ * Get the value the text area
+ */
+ public String getEntityNumber() {
+ if (textField.isAttached()) {
+ return textField.getValue();
+ }
+ return "";
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+
+ }
+
+ @Override
+ public void onKeyPress(KeyPressEvent event) {
+
+ }
+
+ // @Override
+ // public void onKeyDown(KeyDownEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onBlur(BlurEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onFocus(FocusEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onChange(ChangeEvent event) {
+ // if (isEditable()) {
+ //
+ // }
+ // }
+ //
+ // @Override
+ // public void onMouseUp(MouseUpEvent event) {
+ // if (!isEditable()) {
+ //
+ // }
+ // }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityLink.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityLink.java
new file mode 100644
index 0000000..83d23af
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityLink.java
@@ -0,0 +1,126 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.Icon;
+import com.vaadin.shared.ui.BorderStyle;
+
+public class VEntityLink extends HTML implements ClickHandler {
+
+ public static final String CLASSNAME = "l-entitylink";
+
+ @Deprecated
+ protected static final BorderStyle BORDER_STYLE_DEFAULT = BorderStyle.DEFAULT;
+
+ @Deprecated
+ protected static final BorderStyle BORDER_STYLE_MINIMAL = BorderStyle.MINIMAL;
+
+ @Deprecated
+ protected static final BorderStyle BORDER_STYLE_NONE = BorderStyle.NONE;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String src;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String target;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public BorderStyle borderStyle = BorderStyle.DEFAULT;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean enabled;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public int targetWidth;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public int targetHeight;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Element errorIndicatorElement;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public final Element anchor = DOM.createAnchor();
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public final Element captionElement = DOM.createSpan();
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Icon icon;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ public VEntityLink() {
+ super();
+ getElement().appendChild(anchor);
+ anchor.appendChild(captionElement);
+ addClickHandler(this);
+ setStyleName(CLASSNAME);
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ if (enabled) {
+ if (target == null) {
+ target = "_self";
+ }
+ String features;
+ switch (borderStyle) {
+ case NONE:
+ features = "menubar=no,location=no,status=no";
+ break;
+ case MINIMAL:
+ features = "menubar=yes,location=no,status=no";
+ break;
+ default:
+ features = "";
+ break;
+ }
+
+ if (targetWidth > 0) {
+ features += (features.length() > 0 ? "," : "") + "width="
+ + targetWidth;
+ }
+ if (targetHeight > 0) {
+ features += (features.length() > 0 ? "," : "") + "height="
+ + targetHeight;
+ }
+
+ if (features.length() > 0) {
+ // if 'special features' are set, use window.open(), unless
+ // a modifier key is held (ctrl to open in new tab etc)
+ Event e = DOM.eventGetCurrentEvent();
+ if (!e.getCtrlKey() && !e.getAltKey() && !e.getShiftKey()
+ && !e.getMetaKey()) {
+ Window.open(src, target, features);
+ e.preventDefault();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onBrowserEvent(Event event) {
+ final Element target = DOM.eventGetTarget(event);
+ if (event.getTypeInt() == Event.ONLOAD) {
+ Util.notifyParentOfSizeChange(this, true);
+ }
+ if (target == captionElement || target == anchor
+ || (icon != null && target == icon.getElement())) {
+ super.onBrowserEvent(event);
+ }
+ if (!enabled) {
+ event.preventDefault();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityTextField.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityTextField.java
new file mode 100644
index 0000000..085c478
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/client/VEntityTextField.java
@@ -0,0 +1,432 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.client;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.TextBoxBase;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.BrowserInfo;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.Field;
+import com.vaadin.shared.EventId;
+import com.vaadin.shared.ui.textfield.TextFieldConstants;
+
+public class VEntityTextField extends TextBoxBase implements Field,
+ ChangeHandler, FocusHandler, BlurHandler, KeyDownHandler {
+
+ /**
+ * The input node CSS classname.
+ */
+ public static final String CLASSNAME = "v-entitytextfield";
+ /**
+ * This CSS classname is added to the input node on hover.
+ */
+ public static final String CLASSNAME_FOCUS = "focus";
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String paintableId;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String valueBeforeEdit = null;
+
+ /**
+ * Set to false if a text change event has been sent since the last value
+ * change event. This means that {@link #valueBeforeEdit} should not be
+ * trusted when determining whether a text change even should be sent.
+ */
+ private boolean valueBeforeEditIsSynced = true;
+
+ private boolean immediate = false;
+ private int maxLength = -1;
+
+ private static final String CLASSNAME_PROMPT = "prompt";
+ private static final String TEXTCHANGE_MODE_TIMEOUT = "TIMEOUT";
+
+ private String inputPrompt = null;
+ private boolean prompting = false;
+ private int lastCursorPos = -1;
+
+ public VEntityTextField() {
+ this(DOM.createInputText());
+ }
+
+ protected VEntityTextField(Element node) {
+ super(node);
+ setStyleName(CLASSNAME);
+ addChangeHandler(this);
+ if (BrowserInfo.get().isIE()) {
+ // IE does not send change events when pressing enter in a text
+ // input so we handle it using a key listener instead
+ addKeyDownHandler(this);
+ }
+ addFocusHandler(this);
+ addBlurHandler(this);
+ }
+
+ /**
+ * For internal use only. May be removed or replaced in the future.
+ * <p>
+ * TODO When GWT adds ONCUT, add it there and remove workaround. See
+ * http://code.google.com/p/google-web-toolkit/issues/detail?id=4030
+ * <p>
+ * Also note that the cut/paste are not totally crossbrowsers compatible.
+ * E.g. in Opera mac works via context menu, but on via File->Paste/Cut.
+ * Opera might need the polling method for 100% working textchanceevents.
+ * Eager polling for a change is bit dum and heavy operation, so I guess we
+ * should first try to survive without.
+ */
+ public static final int TEXTCHANGE_EVENTS = Event.ONPASTE | Event.KEYEVENTS
+ | Event.ONMOUSEUP;
+
+ @Override
+ public void onBrowserEvent(Event event) {
+ super.onBrowserEvent(event);
+
+ if (listenTextChangeEvents
+ && (event.getTypeInt() & TEXTCHANGE_EVENTS) == event
+ .getTypeInt()) {
+ deferTextChangeEvent();
+ }
+
+ }
+
+ /*
+ * TODO optimize this so that only changes are sent + make the value change
+ * event just a flag that moves the current text to value
+ */
+ private String lastTextChangeString = null;
+
+ private String getLastCommunicatedString() {
+ return lastTextChangeString;
+ }
+
+ private void communicateTextValueToServer() {
+ String text = getText();
+ if (prompting) {
+ // Input prompt visible, text is actually ""
+ text = "";
+ }
+ if (!text.equals(getLastCommunicatedString())) {
+ if (valueBeforeEditIsSynced && text.equals(valueBeforeEdit)) {
+ /*
+ * Value change for the current text has been enqueued since the
+ * last text change event was sent, but we can't know that it
+ * has been sent to the server. Ensure that all pending changes
+ * are sent now. Sending a value change without a text change
+ * will simulate a TextChangeEvent on the server.
+ */
+ client.sendPendingVariableChanges();
+ } else {
+ // Default case - just send an immediate text change message
+ client.updateVariable(paintableId,
+ TextFieldConstants.VAR_CUR_TEXT, text, true);
+
+ // Shouldn't investigate valueBeforeEdit to avoid duplicate text
+ // change events as the states are not in sync any more
+ valueBeforeEditIsSynced = false;
+ }
+ lastTextChangeString = text;
+ }
+ }
+
+ private Timer textChangeEventTrigger = new Timer() {
+
+ @Override
+ public void run() {
+ if (isAttached()) {
+ updateCursorPosition();
+ communicateTextValueToServer();
+ scheduled = false;
+ }
+ }
+ };
+
+ private boolean scheduled = false;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean listenTextChangeEvents;
+ /** For internal use only. May be removed or replaced in the future. */
+ public String textChangeEventMode;
+ public int textChangeEventTimeout;
+
+ private void deferTextChangeEvent() {
+ if (textChangeEventMode.equals(TEXTCHANGE_MODE_TIMEOUT) && scheduled) {
+ return;
+ } else {
+ textChangeEventTrigger.cancel();
+ }
+ textChangeEventTrigger.schedule(getTextChangeEventTimeout());
+ scheduled = true;
+ }
+
+ private int getTextChangeEventTimeout() {
+ return textChangeEventTimeout;
+ }
+
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ boolean wasReadOnly = isReadOnly();
+
+ if (readOnly) {
+ setTabIndex(-1);
+ } else if (wasReadOnly && !readOnly && getTabIndex() == -1) {
+ /*
+ * Need to manually set tab index to 0 since server will not send
+ * the tab index if it is 0.
+ */
+ setTabIndex(0);
+ }
+
+ super.setReadOnly(readOnly);
+ }
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public void updateFieldContent(final String text) {
+ setPrompting(inputPrompt != null && focusedTextField != this
+ && (text.equals("")));
+
+ String fieldValue;
+ if (prompting) {
+ fieldValue = isReadOnly() ? "" : inputPrompt;
+ addStyleDependentName(CLASSNAME_PROMPT);
+ } else {
+ fieldValue = text;
+ removeStyleDependentName(CLASSNAME_PROMPT);
+ }
+ setText(fieldValue);
+
+ lastTextChangeString = valueBeforeEdit = text;
+ valueBeforeEditIsSynced = true;
+ }
+
+ protected void onCut() {
+ if (listenTextChangeEvents) {
+ deferTextChangeEvent();
+ }
+ }
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public native void attachCutEventListener(Element el)
+ /*-{
+ var me = this;
+ el.oncut = $entry(function() {
+ me.@com.vaadin.client.ui.VTextField::onCut()();
+ });
+ }-*/;
+
+ protected native void detachCutEventListener(Element el)
+ /*-{
+ el.oncut = null;
+ }-*/;
+
+ @Override
+ protected void onDetach() {
+ super.onDetach();
+ detachCutEventListener(getElement());
+ if (focusedTextField == this) {
+ focusedTextField = null;
+ }
+ }
+
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ if (listenTextChangeEvents) {
+ detachCutEventListener(getElement());
+ }
+ }
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public void setMaxLength(int newMaxLength) {
+ if (newMaxLength == maxLength) {
+ return;
+ }
+ maxLength = newMaxLength;
+ updateMaxLength(maxLength);
+ }
+
+ /**
+ * This method is responsible for updating the DOM or otherwise ensuring
+ * that the given max length is enforced. Called when the max length for the
+ * field has changed.
+ *
+ * @param maxLength
+ * The new max length
+ */
+ protected void updateMaxLength(int maxLength) {
+ if (maxLength >= 0) {
+ getElement().setPropertyInt("maxLength", maxLength);
+ } else {
+ getElement().removeAttribute("maxLength");
+
+ }
+ setMaxLengthToElement(maxLength);
+ }
+
+ protected void setMaxLengthToElement(int newMaxLength) {
+ if (newMaxLength >= 0) {
+ getElement().setPropertyInt("maxLength", newMaxLength);
+ } else {
+ getElement().removeAttribute("maxLength");
+ }
+ }
+
+ public int getMaxLength() {
+ return maxLength;
+ }
+
+ @Override
+ public void onChange(ChangeEvent event) {
+ valueChange(false);
+ }
+
+ /**
+ * Called when the field value might have changed and/or the field was
+ * blurred. These are combined so the blur event is sent in the same batch
+ * as a possible value change event (these are often connected).
+ *
+ * @param blurred
+ * true if the field was blurred
+ */
+ public void valueChange(boolean blurred) {
+ if (client != null && paintableId != null) {
+ boolean sendBlurEvent = false;
+ boolean sendValueChange = false;
+
+ if (blurred && client.hasEventListeners(this, EventId.BLUR)) {
+ sendBlurEvent = true;
+ client.updateVariable(paintableId, EventId.BLUR, "", false);
+ }
+
+ String newText = getText();
+ if (!prompting && newText != null
+ && !newText.equals(valueBeforeEdit)) {
+ sendValueChange = immediate;
+ client.updateVariable(paintableId, "text", newText, false);
+ valueBeforeEdit = newText;
+ valueBeforeEditIsSynced = true;
+ }
+
+ /*
+ * also send cursor position, no public api yet but for easier
+ * extension
+ */
+ updateCursorPosition();
+
+ if (sendBlurEvent || sendValueChange) {
+ /*
+ * Avoid sending text change event as we will simulate it on the
+ * server side before value change events.
+ */
+ textChangeEventTrigger.cancel();
+ scheduled = false;
+ client.sendPendingVariableChanges();
+ }
+ }
+ }
+
+ /**
+ * Updates the cursor position variable if it has changed since the last
+ * update.
+ *
+ * @return true iff the value was updated
+ */
+ protected boolean updateCursorPosition() {
+ if (Util.isAttachedAndDisplayed(this)) {
+ int cursorPos = getCursorPos();
+ if (lastCursorPos != cursorPos) {
+ client.updateVariable(paintableId,
+ TextFieldConstants.VAR_CURSOR, cursorPos, false);
+ lastCursorPos = cursorPos;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static VEntityTextField focusedTextField;
+
+ public static void flushChangesFromFocusedTextField() {
+ if (focusedTextField != null) {
+ focusedTextField.onChange(null);
+ }
+ }
+
+ @Override
+ public void onFocus(FocusEvent event) {
+ addStyleDependentName(CLASSNAME_FOCUS);
+ if (prompting) {
+ setText("");
+ removeStyleDependentName(CLASSNAME_PROMPT);
+ setPrompting(false);
+ }
+ focusedTextField = this;
+ if (client != null && client.hasEventListeners(this, EventId.FOCUS)) {
+ client.updateVariable(paintableId, EventId.FOCUS, "", true);
+ }
+ }
+
+ @Override
+ public void onBlur(BlurEvent event) {
+ // this is called twice on Chrome when e.g. changing tab while prompting
+ // field focused - do not change settings on the second time
+ if (focusedTextField != this) {
+ return;
+ }
+ removeStyleDependentName(CLASSNAME_FOCUS);
+ focusedTextField = null;
+ String text = getText();
+ setPrompting(inputPrompt != null && (text == null || "".equals(text)));
+ if (prompting) {
+ setText(isReadOnly() ? "" : inputPrompt);
+ addStyleDependentName(CLASSNAME_PROMPT);
+ }
+
+ valueChange(true);
+ }
+
+ private void setPrompting(boolean prompting) {
+ this.prompting = prompting;
+ }
+
+ public void setColumns(int columns) {
+ if (columns <= 0) {
+ return;
+ }
+
+ setWidth(columns + "em");
+ }
+
+ @Override
+ public void onKeyDown(KeyDownEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+ valueChange(false);
+ }
+ }
+
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public void setInputPrompt(String inputPrompt) {
+ this.inputPrompt = inputPrompt;
+ }
+
+ protected boolean isWordwrap() {
+ String wrap = getElement().getAttribute("wrap");
+ return !"off".equals(wrap);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/runtimeweb-components/styles.css b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/runtimeweb-components/styles.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/runtimeweb-components/styles.css
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityField.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityField.java
new file mode 100644
index 0000000..89b5570
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityField.java
@@ -0,0 +1,123 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.shared.EntityFieldState;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CustomField;
+
+@SuppressWarnings("serial")
+public class EntityField extends CustomField<String> {
+
+ public static final String CLASSNAME = "entityfield";
+
+ private Class<?> entityClass;
+ private final boolean isUUID;
+
+ public EntityField() {
+ this(true);
+ }
+
+ public EntityField(boolean isUUID) {
+ setStyleName(CLASSNAME);
+ this.isUUID = isUUID;
+ }
+
+ @Override
+ protected Component initContent() {
+ return null;
+ }
+
+ @Override
+ public EntityFieldState getState() {
+ return (EntityFieldState) super.getState();
+ }
+
+ @Override
+ public Class<? extends String> getType() {
+ return String.class;
+ }
+
+ /**
+ * @return the entityId
+ */
+ public long getEntityId() {
+ if (isUUID) {
+ throw new IllegalStateException(
+ "The entity field was defined as a UUID field. Can not be cast to long!");
+ }
+ try {
+ return (Long) getState().entityId;
+ } catch (Exception e) {
+ throw new IllegalStateException(getState().entityId
+ + " can not be cast to Long!");
+ }
+ }
+
+ /**
+ * @param entityId
+ * the entityId to set
+ */
+ public void setEntityId(long entityId) {
+ getState().entityId = entityId;
+ }
+
+ /**
+ * @return the entityUUID
+ */
+ public String getEntityUUID() {
+ try {
+ return (String) getState().entityId;
+ } catch (Exception e) {
+ throw new IllegalStateException(getState().entityId
+ + " can not be cast to String!");
+ }
+ }
+
+ /**
+ * @param entityUUID
+ * the entityUUID to set
+ */
+ public void setEntityUUID(String entityUUID) {
+ getState().entityId = entityUUID;
+ }
+
+ /**
+ * @return the entityClass
+ */
+ public Class<?> getEntityClass() {
+ return entityClass;
+ }
+
+ /**
+ * @param entityClass
+ * the entityClass to set
+ */
+ public void setEntityClass(Class<?> entityClass) {
+ this.entityClass = entityClass;
+ }
+
+ /**
+ * @return the searchEnabled
+ */
+ public boolean isSearchEnabled() {
+ return getState().searchEnabled;
+ }
+
+ /**
+ * @param searchEnabled
+ * the searchEnabled to set
+ */
+ public void setSearchEnabled(boolean searchEnabled) {
+ getState().searchEnabled = searchEnabled;
+ }
+
+ /**
+ * Returns true, if the id of the field is an UUID.
+ *
+ * @return the isUUID
+ */
+ public boolean isUUID() {
+ return isUUID;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityFieldServerRpc.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityFieldServerRpc.java
new file mode 100644
index 0000000..4110e25
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/server/EntityFieldServerRpc.java
@@ -0,0 +1,9 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+public interface EntityFieldServerRpc extends ServerRpc {
+
+ public void searchTriggered();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/shared/EntityFieldState.java b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/shared/EntityFieldState.java
new file mode 100644
index 0000000..5fe8eb0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/saveForlater/shared/EntityFieldState.java
@@ -0,0 +1,36 @@
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.shared;
+
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.annotations.DelegateToWidget;
+
+@SuppressWarnings("serial")
+public class EntityFieldState extends AbstractFieldState {
+ {
+ primaryStyleName = "l-entityfield";
+ }
+
+ /**
+ * The business key of the entity.
+ */
+ @DelegateToWidget
+ public String entityNumber;
+
+ /**
+ * The description of the entity.
+ */
+ @DelegateToWidget
+ public String entityDescription;
+
+ /**
+ * The object representation of the entity id.
+ */
+ @DelegateToWidget
+ public Object entityId;
+
+ /**
+ * True if the search icon should be visible.
+ */
+ @DelegateToWidget
+ public boolean searchEnabled;
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/container/DatasourceServiceFactoryDelegate.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/container/DatasourceServiceFactoryDelegate.java
new file mode 100644
index 0000000..23ec943
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/container/DatasourceServiceFactoryDelegate.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.container;
+
+import org.eclipse.osbp.runtime.common.datasource.IDataSourceService;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulInMemoryBeanSearchService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.annotations.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Returns an inmemory datasource service. Contents are loaded eagerly.
+ */
+@Component(service = IBeanSearchServiceFactoryDelegate.class)
+public class DatasourceServiceFactoryDelegate implements
+ IBeanSearchServiceFactoryDelegate {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(DatasourceServiceFactoryDelegate.class);
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <DataSourceInfo> IBeanSearchService<DataSourceInfo> createService(
+ Class<DataSourceInfo> type) {
+ if (type != IDataSourceService.DataSourceInfo.class) {
+ return null;
+ }
+
+ StatefulInMemoryBeanSearchService<DataSourceInfo> service = new StatefulInMemoryBeanSearchService<DataSourceInfo>(
+ type);
+ BundleContext context = FrameworkUtil.getBundle(
+ DatasourceServiceFactoryDelegate.class).getBundleContext();
+
+ // find all datasource infos
+ ServiceReference<IDataSourceService> ref = context
+ .getServiceReference(IDataSourceService.class);
+ if (ref != null) {
+ IDataSourceService dsService = context.getService(ref);
+ dsService.getDataSourcInfos(null).stream().forEach(t -> {
+ // add them to the service
+ service.addBean((DataSourceInfo) t);
+ });
+ } else {
+ LOGGER.error("No datasource service available!");
+ }
+
+ return service;
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/DecimalConverter.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/DecimalConverter.java
new file mode 100644
index 0000000..a4ce269
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/DecimalConverter.java
@@ -0,0 +1,255 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.converter;
+
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import org.apache.commons.lang.StringEscapeUtils;
+
+import com.vaadin.data.util.converter.StringToDoubleConverter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A converter used to format and parse Decimal values.
+ */
+@SuppressWarnings("serial")
+public class DecimalConverter extends StringToDoubleConverter {
+
+ /** The integer instance. */
+ private boolean integerInstance;
+
+ /** The number format pattern. */
+ private String numberFormatPattern;
+
+ /** The use grouping. */
+ private boolean useGrouping;
+
+ /** The decimal format symbols. */
+ private DecimalFormatSymbols decimalFormatSymbols;
+
+ /** The custom format symbols. */
+ private boolean customFormatSymbols;
+
+ /** The precision. */
+ private int precision;
+
+ /**
+ * Instantiates a new decimal converter.
+ */
+ public DecimalConverter() {
+ this(false);
+ }
+
+ /**
+ * Instantiates a new decimal converter.
+ *
+ * @param integerInstance
+ * the integer instance
+ */
+ public DecimalConverter(boolean integerInstance) {
+ this.integerInstance = integerInstance;
+ this.numberFormatPattern = getDefaultFormat();
+ this.decimalFormatSymbols = getDefaultFormatSymbols();
+ this.precision = getDefaultPrecision();
+ this.useGrouping = getDefaultUseGrouping();
+ }
+
+ /**
+ * Returns the default value for use grouping.
+ *
+ * @return the default use grouping
+ */
+ protected boolean getDefaultUseGrouping() {
+ return true;
+ }
+
+ /**
+ * Returns the default value for precision.
+ *
+ * @return the default precision
+ */
+ protected int getDefaultPrecision() {
+ return 2;
+ }
+
+ /**
+ * Returns the default value for format symbols.
+ *
+ * @return the default format symbols
+ */
+ protected DecimalFormatSymbols getDefaultFormatSymbols() {
+ return new DecimalFormatSymbols();
+ }
+
+ /**
+ * Returns the default value for default format.
+ *
+ * @return the default format
+ */
+ protected String getDefaultFormat() {
+ return "##,##0.00";
+ }
+
+ /**
+ * Sets the number format pattern that should be used to format the number.
+ *
+ * @param numberFormatPattern
+ * the numberFormatPattern to set
+ */
+ protected void setNumberFormatPattern(String numberFormatPattern) {
+ this.numberFormatPattern = numberFormatPattern;
+ }
+
+ /**
+ * Sets the {@link DecimalFormatSymbols} that should be used by the
+ * formatter.
+ *
+ * @param decimalFormatSymbols
+ * the decimalFormatSymbols to set
+ */
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ this.decimalFormatSymbols = decimalFormatSymbols;
+
+ if (decimalFormatSymbols != null) {
+ customFormatSymbols = true;
+ } else {
+ customFormatSymbols = false;
+ }
+ }
+
+ /**
+ * Returns the currently used number format pattern.
+ *
+ * @return the number format pattern
+ */
+ public String getNumberFormatPattern() {
+ return numberFormatPattern;
+ }
+
+ /**
+ * Returns the currently used format symbols.
+ *
+ * @return the decimal format symbols
+ */
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return decimalFormatSymbols;
+ }
+
+ /**
+ * If true, then grouping should be used. False otherwise. Default is true.
+ *
+ * @return true, if is use grouping
+ */
+ public boolean isUseGrouping() {
+ return useGrouping;
+ }
+
+ /**
+ * If true, then grouping should be used. False otherwise. Default is true.
+ *
+ * @param useGrouping
+ * the new use grouping
+ */
+ public void setUseGrouping(boolean useGrouping) {
+ this.useGrouping = useGrouping;
+ }
+
+ /**
+ * Returns the precision of that decimal field.
+ *
+ * @return the precision
+ */
+ public int getPrecision() {
+ return precision;
+ }
+
+ /**
+ * Sets the precision of that decimal field.
+ *
+ * @param precision
+ * the new precision
+ */
+ public void setPrecision(int precision) {
+ this.precision = precision;
+
+ updateNumberFormat();
+ }
+
+ /**
+ * Sets the number format pattern to be used for formatting.
+ */
+ protected void updateNumberFormat() {
+ String format = "##,##0";
+
+ if (precision > 0) {
+ format = format.concat(".");
+ }
+ for (int i = 0; i < precision; i++) {
+ format = format.concat("0");
+ }
+
+ setNumberFormatPattern(format);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.data.util.converter.AbstractStringToNumberConverter#getFormat
+ * (java.util.Locale)
+ */
+ protected NumberFormat getFormat(Locale locale) {
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ NumberFormat result = null;
+ if (numberFormatPattern != null && !numberFormatPattern.equals("")) {
+ try {
+ if (decimalFormatSymbols != null && customFormatSymbols) {
+ result = new DecimalFormat(
+ StringEscapeUtils.unescapeHtml(numberFormatPattern),
+ decimalFormatSymbols);
+ } else {
+ result = new DecimalFormat(
+ StringEscapeUtils.unescapeHtml(numberFormatPattern),
+ DecimalFormatSymbols.getInstance(locale));
+ }
+
+ if (integerInstance) {
+ result.setParseIntegerOnly(true);
+ result.setRoundingMode(RoundingMode.HALF_EVEN);
+ }
+ } catch (IllegalArgumentException e) {
+ String msg = String.format(
+ "formatter %s is invalid for decimal numbers: %s",
+ numberFormatPattern, e.getLocalizedMessage());
+ throw new ConversionException(msg);
+ }
+ } else {
+ if (integerInstance) {
+ result = NumberFormat.getIntegerInstance(locale);
+ } else {
+ result = NumberFormat.getNumberInstance(locale);
+ }
+ }
+
+ result.setGroupingUsed(useGrouping);
+
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/NumberConverter.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/NumberConverter.java
new file mode 100644
index 0000000..7b53879
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/NumberConverter.java
@@ -0,0 +1,174 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.converter;
+
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import org.apache.commons.lang.StringEscapeUtils;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A converter to format and parse Integer values.
+ */
+@SuppressWarnings("serial")
+public class NumberConverter extends StringToNumberConverter {
+
+ /** The number format pattern. */
+ private String numberFormatPattern;
+
+ /** The use grouping. */
+ private boolean useGrouping;
+
+ /** The decimal format symbols. */
+ private DecimalFormatSymbols decimalFormatSymbols;
+
+ /** The custom format symbols. */
+ private boolean customFormatSymbols;
+
+ /**
+ * Instantiates a new number converter.
+ */
+ public NumberConverter() {
+ this.numberFormatPattern = getDefaultFormat();
+ this.decimalFormatSymbols = getDefaultFormatSymbols();
+ this.useGrouping = getDefaultUseGrouping();
+ }
+
+ /**
+ * Returns the default value for use grouping.
+ *
+ * @return the default use grouping
+ */
+ protected boolean getDefaultUseGrouping() {
+ return true;
+ }
+
+ /**
+ * Returns the default value for format symbols.
+ *
+ * @return the default format symbols
+ */
+ protected DecimalFormatSymbols getDefaultFormatSymbols() {
+ return new DecimalFormatSymbols();
+ }
+
+ /**
+ * Returns the default value for default format.
+ *
+ * @return the default format
+ */
+ protected String getDefaultFormat() {
+ return "##,##0";
+ }
+
+ /**
+ * Sets the number format pattern that should be used to format the number.
+ *
+ * @param numberFormatPattern
+ * the numberFormatPattern to set
+ */
+ protected void setNumberFormatPattern(String numberFormatPattern) {
+ this.numberFormatPattern = numberFormatPattern;
+ }
+
+ /**
+ * Sets the {@link DecimalFormatSymbols} that should be used by the
+ * formatter.
+ *
+ * @param decimalFormatSymbols
+ * the decimalFormatSymbols to set
+ */
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ this.decimalFormatSymbols = decimalFormatSymbols;
+
+ if (decimalFormatSymbols != null) {
+ customFormatSymbols = true;
+ } else {
+ customFormatSymbols = false;
+ }
+ }
+
+ /**
+ * Returns the currently used number format pattern.
+ *
+ * @return the number format pattern
+ */
+ public String getNumberFormatPattern() {
+ return numberFormatPattern;
+ }
+
+ /**
+ * Returns the currently used format symbols.
+ *
+ * @return the decimal format symbols
+ */
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return decimalFormatSymbols;
+ }
+
+ /**
+ * If true, then grouping should be used. False otherwise. Default is true.
+ *
+ * @return true, if is use grouping
+ */
+ public boolean isUseGrouping() {
+ return useGrouping;
+ }
+
+ /**
+ * If true, then grouping should be used. False otherwise. Default is true.
+ *
+ * @param useGrouping
+ * the new use grouping
+ */
+ public void setUseGrouping(boolean useGrouping) {
+ this.useGrouping = useGrouping;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.converter.AbstractStringToNumberConverter#getFormat(java.util.Locale)
+ */
+ protected NumberFormat getFormat(Locale locale) {
+ if (locale == null) {
+ locale = Locale.getDefault();
+ }
+
+ NumberFormat result = null;
+ if (numberFormatPattern != null && !numberFormatPattern.equals("")) {
+ try{
+ if (decimalFormatSymbols != null && customFormatSymbols) {
+ result = new DecimalFormat(StringEscapeUtils.unescapeHtml(numberFormatPattern),
+ decimalFormatSymbols);
+ } else {
+ result = new DecimalFormat(StringEscapeUtils.unescapeHtml(numberFormatPattern),
+ DecimalFormatSymbols.getInstance(locale));
+ }
+ result.setParseIntegerOnly(true);
+ result.setRoundingMode(RoundingMode.HALF_EVEN);
+ } catch (IllegalArgumentException e){
+ String msg = String.format("formatter %s is invalid for decimal numbers: %s", numberFormatPattern, e.getLocalizedMessage());
+ throw new ConversionException(msg);
+ }
+ } else {
+ result = NumberFormat.getIntegerInstance(locale);
+ }
+
+ result.setGroupingUsed(useGrouping);
+
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/StringToNumberConverter.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/StringToNumberConverter.java
new file mode 100644
index 0000000..143770b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/converter/StringToNumberConverter.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.converter;
+
+import java.util.Locale;
+
+import com.vaadin.data.util.converter.AbstractStringToNumberConverter;
+
+@SuppressWarnings("serial")
+public class StringToNumberConverter extends
+ AbstractStringToNumberConverter<Number> {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object,
+ * java.util.Locale)
+ */
+ @Override
+ public Number convertToModel(String value,
+ Class<? extends Number> targetType, Locale locale)
+ throws ConversionException {
+ Number n = convertToNumber(value, targetType, locale);
+ return n == null ? null : toResult(n, targetType);
+ }
+
+ protected Number toResult(Number n, Class<? extends Number> targetType) {
+ if (targetType == Byte.class) {
+ return (Byte) n.byteValue();
+ } else if (targetType == Short.class) {
+ return (Short) n.shortValue();
+ } else if (targetType == Integer.class) {
+ return (Integer) n.intValue();
+ } else if (targetType == Long.class) {
+ return (Long) n.longValue();
+ } else if (targetType == Float.class) {
+ return (Float) n.floatValue();
+ } else if (targetType == Double.class) {
+ return (Double) n.doubleValue();
+ }
+ return n.doubleValue();
+ }
+
+ @Override
+ public Class<Number> getModelType() {
+ return Number.class;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractDialog.java
new file mode 100644
index 0000000..c9ece43
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractDialog.java
@@ -0,0 +1,385 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+
+import com.vaadin.server.Resource;
+import com.vaadin.ui.AbstractComponentContainer;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.CloseEvent;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AbstractDialog.
+ */
+public abstract class AbstractDialog {
+
+ /** The config. */
+ protected final DialogConfig config;
+
+ /** The options. */
+ protected final Option[] options;
+
+ /** The window. */
+ protected Window window;
+
+ /** The main layout. */
+ protected VerticalLayout mainLayout;
+
+ /** The custom area. */
+ protected AbstractComponentContainer customArea;
+
+ /** The options area. */
+ protected HorizontalLayout optionsArea;
+
+ /**
+ * Create resource for the given iconPath.
+ *
+ * @param iconPath
+ * the icon path
+ * @param resourceProvider
+ * the resource provider
+ * @return the resource
+ */
+ protected static Resource createResource(String iconPath,
+ IResourceProvider resourceProvider) {
+ if (resourceProvider == null) {
+ return null;
+ }
+ return resourceProvider.getResource(iconPath);
+ }
+
+ /**
+ * Instantiates a new abstract dialog.
+ *
+ * @param config
+ * the config
+ * @param options
+ * the options
+ */
+ protected AbstractDialog(DialogConfig config, Option... options) {
+ this.config = config;
+ this.options = options;
+ }
+
+ /**
+ * Open.
+ */
+ @SuppressWarnings("serial")
+ protected void open() {
+
+ prepareLayout();
+
+ configDialog();
+
+ prepareOptions();
+
+ window.addCloseListener(new Window.CloseListener() {
+ @Override
+ public void windowClose(CloseEvent e) {
+ close();
+ }
+ });
+
+ UI.getCurrent().addWindow(window);
+ }
+
+ /**
+ * Prepare the options.
+ */
+ protected void prepareOptions() {
+ if (options != null) {
+ @SuppressWarnings("serial")
+ Button.ClickListener listener = new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Button button = event.getButton();
+ execute((Option) button.getData());
+ }
+ };
+
+ for (Option option : options) {
+ NativeButton button = new NativeButton(option.getName());
+ optionsArea.addComponent(button);
+ button.setIcon(option.getIcon());
+ button.setDescription(option.getDescription());
+ button.setData(option);
+ button.addClickListener(listener);
+ }
+ }
+ }
+
+ /**
+ * Config the dialog.
+ */
+ protected void configDialog() {
+
+ if (config != null) {
+ window.setCaption(config.getDialogName());
+ window.setDescription(config.getDescription());
+
+ // use callback
+ config.config(window);
+ }
+
+ }
+
+ /**
+ * Prepare the main layout.
+ */
+ protected abstract void prepareLayout();
+
+ /**
+ * Close the window.
+ */
+ protected void close() {
+ if (window != null) {
+ window.close();
+ window = null;
+ }
+ }
+
+ /**
+ * Execute the runnable.
+ *
+ * @param option
+ * the option
+ */
+ protected void execute(Option option) {
+ if (option.canExecute()) {
+ if (option.getRunnable() != null) {
+ option.getRunnable().run();
+ }
+ close();
+ }
+ }
+
+ /**
+ * Information how to config the dialog. Clients may override
+ * {@link #config(Window)} to get access about the window before opening. So
+ * clients may set size, position,...
+ */
+ public static class DialogConfig {
+
+ /** The dialog name. */
+ private final String dialogName;
+
+ /** The message. */
+ private final String message;
+
+ /** The description. */
+ private final String description;
+
+ /** The icon. */
+ private final Resource icon;
+
+ /**
+ * Instantiates a new dialog config.
+ *
+ * @param dialogName
+ * the dialog name
+ * @param message
+ * the message
+ * @param description
+ * the description
+ * @param icon
+ * the icon
+ */
+ public DialogConfig(String dialogName, String message,
+ String description, Resource icon) {
+ super();
+ this.dialogName = dialogName;
+ this.message = message;
+ this.description = description;
+ this.icon = icon;
+ }
+
+ /**
+ * Clients may override to config the window before opening.
+ *
+ * @param window
+ * the window
+ */
+ public void config(Window window) {
+
+ }
+
+ /**
+ * Gets the dialog name.
+ *
+ * @return the dialogName
+ */
+ protected String getDialogName() {
+ return dialogName;
+ }
+
+ /**
+ * Gets the message.
+ *
+ * @return the message
+ */
+ protected String getMessage() {
+ return message;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ protected String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the icon.
+ *
+ * @return the icon
+ */
+ protected Resource getIcon() {
+ return icon;
+ }
+
+ }
+
+ /**
+ * Represents a single option.
+ */
+ public static class Option {
+
+ /** The name. */
+ private String name;
+
+ /** The description. */
+ private String description;
+
+ /** The icon. */
+ private Resource icon;
+
+ /** The runnable. */
+ private Runnable runnable;
+
+ /**
+ * Instantiates a new option.
+ *
+ * @param name
+ * the name
+ * @param description
+ * the description
+ * @param icon
+ * the icon
+ * @param runnable
+ * the runnable
+ */
+ public Option(String name, String description, Resource icon,
+ Runnable runnable) {
+ super();
+ this.name = name;
+ this.description = description;
+ this.icon = icon;
+ this.runnable = runnable;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ protected String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name
+ * the name to set
+ */
+ protected void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ protected String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description
+ * the description to set
+ */
+ protected void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the icon.
+ *
+ * @return the icon
+ */
+ protected Resource getIcon() {
+ return icon;
+ }
+
+ /**
+ * Sets the icon.
+ *
+ * @param icon
+ * the icon to set
+ */
+ protected void setIcon(Resource icon) {
+ this.icon = icon;
+ }
+
+ /**
+ * Gets the runnable.
+ *
+ * @return the runnable
+ */
+ protected Runnable getRunnable() {
+ return runnable;
+ }
+
+ /**
+ * Sets the runnable.
+ *
+ * @param runnable
+ * the runnable to set
+ */
+ protected void setRunnable(Runnable runnable) {
+ this.runnable = runnable;
+ }
+
+ /**
+ * Can execute.
+ *
+ * @return true, if successful
+ */
+ public boolean canExecute() {
+ return true;
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractInputDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractInputDialog.java
new file mode 100644
index 0000000..d769f49
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractInputDialog.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class AbstractInputDialog.
+ */
+public abstract class AbstractInputDialog extends AbstractDialog {
+
+ /**
+ * Instantiates a new abstract input dialog.
+ *
+ * @param config
+ * the config
+ * @param options
+ * the options
+ */
+ protected AbstractInputDialog(DialogConfig config, Option... options) {
+ super(config, options);
+ }
+
+ /**
+ * Prepare the main layout.
+ */
+ protected void prepareLayout() {
+ window = new Window();
+ window.setModal(true);
+ mainLayout = new VerticalLayout();
+ mainLayout.setSizeFull();
+ mainLayout.setMargin(true);
+ mainLayout.setSpacing(true);
+ window.setContent(mainLayout);
+
+ customArea = new FormLayout();
+ ((FormLayout) customArea).setSpacing(true);
+ customArea.setSizeFull();
+ mainLayout.addComponent(customArea);
+ mainLayout.setExpandRatio(customArea, 1.0f);
+
+ fillForm((FormLayout) customArea);
+
+ optionsArea = new HorizontalLayout();
+ optionsArea.setSpacing(true);
+ mainLayout.addComponent(optionsArea);
+ }
+
+ /**
+ * Fill the form and bind it to a datasource.
+ *
+ * @param customArea
+ * the custom area
+ */
+ protected abstract void fillForm(FormLayout customArea);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractMessageDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractMessageDialog.java
new file mode 100644
index 0000000..5ae781d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AbstractMessageDialog.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Embedded;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+public abstract class AbstractMessageDialog extends AbstractDialog {
+
+ protected Embedded messageIcon;
+ protected Label messageText;
+
+ protected AbstractMessageDialog(DialogConfig config, Option... options) {
+ super(config, options);
+ }
+
+ /**
+ * Config the dialog.
+ */
+ protected void configDialog() {
+ super.configDialog();
+
+ if (config != null) {
+ if (messageIcon != null) {
+ messageIcon.setSource(config.getIcon());
+ }
+ if (messageText != null) {
+ messageText.setValue(config.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Prepare the main layout.
+ */
+ protected void prepareLayout() {
+ window = new Window();
+ window.setModal(true);
+ mainLayout = new VerticalLayout();
+ mainLayout.setSizeFull();
+ mainLayout.setMargin(true);
+ mainLayout.setSpacing(true);
+ window.setContent(mainLayout);
+
+ customArea = new HorizontalLayout();
+ ((HorizontalLayout) customArea).setSpacing(true);
+ customArea.setSizeFull();
+ mainLayout.addComponent(customArea);
+ mainLayout.setExpandRatio(customArea, 1.0f);
+
+ messageIcon = new Embedded();
+ customArea.addComponent(messageIcon);
+
+ messageText = new Label();
+ messageText.setContentMode(ContentMode.TEXT);
+ customArea.addComponent(messageText);
+ messageText.setSizeFull();
+ ((HorizontalLayout) customArea).setExpandRatio(messageText, 1.0f);
+
+ optionsArea = new HorizontalLayout();
+ optionsArea.setSpacing(true);
+ mainLayout.addComponent(optionsArea);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java
new file mode 100644
index 0000000..d0f98d5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptDeleteDialog.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+/**
+ * Dialog to accept a delete operation.
+ */
+public class AcceptDeleteDialog extends OptionsDialog {
+
+ public static void showDialog(II18nService service,
+ IResourceProvider resourceProvider, Runnable onDelete, Runnable onCancel) {
+ if (service == null) {
+ throw new NullPointerException("Please pass an i18nService");
+ }
+
+ Locale locale = UI.getCurrent().getLocale();
+ String dialogTitle = service.getValue(
+ IDialogI18nKeys.ACCEPT_DELETE_DIALOG_TITLE, locale);
+ String dialogMessage = service.getValue(
+ IDialogI18nKeys.ACCEPT_DELETE_DIALOG_MESSAGE, locale);
+ String dialogDescription = service.getValue(
+ IDialogI18nKeys.ACCEPT_DELETE_DIALOG_DESCRIPTION, locale);
+ String dialogIcon = service.getValue(
+ IDialogI18nKeys.ACCEPT_DELETE_DIALOG_ICON, locale);
+ String optionDeleteCaption = service.getValue(
+ IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_CAPTION,
+ locale);
+ String optionDeleteDescription = service
+ .getValue(
+ IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_DESCRIPTION,
+ locale);
+ String optionDeleteIcon = service.getValue(
+ IDialogI18nKeys.ACCEPT_DELETE__DIALOG_OPTION__DELETE_ICON,
+ locale);
+ String optionCancelCaption = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION, locale);
+ String optionCancelDescription = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION, locale);
+ String optionCancelIcon = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON, locale);
+
+ DialogConfig config = new DialogConfig(dialogTitle, dialogMessage,
+ dialogDescription, createResource(dialogIcon, resourceProvider)) {
+ @Override
+ public void config(Window window) {
+ super.config(window);
+ window.setHeight("170px");
+ window.setWidth("350px");
+ window.center();
+ }
+ };
+
+ AcceptDeleteDialog dialog = new AcceptDeleteDialog(config, new Option(
+ optionCancelCaption, optionCancelDescription, createResource(
+ optionCancelIcon, resourceProvider), onCancel), new Option(
+ optionDeleteCaption, optionDeleteDescription, createResource(
+ optionDeleteIcon, resourceProvider), onDelete));
+ dialog.open();
+ }
+
+ private AcceptDeleteDialog(DialogConfig config, Option... options) {
+ super(config, options);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java
new file mode 100644
index 0000000..9d77238
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptLoosingDataDialog.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+/**
+ * Dialog to accept that data will be lost.
+ */
+public class AcceptLoosingDataDialog extends OptionsDialog {
+
+ public static void showDialog(II18nService service,
+ IResourceProvider resourceProvider, Runnable onDelete,
+ Runnable onCancel) {
+ if (service == null) {
+ throw new NullPointerException("Please pass an i18nService");
+ }
+
+ Locale locale = UI.getCurrent().getLocale();
+ String dialogTitle = service.getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_TITLE, locale);
+ String dialogMessage = service.getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_MESSAGE, locale);
+ String dialogDescription = service.getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_DESCRIPTION, locale);
+ String dialogIcon = service.getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA_DIALOG_ICON, locale);
+ String optionDeleteCaption = service.getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_CAPTION,
+ locale);
+ String optionDeleteDescription = service
+ .getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_DESCRIPTION,
+ locale);
+ String optionDeleteIcon = service.getValue(
+ IDialogI18nKeys.ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_ICON,
+ locale);
+ String optionCancelCaption = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION, locale);
+ String optionCancelDescription = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION, locale);
+ String optionCancelIcon = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON, locale);
+
+ DialogConfig config = new DialogConfig(dialogTitle, dialogMessage,
+ dialogDescription, createResource(dialogIcon, resourceProvider)) {
+ @Override
+ public void config(Window window) {
+ super.config(window);
+ window.setHeight("170px");
+ window.setWidth("350px");
+ window.center();
+ }
+ };
+
+ AcceptLoosingDataDialog dialog = new AcceptLoosingDataDialog(config,
+ new Option(optionCancelCaption, optionCancelDescription,
+ createResource(optionCancelIcon, resourceProvider),
+ onCancel), new Option(optionDeleteCaption,
+ optionDeleteDescription, createResource(
+ optionDeleteIcon, resourceProvider), onDelete));
+ dialog.open();
+ }
+
+ private AcceptLoosingDataDialog(DialogConfig config, Option... options) {
+ super(config, options);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java
new file mode 100644
index 0000000..41dcde2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/AcceptReloadDialog.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.common.i18n.II18nService;
+import org.eclipse.osbp.runtime.web.vaadin.common.resource.IResourceProvider;
+
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Window;
+
+/**
+ * Dialog to accept the reload of dirty data. Data will be lost if proceeded.
+ */
+public class AcceptReloadDialog extends OptionsDialog {
+
+ public static void showDialog(II18nService service,
+ IResourceProvider resourceProvider, Runnable onDelete,
+ Runnable onCancel) {
+ if (service == null) {
+ throw new NullPointerException("Please pass an i18nService");
+ }
+
+ Locale locale = UI.getCurrent().getLocale();
+ String dialogTitle = service.getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_TITLE, locale);
+ String dialogMessage = service.getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_MESSAGE, locale);
+ String dialogDescription = service.getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_DESCRIPTION, locale);
+ String dialogIcon = service.getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD_DIALOG_ICON, locale);
+ String optionDeleteCaption = service.getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_CAPTION,
+ locale);
+ String optionDeleteDescription = service
+ .getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_DESCRIPTION,
+ locale);
+ String optionDeleteIcon = service.getValue(
+ IDialogI18nKeys.ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_ICON,
+ locale);
+ String optionCancelCaption = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_CAPTION, locale);
+ String optionCancelDescription = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_DESCRIPTION, locale);
+ String optionCancelIcon = service.getValue(
+ IDialogI18nKeys.DIALOG_OPTION__CANCEL_ICON, locale);
+
+ DialogConfig config = new DialogConfig(dialogTitle, dialogMessage,
+ dialogDescription, createResource(dialogIcon, resourceProvider)) {
+ @Override
+ public void config(Window window) {
+ super.config(window);
+ window.setHeight("170px");
+ window.setWidth("350px");
+ window.center();
+ }
+ };
+
+ AcceptReloadDialog dialog = new AcceptReloadDialog(config, new Option(
+ optionCancelCaption, optionCancelDescription, createResource(
+ optionCancelIcon, resourceProvider), onCancel),
+ new Option(optionDeleteCaption, optionDeleteDescription,
+ createResource(optionDeleteIcon, resourceProvider),
+ onDelete));
+ dialog.open();
+ }
+
+ private AcceptReloadDialog(DialogConfig config, Option... options) {
+ super(config, options);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java
new file mode 100644
index 0000000..e006303
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/IDialogI18nKeys.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+public interface IDialogI18nKeys {
+
+ //
+ // general
+ //
+ public static final String DIALOG_OPTION__CANCEL_CAPTION = "org.eclipse.osbp.dialogs.options.cancel";
+ public static final String DIALOG_OPTION__CANCEL_DESCRIPTION = "org.eclipse.osbp.dialogs.options.cancel.description";
+ public static final String DIALOG_OPTION__CANCEL_ICON = "org.eclipse.osbp.dialogs.options.cancel.image";
+
+ //
+ // delete
+ //
+ public static final String ACCEPT_DELETE_DIALOG_TITLE = "org.eclipse.osbp.dialogs.acceptdelete.title";
+ public static final String ACCEPT_DELETE_DIALOG_MESSAGE = "org.eclipse.osbp.dialogs.acceptdelete.message";
+ public static final String ACCEPT_DELETE_DIALOG_ICON = "org.eclipse.osbp.dialogs.acceptdelete.image";
+ public static final String ACCEPT_DELETE_DIALOG_DESCRIPTION = "org.eclipse.osbp.dialogs.acceptdelete.description";
+
+ public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_CAPTION = "org.eclipse.osbp.dialogs.options.acceptdelete";
+ public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_DESCRIPTION = "org.eclipse.osbp.dialogs.options.acceptdelete.description";
+ public static final String ACCEPT_DELETE__DIALOG_OPTION__DELETE_ICON = "org.eclipse.osbp.dialogs.options.acceptdelete.image";
+
+ //
+ // reload if dirty
+ //
+ public static final String ACCEPT_RELOAD_DIALOG_TITLE = "org.eclipse.osbp.dialogs.acceptreload.title";
+ public static final String ACCEPT_RELOAD_DIALOG_MESSAGE = "org.eclipse.osbp.dialogs.acceptreload.message";
+ public static final String ACCEPT_RELOAD_DIALOG_ICON = "org.eclipse.osbp.dialogs.acceptreload.image";
+ public static final String ACCEPT_RELOAD_DIALOG_DESCRIPTION = "org.eclipse.osbp.dialogs.acceptreload.description";
+
+ public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_CAPTION = "org.eclipse.osbp.dialogs.options.acceptreload";
+ public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_DESCRIPTION = "org.eclipse.osbp.dialogs.options.acceptreload.description";
+ public static final String ACCEPT_RELOAD__DIALOG_OPTION__RELOAD_ICON = "org.eclipse.osbp.dialogs.options.acceptreload.image";
+
+ //
+ // loosing data for current action
+ //
+ public static final String ACCEPT_LOOSING_DATA_DIALOG_TITLE = "org.eclipse.osbp.dialogs.acceptloosingdata.title";
+ public static final String ACCEPT_LOOSING_DATA_DIALOG_MESSAGE = "org.eclipse.osbp.dialogs.acceptloosingdata.message";
+ public static final String ACCEPT_LOOSING_DATA_DIALOG_ICON = "org.eclipse.osbp.dialogs.acceptloosingdata.image";
+ public static final String ACCEPT_LOOSING_DATA_DIALOG_DESCRIPTION = "org.eclipse.osbp.dialogs.acceptloosingdata.description";
+
+ public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_CAPTION = "org.eclipse.osbp.dialogs.options.acceptloosingdata";
+ public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_DESCRIPTION = "org.eclipse.osbp.dialogs.options.acceptloosingdata.description";
+ public static final String ACCEPT_LOOSING_DATA__DIALOG_OPTION__DO_ICON = "org.eclipse.osbp.dialogs.options.acceptloosingdata.image";
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/OptionsDialog.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/OptionsDialog.java
new file mode 100644
index 0000000..19d856a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/dialogs/OptionsDialog.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.dialogs;
+
+public class OptionsDialog extends AbstractMessageDialog {
+
+ public static void showDialog(DialogConfig config, Option... options) {
+ OptionsDialog dialog = new OptionsDialog(config, options);
+ dialog.open();
+ }
+
+ protected OptionsDialog(DialogConfig config, Option... options) {
+ super(config, options);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java
new file mode 100644
index 0000000..28c783b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanReferenceField.java
@@ -0,0 +1,412 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.osbp.runtime.common.state.ISharedStateContext;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.BeanServiceLazyLoadingContainer;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.components.widget.LazyLoadingComboBox;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.Property;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.shared.ui.combobox.FilteringMode;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CustomField;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.TextField;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BeanReferenceField.
+ *
+ * @param <BEAN>
+ * the generic type
+ */
+@SuppressWarnings("serial")
+public class BeanReferenceField<BEAN> extends CustomField<BEAN> {
+
+ /** The property. */
+ private ObjectProperty<BEAN> property;
+
+ /** The search service. */
+ private IBeanSearchService<BEAN> searchService;
+
+ /** The type. */
+ private final Class<BEAN> type;
+
+ /** The combo box. */
+ private CustomComboBox comboBox;
+
+ /** The value binding. */
+ private Binding valueBinding;
+
+ /** The item caption property id. */
+ private Object itemCaptionPropertyId;
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /** The filter. */
+ private Filter filter;
+
+ /** The shared state. */
+ private ISharedStateContext sharedState;
+
+ /** The search button. */
+ private NativeButton searchButton;
+
+ /** The search button icon. */
+ private Resource searchButtonIcon;
+
+ /** The use search dialog. */
+ private boolean useSearchDialog = false;
+
+ private boolean nullSelectionAllowed = true;
+
+ /**
+ * Instantiates a new bean reference field.
+ *
+ * @param id
+ * the id
+ * @param propertyId
+ * the property id
+ * @param type
+ * the type
+ * @param searchService
+ * the search service
+ * @param filter
+ * the filter
+ * @param sharedState
+ * the shared state
+ */
+ public BeanReferenceField(String id, Object propertyId, Class<BEAN> type,
+ IBeanSearchService<BEAN> searchService, Filter filter,
+ ISharedStateContext sharedState) {
+ this.type = type;
+ this.searchService = searchService;
+ this.filter = filter;
+ this.sharedState = sharedState;
+
+ property = new ObjectProperty<BEAN>(null, type, false);
+ super.setPropertyDataSource(property);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.CustomField#initContent()
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected Component initContent() {
+
+ HorizontalLayout root = new HorizontalLayout();
+ root.addStyleName("l-beansearchfield");
+ comboBox = new CustomComboBox();
+ comboBox.setImmediate(true);
+ comboBox.setNullSelectionAllowed(isNullSelectionAllowed());
+ comboBox.setInvalidAllowed(false);
+
+ BeanServiceLazyLoadingContainer container = new BeanServiceLazyLoadingContainer(
+ searchService, type, sharedState);
+ // add the passed container filter
+ if (filter != null) {
+ container.addContainerFilter(filter);
+ }
+ comboBox.setContainerDataSource(container);
+ comboBox.setFilteringMode(FilteringMode.CONTAINS);
+
+ if (itemCaptionPropertyId != null) {
+ comboBox.setItemCaptionPropertyId(itemCaptionPropertyId);
+
+ container.sort(new Object[] { itemCaptionPropertyId },
+ new boolean[] { true });
+ }
+
+ if (itemIconPropertyId != null) {
+ comboBox.setItemIconPropertyId(itemIconPropertyId);
+ }
+
+ searchButton = new NativeButton();
+ searchButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ openSearchDialog();
+ }
+ });
+ searchButton.setWidth("26px");
+ if (searchButtonIcon != null) {
+ searchButton.setIcon(searchButtonIcon);
+ } else {
+ searchButton.setIcon(new ThemeResource("icons/SearchButton.png"));
+ }
+ searchButton.setVisible(useSearchDialog);
+
+ root.addComponent(comboBox);
+ root.addComponent(searchButton);
+
+ // Create the property
+ comboBox.setPropertyDataSource(property);
+
+ // Create the bindings
+ // valueBinding =
+ // dbc.bindValue(VaadinObservables.observeValue(comboBox),
+ // PojoObservables.observeValue(property, "value"));
+
+ return root;
+ }
+
+ /**
+ * If true, then null selections are allowed. False otherwise.
+ *
+ * @return
+ */
+ public boolean isNullSelectionAllowed() {
+ return nullSelectionAllowed;
+ }
+
+ /**
+ * True, if null selections should be allowed. False otherwise.
+ *
+ * @param nullSelectionAllowed
+ */
+ public void setNullSelectionAllowed(boolean nullSelectionAllowed) {
+ this.nullSelectionAllowed = nullSelectionAllowed;
+ }
+
+ /**
+ * If true, then the search dialog button is visible. False otherwise.
+ *
+ * @param useSearchDialog
+ * the new use dialog
+ */
+ public void setUseDialog(boolean useSearchDialog) {
+ this.useSearchDialog = useSearchDialog;
+ searchButton.setVisible(useSearchDialog);
+ }
+
+ /**
+ * Gets the internal combo box.
+ *
+ * @return the comboBox
+ */
+ public CustomComboBox getInternalComboBox() {
+ return comboBox;
+ }
+
+ /**
+ * Open search dialog.
+ */
+ protected void openSearchDialog() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#getType()
+ */
+ @Override
+ public Class<? extends BEAN> getType() {
+ return type;
+ }
+
+ /**
+ * See {@link TextField#setNullRepresentation(String)}.
+ *
+ * @param value
+ * the new null representation
+ */
+ public void setNullRepresentation(String value) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#getPropertyDataSource()
+ */
+ @Override
+ public Property<BEAN> getPropertyDataSource() {
+ return property;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.AbstractField#setPropertyDataSource(com.vaadin.data.Property
+ * )
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void setPropertyDataSource(Property newDataSource) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Sets the item caption property id.
+ *
+ * @param propertyId
+ * the new item caption property id
+ * @see com.vaadin.ui.AbstractSelect#setItemCaptionPropertyId(java.lang.Object)
+ */
+ public void setItemCaptionPropertyId(Object propertyId) {
+ this.itemCaptionPropertyId = propertyId;
+ if (comboBox != null) {
+ comboBox.setItemCaptionPropertyId(propertyId);
+ }
+ }
+
+ /**
+ * Sets the item icon property id.
+ *
+ * @param propertyId
+ * the new item icon property id
+ * @throws IllegalArgumentException
+ * the illegal argument exception
+ * @see com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+ this.itemIconPropertyId = propertyId;
+
+ if (comboBox != null) {
+ comboBox.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /**
+ * Dispose the field.
+ */
+ public void dispose() {
+ if (valueBinding != null) {
+ valueBinding.dispose();
+ valueBinding = null;
+ }
+ }
+
+ /**
+ * Sets the search button icon.
+ *
+ * @param resource
+ * the new search button icon
+ */
+ public void setSearchButtonIcon(Resource resource) {
+ if (searchButton != null) {
+ searchButton.setIcon(resource);
+ } else {
+ searchButtonIcon = resource;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#focus()
+ */
+ @Override
+ public void focus() {
+ if (comboBox != null) {
+ comboBox.focus();
+ }
+ }
+
+ /**
+ * The Class CustomComboBox.
+ */
+ private static class CustomComboBox extends LazyLoadingComboBox {
+
+ /** The item icon property id. */
+ private Object itemIconPropertyId;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object)
+ */
+ @Override
+ public void setItemIconPropertyId(Object propertyId)
+ throws IllegalArgumentException {
+
+ if (propertyId == null) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (!getContainerPropertyIds().contains(propertyId)) {
+ super.setItemIconPropertyId(propertyId);
+ } else if (String.class.isAssignableFrom(getType(propertyId))) {
+ itemIconPropertyId = propertyId;
+ } else {
+ super.setItemIconPropertyId(propertyId);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId()
+ */
+ public Object getItemIconPropertyId() {
+ return itemIconPropertyId != null ? itemIconPropertyId : super
+ .getItemIconPropertyId();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object)
+ */
+ public Resource getItemIcon(Object itemId) {
+ if (itemIconPropertyId == null) {
+ return super.getItemIcon(itemId);
+ } else {
+ final Property<?> ip = getContainerProperty(itemId,
+ getItemIconPropertyId());
+ if (ip == null) {
+ return null;
+ }
+ final Object icon = ip.getValue();
+ if (icon instanceof String) {
+ return new ThemeResource((String) icon);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractSelect#setValue(java.lang.Object)
+ */
+ @Override
+ public void setValue(Object newValue)
+ throws com.vaadin.data.Property.ReadOnlyException {
+ super.setValue(newValue);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.ui.AbstractField#setValue(java.lang.Object, boolean)
+ */
+ @Override
+ protected void setValue(Object newValue, boolean repaintIsNotNeeded)
+ throws com.vaadin.data.Property.ReadOnlyException {
+ super.setValue(newValue, repaintIsNotNeeded);
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanSearchServiceFactory.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanSearchServiceFactory.java
new file mode 100644
index 0000000..870f19f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/BeanSearchServiceFactory.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactory;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchServiceFactoryDelegate;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.StatefulInMemoryBeanSearchService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+
+@Component(immediate = true, enabled = true)
+public class BeanSearchServiceFactory implements IBeanSearchServiceFactory {
+
+ private List<IBeanSearchServiceFactoryDelegate> delegates = Collections
+ .synchronizedList(new ArrayList<IBeanSearchServiceFactoryDelegate>());
+
+ @Override
+ public <BEAN> IBeanSearchService<BEAN> createService(Class<BEAN> bean) {
+
+ synchronized (delegates) {
+ for (IBeanSearchServiceFactoryDelegate delegate : delegates) {
+ IBeanSearchService<BEAN> service = delegate.createService(bean);
+ if (service != null) {
+ return service;
+ }
+ }
+ }
+
+ return new StatefulInMemoryBeanSearchService<BEAN>(bean);
+ }
+
+ @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeDelegate")
+ protected void addDelegate(IBeanSearchServiceFactoryDelegate delegate) {
+ if (!delegates.contains(delegate)) {
+ delegates.add(delegate);
+ }
+ }
+
+ protected void removeDelegate(IBeanSearchServiceFactoryDelegate delegate) {
+ delegates.remove(delegate);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/DecimalField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/DecimalField.java
new file mode 100644
index 0000000..edc57ce
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/DecimalField.java
@@ -0,0 +1,229 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ * Hans Georg Glöckler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import java.text.DecimalFormatSymbols;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+
+import com.vaadin.data.util.converter.Converter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A decimalfield specific for redvoodo.
+ */
+@SuppressWarnings("serial")
+public class DecimalField extends TextField {
+
+ /** The Constant NEGATIVE_VALUE. */
+ private static final String NEGATIVE_VALUE = "lun-negative-value";
+
+ /** The converter. */
+ private DecimalConverter converter;
+
+ /** The mark negative. */
+ private boolean markNegative;
+
+ /**
+ * Instantiates a new decimal field.
+ */
+ public DecimalField() {
+ this(null);
+ }
+
+ /**
+ * Instantiates a new decimal field.
+ *
+ * @param caption
+ * the caption
+ */
+ public DecimalField(String caption) {
+ this(caption, null);
+ }
+
+ /**
+ * Instantiates a new decimal field.
+ *
+ * @param caption
+ * the caption
+ * @param converter
+ * the converter
+ */
+ public DecimalField(String caption, DecimalConverter converter) {
+ super(caption);
+
+ setNullRepresentation("");
+ setNullSettingAllowed(false);
+
+ // Important: Is responsible that the Converter is used in the Field
+ setConverter(converter);
+ }
+
+ /**
+ * Sets the converter.
+ *
+ * @param converter
+ * the new converter
+ */
+ public void setConverter(DecimalConverter converter) {
+ this.converter = converter != null ? converter : createConverter();
+ super.setConverter(this.converter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#setConverter(com.vaadin.data.util.converter.Converter)
+ */
+ @Override
+ public void setConverter(Converter<String, ?> converter) {
+ if (converter instanceof DecimalConverter || converter == null) {
+ setConverter((DecimalConverter) converter);
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Creates a default converter.
+ *
+ * @return the decimal converter
+ */
+ protected DecimalConverter createConverter() {
+ return new DecimalConverter();
+ }
+
+ /**
+ * Sets the Symbols which are used to Format.
+ *
+ * @param decimalFormatSymbols
+ * the new decimal format symbols
+ */
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ converter.setDecimalFormatSymbols(decimalFormatSymbols);
+
+ markAsDirty();
+ }
+
+ /**
+ * Returns the currently used decimal format symbols.
+ *
+ * @return the decimal format symbols
+ */
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return converter.getDecimalFormatSymbols();
+ }
+
+ /**
+ * Returns true, if grouping is used. False otherwise.
+ *
+ * @return true, if is use grouping
+ */
+ public boolean isUseGrouping() {
+ return converter.isUseGrouping();
+ }
+
+ /**
+ * Set true, if grouping should be used. False otherwise.
+ *
+ * @param useGrouping
+ * the new use grouping
+ */
+ public void setUseGrouping(boolean useGrouping) {
+ converter.setUseGrouping(useGrouping);
+
+ markAsDirty();
+ }
+
+ /**
+ * Returns the precision of that decimal field.
+ *
+ * @return the precision
+ */
+ public int getPrecision() {
+ return converter.getPrecision();
+ }
+
+ /**
+ * Sets the precision of that decimal field.
+ *
+ * @param precision
+ * the new precision
+ */
+ public void setPrecision(int precision) {
+ converter.setPrecision(precision);
+
+ markAsDirty();
+ }
+
+ /**
+ * True, if negative values should become marked.
+ *
+ * @param markNegative
+ * the new mark negative
+ */
+ public void setMarkNegative(boolean markNegative) {
+ this.markNegative = markNegative;
+
+ handleNegative();
+ }
+
+ /**
+ * Returns true, if negative values should become marked.
+ *
+ * @return true, if is mark negative
+ */
+ public boolean isMarkNegative() {
+ return markNegative;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractTextField#setInternalValue(java.lang.String)
+ */
+ protected void setInternalValue(String newValue) {
+ super.setInternalValue(newValue);
+
+ handleNegative();
+ }
+
+ /**
+ * Is called to handle the negative marker.
+ */
+ protected void handleNegative() {
+ removeStyleName(NEGATIVE_VALUE);
+
+ if (!isMarkNegative()) {
+ return;
+ }
+
+ // try to find out if value is negative
+ if (getPropertyDataSource() == null || isBuffered() || isModified()) {
+ String value = getInternalValue();
+ try {
+ double result = converter.convertToModel(value, Double.class,
+ getLocale());
+ if (result < 0) {
+ addStyleName(NEGATIVE_VALUE);
+ }
+ } catch (Exception e) {
+ // nothing to do
+ }
+ } else {
+ Object value = getPropertyDataSource().getValue();
+ if (value != null) {
+ double result = (Double) value;
+ if (result < 0) {
+ addStyleName(NEGATIVE_VALUE);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/NumericField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/NumericField.java
new file mode 100644
index 0000000..e5dfccd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/NumericField.java
@@ -0,0 +1,209 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ * Hans Georg Glöckler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import java.text.DecimalFormatSymbols;
+
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.NumberConverter;
+
+import com.vaadin.data.util.converter.Converter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A numericfield specific for redvoodo.
+ */
+@SuppressWarnings("serial")
+public class NumericField extends TextField {
+
+ /** The Constant NEGATIVE_VALUE. */
+ private static final String NEGATIVE_VALUE = "lun-negative-value";
+
+ /** The converter. */
+ private NumberConverter converter;
+
+ /** The mark negative. */
+ private boolean markNegative;
+
+ /**
+ * Instantiates a new numeric field.
+ */
+ public NumericField() {
+ this(null);
+ }
+
+ /**
+ * Instantiates a new numeric field.
+ *
+ * @param caption
+ * the caption
+ */
+ public NumericField(String caption) {
+ this(caption, null);
+ }
+
+ /**
+ * Instantiates a new numeric field.
+ *
+ * @param caption
+ * the caption
+ * @param converter
+ * the converter
+ */
+ public NumericField(String caption, NumberConverter converter) {
+ super(caption);
+
+ setNullRepresentation("");
+ setNullSettingAllowed(false);
+
+ // Important: Is responsible that the Converter is used in the Field
+ setConverter(converter);
+ }
+
+ /**
+ * Sets the converter.
+ *
+ * @param converter
+ * the new converter
+ */
+ public void setConverter(NumberConverter converter) {
+ this.converter = converter != null ? converter : createConverter();
+ super.setConverter(this.converter);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#setConverter(com.vaadin.data.util.converter.Converter)
+ */
+ @Override
+ public void setConverter(Converter<String, ?> converter) {
+ if (converter instanceof NumberConverter || converter == null) {
+ setConverter((NumberConverter) converter);
+ } else {
+ // LOGGER.
+ // throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Creates a default converter.
+ *
+ * @return the number converter
+ */
+ protected NumberConverter createConverter() {
+ return new NumberConverter();
+ }
+
+ /**
+ * Sets the Symbols which are used to Format.
+ *
+ * @param decimalFormatSymbols
+ * the new decimal format symbols
+ */
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ converter.setDecimalFormatSymbols(decimalFormatSymbols);
+
+ markAsDirty();
+ }
+
+ /**
+ * Returns the currently used decimal format symbols.
+ *
+ * @return the decimal format symbols
+ */
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return converter.getDecimalFormatSymbols();
+ }
+
+ /**
+ * Returns true, if grouping is used. False otherwise.
+ *
+ * @return true, if is use grouping
+ */
+ public boolean isUseGrouping() {
+ return converter.isUseGrouping();
+ }
+
+ /**
+ * Set true, if grouping should be used. False otherwise.
+ *
+ * @param useGrouping
+ * the new use grouping
+ */
+ public void setUseGrouping(boolean useGrouping) {
+ converter.setUseGrouping(useGrouping);
+
+ markAsDirty();
+ }
+
+ /**
+ * True, if negative values should become marked.
+ *
+ * @param markNegative
+ * the new mark negative
+ */
+ public void setMarkNegative(boolean markNegative) {
+ this.markNegative = markNegative;
+
+ handleNegative();
+ }
+
+ /**
+ * Returns true, if negative values should become marked.
+ *
+ * @return true, if is mark negative
+ */
+ public boolean isMarkNegative() {
+ return markNegative;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractTextField#setInternalValue(java.lang.String)
+ */
+ protected void setInternalValue(String newValue) {
+ super.setInternalValue(newValue);
+
+ handleNegative();
+ }
+
+ /**
+ * Is called to handle the negative marker.
+ */
+ protected void handleNegative() {
+ removeStyleName(NEGATIVE_VALUE);
+
+ if (!isMarkNegative()) {
+ return;
+ }
+
+ // try to find out if value is negative
+ if (getPropertyDataSource() == null || isBuffered() || isModified()) {
+ String value = getInternalValue();
+ try {
+ Long result = (Long) converter.convertToModel(value,
+ Long.class, getLocale());
+ if (result < 0) {
+ addStyleName(NEGATIVE_VALUE);
+ }
+ } catch (Exception e) {
+ // nothing to do
+ }
+ } else {
+ Object value = getPropertyDataSource().getValue();
+ if (value != null) {
+ long result = ((Number) value).longValue();
+ if (result < 0) {
+ addStyleName(NEGATIVE_VALUE);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/TextField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/TextField.java
new file mode 100644
index 0000000..bf3c6f3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/TextField.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ * Hans Georg Glöckler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields;
+
+import com.vaadin.data.Property;
+
+/**
+ * A textfield specific for redvoodo.
+ */
+@SuppressWarnings("serial")
+public class TextField extends com.vaadin.ui.TextField {
+
+ public TextField() {
+ super();
+ }
+
+ public TextField(Property<String> dataSource) {
+ super(dataSource);
+ }
+
+ public TextField(String caption, Property<String> dataSource) {
+ super(caption, dataSource);
+ }
+
+ public TextField(String caption, String value) {
+ super(caption, value);
+ }
+
+ public TextField(String caption) {
+ super(caption);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/BooleanSearchField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/BooleanSearchField.java
new file mode 100644
index 0000000..52468d3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/BooleanSearchField.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.BooleanFilterProperty;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.BooleanFilterProperty.OptionBean;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.IFilterProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+
+@SuppressWarnings("serial")
+public class BooleanSearchField extends
+ SearchField<BooleanFilterProperty.OptionBean> {
+
+ private Binding selectionBinding;
+ private Binding collectionBinding;
+ private BooleanFilterProperty filterProperty;
+
+ public BooleanSearchField(String id, Object propertyId,
+ DataBindingContext dbContext) {
+ super(id, propertyId, dbContext);
+
+ filterProperty = new BooleanFilterProperty(getPropertyId(), getLocale());
+ }
+
+ @Override
+ protected Component initContent() {
+
+ ComboBox combo = new ComboBox();
+ combo.setImmediate(true);
+ combo.setNullSelectionAllowed(false);
+ combo.setItemCaptionPropertyId("description");
+
+ // Create the container
+ BeanItemContainer<BooleanFilterProperty.OptionBean> container = new BeanItemContainer<BooleanFilterProperty.OptionBean>(
+ BooleanFilterProperty.OptionBean.class);
+ container.addAll(filterProperty.getOptions());
+ combo.setContainerDataSource(container);
+
+ // Create the property
+ ObjectProperty<BooleanFilterProperty.OptionBean> property = new ObjectProperty<BooleanFilterProperty.OptionBean>(
+ filterProperty.getDefaultOption(),
+ BooleanFilterProperty.OptionBean.class, false);
+ combo.setPropertyDataSource(property);
+
+ // Create the bindings
+ DataBindingContext dbContext = getDbContext();
+ selectionBinding = dbContext.bindValue(VaadinObservables
+ .observeValue(combo), PojoObservables.observeValue(
+ filterProperty, IFilterProperty.PROP_SELECTION));
+ collectionBinding = dbContext.bindList(VaadinObservables
+ .observeContainerItemSetContents(combo, OptionBean.class),
+ PojoObservables.observeList(filterProperty,
+ IFilterProperty.PROP_OPTIONS));
+
+ return combo;
+ }
+
+ @Override
+ public Class<? extends BooleanFilterProperty.OptionBean> getType() {
+ return BooleanFilterProperty.OptionBean.class;
+ }
+
+ @Override
+ public Filter getFilter() {
+ return filterProperty.getFilter();
+ }
+
+ public void bindFilterChanged(IObservableValue targetObservableValue) {
+ Binding binding = getDbContext().bindValue(targetObservableValue,
+ BeanProperties.value("filter").observe(filterProperty),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ filterBindings.add(binding);
+ }
+
+ /**
+ * Dispose the field.
+ */
+ public void dispose() {
+
+ filterProperty = null;
+
+ if (selectionBinding != null) {
+ selectionBinding.dispose();
+ selectionBinding = null;
+ }
+
+ if (collectionBinding != null) {
+ collectionBinding.dispose();
+ collectionBinding = null;
+ }
+
+ // dispose the bindings
+ for (Binding b : filterBindings) {
+ b.dispose();
+ }
+ filterBindings.clear();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/EntityTextSearchField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/EntityTextSearchField.java
new file mode 100644
index 0000000..14ef2d5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/EntityTextSearchField.java
@@ -0,0 +1,179 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+
+import java.util.List;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanSearchService;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.IFilterProperty;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.TextFilterProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.event.FieldEvents;
+import com.vaadin.event.FieldEvents.TextChangeEvent;
+import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TextField;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class EntityTextSearchField.
+ *
+ * @param <BEAN>
+ * the generic type
+ */
+@SuppressWarnings("serial")
+public class EntityTextSearchField<BEAN> extends SearchField<Object> {
+
+ /** The value binding. */
+ private Binding valueBinding;
+
+ /** The filter property. */
+ private TextFilterProperty filterProperty;
+
+ /** The search service. */
+ @SuppressWarnings("unused")
+ private IBeanSearchService<BEAN> searchService;
+
+ /**
+ * Instantiates a new entity text search field.
+ *
+ * @param id
+ * the id
+ * @param propertyId
+ * the property id
+ * @param dbContext
+ * the db context
+ */
+ public EntityTextSearchField(String id, Object propertyId,
+ DataBindingContext dbContext) {
+ super(id, propertyId, dbContext);
+
+ filterProperty = new TextFilterProperty(getPropertyId(), getLocale());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#bindFilterChanged(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ public void bindFilterChanged(IObservableValue targetObservableValue) {
+ Binding binding = getDbContext().bindValue(targetObservableValue,
+ BeanProperties.value("filter").observe(filterProperty),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ filterBindings.add(binding);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.CustomField#initContent()
+ */
+ @Override
+ protected Component initContent() {
+
+ HorizontalLayout root = new HorizontalLayout();
+ TextField textField = new TextField();
+ textField.setImmediate(true);
+ textField.setNullRepresentation("");
+ textField.setInvalidAllowed(false);
+ textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
+ textField.setTextChangeTimeout(250);
+ textField.addTextChangeListener(new FieldEvents.TextChangeListener() {
+ @Override
+ public void textChange(TextChangeEvent event) {
+ // List<BEAN> proposal =
+ // searchService.findProposal(event.getText());
+ // updateProposal(proposal);
+ }
+ });
+
+ Button searchButton = new Button();
+
+ root.addComponent(textField);
+ root.addComponent(searchButton);
+
+ // Create the property
+ ObjectProperty<Object> property = new ObjectProperty<Object>("",
+ Object.class, false);
+ textField.setPropertyDataSource(property);
+
+ // Create the bindings
+ DataBindingContext dbContext = getDbContext();
+ valueBinding = dbContext.bindValue(VaadinObservables
+ .observeValue(textField), PojoObservables.observeValue(
+ filterProperty, IFilterProperty.PROP_FILTER_VALUE));
+
+ return root;
+ }
+
+ /**
+ * Update proposal.
+ *
+ * @param proposal
+ * the proposal
+ */
+ protected void updateProposal(List<BEAN> proposal) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getType()
+ */
+ @Override
+ public Class<? extends String> getType() {
+ return String.class;
+ }
+
+ /**
+ * See {@link TextField#setNullRepresentation(String)}.
+ *
+ * @param value
+ * the new null representation
+ */
+ public void setNullRepresentation(String value) {
+ ((TextField) getContent()).setNullRepresentation(value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#getFilter()
+ */
+ @Override
+ public Filter getFilter() {
+ return filterProperty.getFilter();
+ }
+
+ /**
+ * Dispose the field.
+ */
+ public void dispose() {
+
+ filterProperty = null;
+
+ if (valueBinding != null) {
+ valueBinding.dispose();
+ valueBinding = null;
+ }
+
+ // dispose the bindings
+ for (Binding b : filterBindings) {
+ b.dispose();
+ }
+ filterBindings.clear();
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/ISearchField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/ISearchField.java
new file mode 100644
index 0000000..106d30c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/ISearchField.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+
+import com.vaadin.data.Container.Filter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface ISearchField.
+ */
+public interface ISearchField {
+
+ /**
+ * Returns the vaadin filter for the property.
+ *
+ * @return the filter
+ */
+ Filter getFilter();
+
+ /**
+ * This observable value will be updated, if a new filter is available.
+ *
+ * @param targetObservableValue
+ * the target observable value
+ */
+ void bindFilterChanged(IObservableValue targetObservableValue);
+
+ /**
+ * Gets the id.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Gets the property id.
+ *
+ * @return the propertyId
+ */
+ Object getPropertyId();
+
+ /**
+ * Dispose the field.
+ */
+ void dispose();
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/NumericSearchField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/NumericSearchField.java
new file mode 100644
index 0000000..1335522
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/NumericSearchField.java
@@ -0,0 +1,343 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ * Hans Georg Glöckler - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+
+import java.text.DecimalFormatSymbols;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.NumericFilterProperty;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.converter.Converter;
+import com.vaadin.ui.TextField;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class NumericSearchField.
+ */
+@SuppressWarnings("serial")
+public class NumericSearchField extends TextField implements ISearchField {
+
+ /** The Constant NEGATIVE_VALUE. */
+ private static final String NEGATIVE_VALUE = "lun-negative-value";
+
+ /** The converter. */
+ private final StringToPropertyConverter converter;
+
+ /** The mark negative. */
+ private boolean markNegative;
+
+ /** The id. */
+ @SuppressWarnings("unused")
+ private String id;
+
+ /** The property id. */
+ private Object propertyId;
+
+ /** The type. */
+ private Class<? extends Number> type;
+
+ /** The property. */
+ private NumericFilterProperty property;
+
+ /** The dbc. */
+ private DataBindingContext dbc;
+
+ /** The filter bindings. */
+ protected Set<Binding> filterBindings = new HashSet<Binding>();
+
+ /**
+ * Instantiates a new numeric search field.
+ *
+ * @param id
+ * the id
+ * @param propertyId
+ * the property id
+ * @param type
+ * the type
+ * @param dbc
+ * the dbc
+ */
+ public NumericSearchField(String id, Object propertyId,
+ Class<? extends Number> type, DataBindingContext dbc) {
+ this.id = id;
+ this.propertyId = propertyId;
+ this.type = type;
+ this.dbc = dbc;
+
+ setNullRepresentation("");
+ setNullSettingAllowed(false);
+ setImmediate(true);
+
+ markNegative = true;
+ // Important: Is responsible that the Converter is used in the Field
+ this.converter = createConverter();
+ setConverter(this.converter);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#bindFilterChanged(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ public void bindFilterChanged(IObservableValue targetObservableValue) {
+ Binding binding = dbc.bindValue(targetObservableValue, BeanProperties
+ .value("filter").observe(property), new UpdateValueStrategy(
+ UpdateValueStrategy.POLICY_NEVER), new UpdateValueStrategy(
+ UpdateValueStrategy.POLICY_UPDATE));
+ filterBindings.add(binding);
+ }
+
+ /**
+ * Creates a default converter.
+ *
+ * @return the string to property converter
+ */
+ protected StringToPropertyConverter createConverter() {
+ this.property = new NumericFilterProperty(type, propertyId, getLocale());
+ return new StringToPropertyConverter(propertyId, getLocale(), property);
+ }
+
+ /**
+ * Sets the Symbols which are used to Format.
+ *
+ * @param decimalFormatSymbols
+ * the new decimal format symbols
+ */
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ converter.setDecimalFormatSymbols(decimalFormatSymbols);
+
+ markAsDirty();
+ }
+
+ /**
+ * Returns the currently used decimal format symbols.
+ *
+ * @return the decimal format symbols
+ */
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return converter.getDecimalFormatSymbols();
+ }
+
+ /**
+ * Returns true, if grouping is used. False otherwise.
+ *
+ * @return true, if is use grouping
+ */
+ public boolean isUseGrouping() {
+ return converter.isUseGrouping();
+ }
+
+ /**
+ * Set true, if grouping should be used. False otherwise.
+ *
+ * @param useGrouping
+ * the new use grouping
+ */
+ public void setUseGrouping(boolean useGrouping) {
+ converter.setUseGrouping(useGrouping);
+
+ markAsDirty();
+ }
+
+ /**
+ * True, if negative values should become marked.
+ *
+ * @param markNegative
+ * the new mark negative
+ */
+ public void setMarkNegative(boolean markNegative) {
+ this.markNegative = markNegative;
+
+ handleNegative();
+ }
+
+ /**
+ * Returns true, if negative values should become marked.
+ *
+ * @return true, if is mark negative
+ */
+ public boolean isMarkNegative() {
+ return markNegative;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractTextField#setInternalValue(java.lang.String)
+ */
+ protected void setInternalValue(String newValue) {
+ super.setInternalValue(newValue);
+
+ handleNegative();
+ }
+
+ /**
+ * Is called to handle the negative marker.
+ */
+ protected void handleNegative() {
+ removeStyleName(NEGATIVE_VALUE);
+
+ if (!isMarkNegative()) {
+ return;
+ }
+
+ if (property.getNumber() != null && property.getNumber().intValue() < 0) {
+ addStyleName(NEGATIVE_VALUE);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#setLocale(java.util.Locale)
+ */
+ public void setLocale(Locale locale) {
+ super.setLocale(locale);
+
+ property.setLocale(locale);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#getFilter()
+ */
+ public Filter getFilter() {
+ return property.getFilter();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#getPropertyId()
+ */
+ @Override
+ public Object getPropertyId() {
+ return propertyId;
+ }
+
+ /**
+ * Dispose the field.
+ */
+ public void dispose() {
+ // dispose the bindings
+ for (Binding b : filterBindings) {
+ b.dispose();
+ }
+ filterBindings.clear();
+ }
+
+ /**
+ * The Class StringToPropertyConverter.
+ */
+ public static class StringToPropertyConverter implements
+ Converter<String, NumericFilterProperty> {
+
+ /** The property. */
+ private final NumericFilterProperty property;
+
+ /**
+ * Instantiates a new string to property converter.
+ *
+ * @param propertyId
+ * the property id
+ * @param locale
+ * the locale
+ * @param property
+ * the property
+ */
+ public StringToPropertyConverter(Object propertyId, Locale locale,
+ NumericFilterProperty property) {
+ this.property = property;
+ }
+
+ /**
+ * Sets the use grouping.
+ *
+ * @param useGrouping
+ * the new use grouping
+ */
+ public void setUseGrouping(boolean useGrouping) {
+ property.setUseGrouping(useGrouping);
+ }
+
+ /**
+ * Checks if is use grouping.
+ *
+ * @return true, if is use grouping
+ */
+ public boolean isUseGrouping() {
+ return property.isUseGrouping();
+ }
+
+ /**
+ * Gets the decimal format symbols.
+ *
+ * @return the decimal format symbols
+ */
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return property.getDecimalFormatSymbols();
+ }
+
+ /**
+ * Sets the decimal format symbols.
+ *
+ * @param decimalFormatSymbols
+ * the new decimal format symbols
+ */
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ property.setDecimalFormatSymbols(decimalFormatSymbols);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object, java.lang.Class, java.util.Locale)
+ */
+ @Override
+ public NumericFilterProperty convertToModel(String value,
+ Class<? extends NumericFilterProperty> targetType, Locale locale)
+ throws ConversionException {
+ property.setStringValue(value);
+ return property;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.converter.Converter#getModelType()
+ */
+ @Override
+ public Class<NumericFilterProperty> getModelType() {
+ return NumericFilterProperty.class;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang.Object, java.lang.Class, java.util.Locale)
+ */
+ @Override
+ public String convertToPresentation(NumericFilterProperty value,
+ Class<? extends String> targetType, Locale locale)
+ throws ConversionException {
+ if (value == null) {
+ return null;
+ }
+
+ return value.getStringValue();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.util.converter.Converter#getPresentationType()
+ */
+ @Override
+ public Class<String> getPresentationType() {
+ return String.class;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/SearchField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/SearchField.java
new file mode 100644
index 0000000..5dc3cbd
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/SearchField.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.ui.CustomField;
+
+@SuppressWarnings("serial")
+public abstract class SearchField<C> extends CustomField<C> implements ISearchField {
+
+ private final String id;
+ private final Object propertyId;
+ private DataBindingContext dbContext;
+
+ protected Set<Binding> filterBindings = new HashSet<Binding>();
+
+ public SearchField(String id, Object propertyId,
+ DataBindingContext dbContext) {
+ this.id = id;
+ this.propertyId = propertyId;
+ this.dbContext = dbContext;
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public Object getPropertyId() {
+ return propertyId;
+ }
+
+ /**
+ * @return the dbContext
+ */
+ public DataBindingContext getDbContext() {
+ return dbContext;
+ }
+
+ /**
+ * @param dbContext
+ * the dbContext to set
+ */
+ public void setDbContext(DataBindingContext dbContext) {
+ this.dbContext = dbContext;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/TextSearchField.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/TextSearchField.java
new file mode 100644
index 0000000..342ae23
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/TextSearchField.java
@@ -0,0 +1,137 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.IFilterProperty;
+import org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.TextFilterProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.TextField;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class TextSearchField.
+ */
+@SuppressWarnings("serial")
+public class TextSearchField extends SearchField<String> {
+
+ /** The value binding. */
+ private Binding valueBinding;
+
+ /** The filter property. */
+ private TextFilterProperty filterProperty;
+
+ /**
+ * Instantiates a new text search field.
+ *
+ * @param id
+ * the id
+ * @param propertyId
+ * the property id
+ * @param dbContext
+ * the db context
+ */
+ public TextSearchField(String id, Object propertyId,
+ DataBindingContext dbContext) {
+ super(id, propertyId, dbContext);
+
+ filterProperty = new TextFilterProperty(getPropertyId(), getLocale());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#bindFilterChanged(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ public void bindFilterChanged(IObservableValue targetObservableValue) {
+ Binding binding = getDbContext().bindValue(targetObservableValue,
+ BeanProperties.value("filter").observe(filterProperty),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
+ filterBindings.add(binding);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.CustomField#initContent()
+ */
+ @Override
+ protected Component initContent() {
+
+ TextField textField = new TextField();
+ textField.setImmediate(true);
+ textField.setNullRepresentation("");
+ textField.setInvalidAllowed(false);
+ // Create the property
+ ObjectProperty<String> property = new ObjectProperty<String>("",
+ String.class, false);
+ textField.setPropertyDataSource(property);
+
+ // Create the bindings
+ DataBindingContext dbContext = getDbContext();
+ valueBinding = dbContext.bindValue(VaadinObservables
+ .observeValue(textField), PojoObservables.observeValue(
+ filterProperty, IFilterProperty.PROP_FILTER_VALUE));
+
+ return textField;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.AbstractField#getType()
+ */
+ @Override
+ public Class<? extends String> getType() {
+ return String.class;
+ }
+
+ /**
+ * See {@link TextField#setNullRepresentation(String)}.
+ *
+ * @param value
+ * the new null representation
+ */
+ public void setNullRepresentation(String value) {
+ ((TextField) getContent()).setNullRepresentation(value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.ISearchField#getFilter()
+ */
+ @Override
+ public Filter getFilter() {
+ return filterProperty.getFilter();
+ }
+
+ /**
+ * Dispose the field.
+ */
+ public void dispose() {
+
+ filterProperty = null;
+
+ if (valueBinding != null) {
+ valueBinding.dispose();
+ valueBinding = null;
+ }
+
+ // dispose the bindings
+ for (Binding b : filterBindings) {
+ b.dispose();
+ }
+ filterBindings.clear();
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/BooleanFilterProperty.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/BooleanFilterProperty.java
new file mode 100644
index 0000000..af700f8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/BooleanFilterProperty.java
@@ -0,0 +1,200 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.web.vaadin.common.data.filter.Filters;
+
+import com.vaadin.data.Container.Filter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class BooleanFilterProperty.
+ */
+public class BooleanFilterProperty extends FilterProperty {
+
+ /** The selection. */
+ private OptionBean selection;
+
+ /** The options. */
+ private List<OptionBean> options;
+
+ /** The default option. */
+ private OptionBean defaultOption;
+
+ /** The filter provider. */
+ private Filters filterProvider = new Filters();
+
+ /**
+ * Instantiates a new boolean filter property.
+ *
+ * @param propertyId
+ * the property id
+ * @param locale
+ * the locale
+ */
+ public BooleanFilterProperty(Object propertyId, Locale locale) {
+ super(propertyId, locale);
+ }
+
+ /**
+ * Gets the selection.
+ *
+ * @return the selection
+ */
+ public OptionBean getSelection() {
+ return selection;
+ }
+
+ /**
+ * Sets the selection.
+ *
+ * @param selection
+ * the selection to set
+ */
+ public void setSelection(OptionBean selection) {
+ this.selection = selection;
+
+ notifyFilterChanged();
+ }
+
+ /**
+ * Returns all available options.
+ *
+ * @return the options
+ */
+ public List<OptionBean> getOptions() {
+ if (options == null) {
+ options = new ArrayList<BooleanFilterProperty.OptionBean>();
+ options.add(new OptionBean(Option.TRUE, getOptionsName(Option.TRUE,
+ getLocale())));
+ options.add(new OptionBean(Option.FALSE, getOptionsName(
+ Option.FALSE, getLocale())));
+ defaultOption = new OptionBean(Option.IGNORE, getOptionsName(
+ Option.IGNORE, getLocale()));
+ options.add(defaultOption);
+ }
+ return Collections.unmodifiableList(options);
+ }
+
+ /**
+ * Gets the options name.
+ *
+ * @param option
+ * the option
+ * @param locale
+ * the locale
+ * @return the options name
+ */
+ private static String getOptionsName(Option option, Locale locale) {
+ switch (option) {
+ case TRUE:
+ return "true";
+ case FALSE:
+ return "false";
+ case IGNORE:
+ default:
+ return "ignore";
+ }
+ }
+
+ /**
+ * Returns the default selection.
+ *
+ * @return the default option
+ */
+ public OptionBean getDefaultOption() {
+ return defaultOption;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.IFilterProperty#getFilter()
+ */
+ @Override
+ public Filter getFilter() {
+ if (filterProvider == null || selection == null) {
+ return null;
+ }
+ switch (selection.getOption()) {
+ case FALSE:
+ return filterProvider.eq(getPropertyId(), Boolean.FALSE);
+ case TRUE:
+ return filterProvider.eq(getPropertyId(), Boolean.TRUE);
+ case IGNORE:
+ return null;
+ }
+
+ throw new IllegalStateException("Not a valid state!");
+ }
+
+ /**
+ * The Enum Option.
+ */
+ public static enum Option {
+
+ /** The true. */
+ TRUE,
+ /** The false. */
+ FALSE,
+ /** The ignore. */
+ IGNORE;
+ }
+
+ /**
+ * The Class OptionBean.
+ */
+ public static class OptionBean {
+
+ /** The option. */
+ private final Option option;
+
+ /** The description. */
+ private final String description;
+
+ /**
+ * Instantiates a new option bean.
+ *
+ * @param option
+ * the option
+ * @param description
+ * the description
+ */
+ public OptionBean(Option option, String description) {
+ super();
+ this.option = option;
+ this.description = description;
+ }
+
+ /**
+ * Gets the option.
+ *
+ * @return the option
+ */
+ public Option getOption() {
+ return option;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/FilterProperty.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/FilterProperty.java
new file mode 100644
index 0000000..212123f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/FilterProperty.java
@@ -0,0 +1,144 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.Locale;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class FilterProperty.
+ */
+public abstract class FilterProperty implements IFilterProperty {
+
+ /** The property change support. */
+ protected PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(
+ this);
+
+ /** The property id. */
+ private Object propertyId;
+
+ /** The locale. */
+ private Locale locale;
+
+ /** The old filter. */
+ private Object oldFilter;
+
+ /**
+ * Instantiates a new filter property.
+ *
+ * @param propertyId
+ * the property id
+ * @param locale
+ * the locale
+ */
+ public FilterProperty(Object propertyId, Locale locale) {
+ this.propertyId = propertyId;
+ this.locale = locale;
+ }
+
+ /**
+ * Adds the property change listener.
+ *
+ * @param listener
+ * the listener
+ * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Adds the property change listener.
+ *
+ * @param propertyName
+ * the property name
+ * @param listener
+ * the listener
+ * @see PropertyChangeSupport#addPropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void addPropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Removes the property change listener.
+ *
+ * @param listener
+ * the listener
+ * @see PropertyChangeSupport#removePropertyChangeListener(PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes the property change listener.
+ *
+ * @param propertyName
+ * the property name
+ * @param listener
+ * the listener
+ * @see PropertyChangeSupport#removePropertyChangeListener(String,
+ * PropertyChangeListener)
+ */
+ public void removePropertyChangeListener(final String propertyName,
+ final PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName,
+ listener);
+ }
+
+ /**
+ * Fire property change.
+ *
+ * @param propertyName
+ * the property name
+ * @param oldValue
+ * the old value
+ * @param newValue
+ * the new value
+ * @see PropertyChangeSupport#firePropertyChange(String, Object, Object)
+ */
+ public void firePropertyChange(final String propertyName,
+ final Object oldValue, final Object newValue) {
+ propertyChangeSupport.firePropertyChange(propertyName, oldValue,
+ newValue);
+ }
+
+ /**
+ * Gets the locale.
+ *
+ * @return the locale
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter.IFilterProperty#getPropertyId()
+ */
+ @Override
+ public Object getPropertyId() {
+ return propertyId;
+ }
+
+ /**
+ * Notify filter changed.
+ */
+ protected void notifyFilterChanged() {
+ firePropertyChange("filter", oldFilter, oldFilter = getFilter());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/IFilterProperty.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/IFilterProperty.java
new file mode 100644
index 0000000..2b73b00
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/IFilterProperty.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;
+
+import com.vaadin.data.Container.Filter;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface IFilterProperty.
+ */
+public interface IFilterProperty {
+
+ /** The prop options. */
+ String PROP_OPTIONS = "options";
+
+ /** The prop selection. */
+ String PROP_SELECTION = "selection";
+
+ /** The prop filter value. */
+ String PROP_FILTER_VALUE = "value";
+
+ /**
+ * Returns the vaadin filter for the property.
+ *
+ * @return the filter
+ */
+ Filter getFilter();
+
+ /**
+ * Returns the property id for the search field.
+ *
+ * @return the property id
+ */
+ Object getPropertyId();
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/NumericFilterProperty.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/NumericFilterProperty.java
new file mode 100644
index 0000000..9d82cdb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/NumericFilterProperty.java
@@ -0,0 +1,202 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;
+
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.web.vaadin.common.data.filter.Filters;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.data.Container.Filter;
+import com.vaadin.data.util.converter.Converter.ConversionException;
+
+public class NumericFilterProperty extends FilterProperty {
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(NumericFilterProperty.class);
+
+ private final DecimalConverter numberConverter = new DecimalConverter();
+ private String stringValue;
+
+ private Number number;
+ private Wildcard wildcard;
+
+ private Class<? extends Number> type;
+
+ private Filters filterProvider = new Filters();
+
+ public NumericFilterProperty(Class<? extends Number> type,
+ Object propertyId, Locale locale) {
+ super(propertyId, locale);
+ this.type = type;
+
+ numberConverter.setUseGrouping(true);
+ numberConverter.setPrecision(4);
+ }
+
+ /**
+ * @return the value
+ */
+ public String getStringValue() {
+ return stringValue;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setStringValue(String value) {
+ this.stringValue = value;
+
+ parseNumber(value);
+
+ notifyFilterChanged();
+ }
+
+ /**
+ * @return the number
+ */
+ public Number getNumber() {
+ return number;
+ }
+
+ public void setLocale(Locale locale) {
+ numberConverter.setDecimalFormatSymbols(DecimalFormatSymbols
+ .getInstance(locale));
+ }
+
+ @Override
+ public Filter getFilter() {
+ if (filterProvider == null || getNumber() == null
+ || getStringValue() == null || getStringValue().equals("")) {
+ return null;
+ }
+ if (wildcard == null || wildcard.equals("")) {
+ return filterProvider.eq(getPropertyId(), getNumber());
+ } else {
+ switch (wildcard) {
+ case GE:
+ return filterProvider.gteq(getPropertyId(), getNumber());
+ case GT:
+ return filterProvider.gt(getPropertyId(), getNumber());
+ case LE:
+ return filterProvider.lteq(getPropertyId(), getNumber());
+ case LT:
+ return filterProvider.lt(getPropertyId(), getNumber());
+ case NE:
+ return filterProvider.not(filterProvider.eq(getPropertyId(),
+ getNumber()));
+ }
+ }
+
+ throw new IllegalStateException("Not a valid state!");
+ }
+
+ /**
+ * Calculates the wildcard.
+ *
+ * @param value
+ */
+ private void parseNumber(String value) {
+ wildcard = null;
+ number = 0;
+ if (value == null) {
+ return;
+ }
+ if (value.startsWith(Wildcard.GE.sequence)) {
+ wildcard = Wildcard.GE;
+ } else if (value.startsWith(Wildcard.LE.sequence)) {
+ wildcard = Wildcard.LE;
+ } else if (value.startsWith(Wildcard.GT.sequence)) {
+ wildcard = Wildcard.GT;
+ } else if (value.startsWith(Wildcard.LT.sequence)) {
+ wildcard = Wildcard.LT;
+ } else if (value.startsWith(Wildcard.NE.sequence)) {
+ wildcard = Wildcard.NE;
+ }
+
+ this.stringValue = value.trim();
+
+ String temp = stringValue;
+ if (wildcard != null) {
+ temp = temp.replaceAll(wildcard.sequence, "").trim();
+ }
+ try {
+ Double convertedDouble = numberConverter.convertToModel(temp,
+ Double.class, getLocale());
+ number = convertToNumber(convertedDouble);
+ } catch (ConversionException e) {
+ LOGGER.warn("{}", e);
+ }
+ }
+
+ private Number convertToNumber(Double value) {
+ if (value == null) {
+ return null;
+ }
+ Number result = null;
+ if (type == Double.class || type == Double.TYPE) {
+ result = value;
+ } else if (type == Float.class || type == Float.TYPE) {
+ result = value.floatValue();
+ } else if (type == Short.class || type == Short.TYPE) {
+ result = value.shortValue();
+ } else if (type == Integer.class || type == Integer.TYPE) {
+ result = value.intValue();
+ } else if (type == Byte.class || type == Byte.TYPE) {
+ result = value.byteValue();
+ } else if (type == Long.class || type == Long.TYPE) {
+ result = value.longValue();
+ } else {
+ result = value;
+ }
+
+ return result;
+ }
+
+ /**
+ * @return the wildcard
+ */
+ public Wildcard getWildcard() {
+ return wildcard;
+ }
+
+ public void setUseGrouping(boolean useGrouping) {
+ numberConverter.setUseGrouping(useGrouping);
+ }
+
+ public boolean isUseGrouping() {
+ return numberConverter.isUseGrouping();
+ }
+
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return numberConverter.getDecimalFormatSymbols();
+ }
+
+ public void setDecimalFormatSymbols(
+ DecimalFormatSymbols decimalFormatSymbols) {
+ numberConverter.setDecimalFormatSymbols(decimalFormatSymbols);
+ }
+
+ public static enum Wildcard {
+ GT(">"), LT("<"), GE(">="), LE("<="), NE("!=");
+
+ private String sequence;
+
+ Wildcard(String sequence) {
+ this.sequence = sequence;
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/TextFilterProperty.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/TextFilterProperty.java
new file mode 100644
index 0000000..de26b31
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/fields/search/filter/TextFilterProperty.java
@@ -0,0 +1,125 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.fields.search.filter;
+
+import java.util.Locale;
+
+import org.eclipse.osbp.runtime.web.vaadin.common.data.filter.Filters;
+
+import com.vaadin.data.Container.Filter;
+
+public class TextFilterProperty extends FilterProperty {
+
+ private String value;
+ private Wildcard wildcard;
+ private Filters filterProvider = new Filters();
+
+ public TextFilterProperty(Object propertyId, Locale locale) {
+ super(propertyId, locale);
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+
+ calculateWildcard(value);
+
+ notifyFilterChanged();
+ }
+
+ @Override
+ public Filter getFilter() {
+ if (filterProvider == null || getValue() == null
+ || getValue().equals("")) {
+ return null;
+ }
+ if (wildcard == null || wildcard.equals("")) {
+ return filterProvider.eq(getPropertyId(), getValue());
+ } else {
+ switch (wildcard) {
+ case GE:
+ return filterProvider.gteq(getPropertyId(), getValue());
+ case GT:
+ return filterProvider.gt(getPropertyId(), getValue());
+ case LE:
+ return filterProvider.lteq(getPropertyId(), getValue());
+ case LT:
+ return filterProvider.lt(getPropertyId(), getValue());
+ case NE:
+ return filterProvider.not(filterProvider.eq(getPropertyId(),
+ getValue()));
+ case ANY:
+ return filterProvider.like(getPropertyId(), getValue(), true);
+ }
+ }
+
+ throw new IllegalStateException("Not a valid state!");
+ }
+
+ /**
+ * Calculates the wildcard.
+ *
+ * @param value
+ */
+ private void calculateWildcard(String value) {
+ wildcard = null;
+ if (value.startsWith(Wildcard.GE.sequence)) {
+ wildcard = Wildcard.GE;
+ } else if (value.startsWith(Wildcard.LE.sequence)) {
+ wildcard = Wildcard.LE;
+ } else if (value.startsWith(Wildcard.GT.sequence)) {
+ wildcard = Wildcard.GT;
+ } else if (value.startsWith(Wildcard.LT.sequence)) {
+ wildcard = Wildcard.LT;
+ } else if (value.startsWith(Wildcard.NE.sequence)) {
+ wildcard = Wildcard.NE;
+ } else if (value.contains(Wildcard.ANY.sequence)) {
+ wildcard = Wildcard.ANY;
+ }
+
+ if (wildcard != null) {
+ // remove the wildcard from the value and change * to %
+ if (wildcard == Wildcard.ANY) {
+ this.value = value.replaceAll("\\*", "%").trim();
+ } else {
+ this.value = value.replaceAll(wildcard.sequence, "").trim();
+ }
+ }
+ }
+
+ /**
+ * @return the wildcard
+ */
+ public Wildcard getWildcard() {
+ return wildcard;
+ }
+
+ public static enum Wildcard {
+ GT(">"), LT("<"), GE(">="), LE("<="), NE("!="), ANY("*");
+
+ private String sequence;
+
+ Wildcard(String sequence) {
+ this.sequence = sequence;
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/EmptyStringValidator.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/EmptyStringValidator.java
new file mode 100644
index 0000000..faa6657
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/EmptyStringValidator.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.validator;
+
+import com.vaadin.data.validator.StringLengthValidator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class EmptyStringValidator.
+ */
+@SuppressWarnings("serial")
+public class EmptyStringValidator extends StringLengthValidator {
+
+ /**
+ * Instantiates a new empty string validator.
+ *
+ * @param errorMessage
+ * the error message
+ */
+ public EmptyStringValidator(String errorMessage) {
+ super(errorMessage, 1, -1, true);
+ }
+
+ /**
+ * Checks if empty values are allowed.
+ *
+ * @param allowed
+ * the value to set
+ * @return the empty string validator
+ */
+ public EmptyStringValidator setEmptyAllowed(boolean allowed) {
+ if (allowed) {
+ setMinLength(0);
+ } else {
+ setMinLength(1);
+ }
+ return this;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/NumberBoundsValidator.java b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/NumberBoundsValidator.java
new file mode 100644
index 0000000..64495b6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.components/src/org/eclipse/osbp/runtime/web/vaadin/components/validator/NumberBoundsValidator.java
@@ -0,0 +1,208 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.components.validator;
+
+import java.math.BigDecimal;
+
+import com.vaadin.data.validator.AbstractValidator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class NumberBoundsValidator.
+ */
+@SuppressWarnings("serial")
+public class NumberBoundsValidator extends AbstractValidator<Number> {
+
+ /** The max value. */
+ private BigDecimal maxValue;
+
+ /** The include equal_max. */
+ private boolean includeEqual_max;
+
+ /** The min value. */
+ private BigDecimal minValue;
+
+ /** The include equal_min. */
+ private boolean includeEqual_min;
+
+ /** The exact value. */
+ private BigDecimal exactValue;
+
+ /** The exact. */
+ private boolean exact;
+
+ /**
+ * Instantiates a new number bounds validator.
+ *
+ * @param errorMessage
+ * the error message
+ */
+ public NumberBoundsValidator(String errorMessage) {
+ super(errorMessage);
+ }
+
+ /**
+ * Only values that are greater than the given value will be accepted by
+ * that validator. Values that do not match that constraint will be declined
+ * and force and error.
+ *
+ * @param value
+ * the value to set
+ * @return the number bounds validator
+ */
+ public NumberBoundsValidator greater(Number value) {
+ resetExact();
+
+ this.minValue = new BigDecimal(value.doubleValue());
+ includeEqual_min = false;
+ return this;
+ }
+
+ /**
+ * Only values that are greater equal than the given value will be accepted
+ * by that validator. Values that do not match that constraint will be
+ * declined and force and error.
+ *
+ * @param value
+ * the value to set
+ * @return the number bounds validator
+ */
+ public NumberBoundsValidator greaterEqual(Number value) {
+ resetExact();
+
+ this.minValue = new BigDecimal(value.doubleValue());
+ includeEqual_min = true;
+ return this;
+ }
+
+ /**
+ * Only values that are lower than the given value will be accepted by that
+ * validator. Values that do not match that constraint will be declined and
+ * force and error.
+ *
+ * @param value
+ * the value to set
+ * @return the number bounds validator
+ */
+ public NumberBoundsValidator lower(Number value) {
+ resetExact();
+
+ this.maxValue = new BigDecimal(value.doubleValue());
+ includeEqual_max = false;
+ return this;
+ }
+
+ /**
+ * Only values that are lower equal than the given value will be accepted by
+ * that validator. Values that do not match that constraint will be declined
+ * and force and error.
+ *
+ * @param value
+ * the value to set
+ * @return the number bounds validator
+ */
+ public NumberBoundsValidator lowerEqual(Number value) {
+ resetExact();
+
+ this.maxValue = new BigDecimal(value.doubleValue());
+ includeEqual_max = true;
+ return this;
+ }
+
+ /**
+ * Only values that are equal the given value will be accepted by that
+ * validator. Values that are greater or lower will be declined and force
+ * and error.
+ *
+ * @param value
+ * the value to set
+ * @return the number bounds validator
+ */
+ public NumberBoundsValidator equal(Number value) {
+ maxValue = null;
+ includeEqual_max = false;
+ minValue = null;
+ includeEqual_min = false;
+
+ exactValue = new BigDecimal(value.doubleValue());
+ exact = true;
+ return this;
+ }
+
+ /**
+ * Resets the internal "exact" state of that validator.
+ */
+ private void resetExact() {
+ exactValue = null;
+ exact = false;
+ }
+
+ /**
+ * Gets the max.
+ *
+ * @return the max
+ */
+ public Number getMax() {
+ return maxValue;
+ }
+
+ /**
+ * Gets the min.
+ *
+ * @return the min
+ */
+ public Number getMin() {
+ return minValue;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.validator.AbstractValidator#isValidValue(java.lang.Object)
+ */
+ @Override
+ public boolean isValidValue(Number value) {
+
+ BigDecimal input = new BigDecimal(value.doubleValue());
+ boolean result = true;
+
+ if (exact) {
+ result = exactValue.compareTo(input) == 0;
+ } else {
+ if (maxValue != null) {
+ int checkResult = maxValue.compareTo(input);
+ if (includeEqual_max) {
+ result &= checkResult >= 0;
+ } else {
+ result &= checkResult == 1;
+ }
+ }
+
+ if (minValue != null) {
+ int checkResult = minValue.compareTo(input);
+ if (includeEqual_min) {
+ result &= checkResult <= 0;
+ } else {
+ result &= checkResult == -1;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.data.validator.AbstractValidator#getType()
+ */
+ @Override
+ public Class<Number> getType() {
+ return Number.class;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.project b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.project
new file mode 100644
index 0000000..858e921
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/.project
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.databinding.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..3e1ad67
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.databinding.tests
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.databinding.tests
+Bundle-Version: 0.9.0.qualifier
+Bundle-ActivationPolicy: lazy
+Require-Bundle: javax.servlet;bundle-version="3.0.0";visibility:=reexport,
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)";visibility:=reexport,
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)";visibility:=reexport,
+ org.eclipse.core.databinding;bundle-version="1.4.1";visibility:=reexport,
+ org.eclipse.core.databinding.beans;bundle-version="1.2.200";visibility:=reexport,
+ org.eclipse.core.databinding.observable;bundle-version="1.4.1";visibility:=reexport,
+ org.eclipse.core.databinding.property;bundle-version="1.4.200";visibility:=reexport,
+ org.apache.commons.beanutils;bundle-version="1.9.2",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.junit;bundle-version="4.10.0",
+ org.apache.commons.logging;bundle-version="1.0.4",
+ org.jsoup;bundle-version="1.7.2"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse OSBP
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/build.properties b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/build.properties
new file mode 100644
index 0000000..25a8081
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/build.properties
@@ -0,0 +1,6 @@
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ LICENSE.txt
+source.. = src/
+src.includes = LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/pom.xml
new file mode 100644
index 0000000..576b001
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/pom.xml
@@ -0,0 +1,576 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.databinding.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Test.class</include>
+ </includes>
+ <failIfNoTests>false</failIfNoTests>
+ <showEclipseLog>true</showEclipseLog>
+ <bundleStartLevel>
+
+ <!-- WS -->
+ <bundle>
+ <id>ch.qos.logback.classic</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>ch.qos.logback.core</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>ch.qos.logback.slf4j</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.google.guava</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.google.gwt.thirdparty.guava</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.google.gwt.thirdparty.streamhtmlparser</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.ibm.icu</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.vaadin.client</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.vaadin.server</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>com.vaadin.shared</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.annotation</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.inject</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.persistence</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.servlet</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.transaction</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.validation</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>javax.xml</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.batik.css</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.batik.util</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.batik.util.gui</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.beanutils</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.collections</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.lang</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.commons.logging</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.xerces</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.xml.resolver</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.apache.xml.serializer</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.compare.core</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.commands</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.contenttype</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding.beans</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding.observable</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding.property</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.databinding</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.expressions</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.filesystem.java7</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.filesystem</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.jobs</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.resources</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.runtime.compatibility.registry</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.runtime</id>
+ <level>4</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.core.variables</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.databinding</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore.change</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore.edit</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore.xmi</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.ecore</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.emf.edit</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.app</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.bidi</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.common</id>
+ <level>2</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.coordinator</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.ds</id>
+ <level>1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.preferences</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.region</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.registry</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.security</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.transforms.hook</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.util</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.equinox.weaving.hook</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.compatibility.state</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.services</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi.util</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osgi</id>
+ <level>-1</level>
+ <autoStart>true</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.xsd</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.hamcrest.core</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.json</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.jsoup</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.junit</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.knowhowlab.osgi.testing.assertions</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.knowhowlab.osgi.testing.utils</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.dependencies.fragment.jdk</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.slf4j.api</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.css.sac</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.dom.events</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.dom.smil</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.dom.svg</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.w3c.flute</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>osgi.enterprise</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>slf4j.api</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+
+ <!-- TP -->
+ <bundle>
+ <id>org.eclipse.osbp.dsl.dto.lib</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.common.editparts.emf</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.common.model</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.databinding.beans</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.databinding.emf</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.extension.editparts.emf</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.extension.editparts</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.extension.model</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.ui.presentation.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.ecview.core.util.emf</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.vaadin.common</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.vaadin.components</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.vaadin.databinding.tests</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ <bundle>
+ <id>org.eclipse.osbp.runtime.web.vaadin.databinding</id>
+ <level>4</level>
+ <autoStart>false</autoStart>
+ </bundle>
+ </bundleStartLevel>
+
+<!-- <dependencies> -->
+<!-- Plugins -->
+<!-- <dependency> -->
+<!-- <type>eclipse-plugin</type> -->
+<!-- <artifactId>org.eclipse.osbp.runtime.component.configuration.manager.test.conf</artifactId> -->
+<!-- <version>0.0.0</version> -->
+<!-- </dependency> -->
+<!-- </dependencies> -->
+
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+ <properties>
+ <osbp.skip.javadoc>true</osbp.skip.javadoc>
+ </properties>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTest.java
new file mode 100644
index 0000000..eaba807
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTest.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.util.IndexedContainer;
+
+public class ContainerItemSetTest {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_containerItemSet() {
+ // Binded
+ // VaadinObservables.observeItemSet(Container.ItemSetChangeNotifier)
+ // Am besten IndexedContainer verwenden und manuell item hinzuf��gen
+ IndexedContainer container = new IndexedContainer();
+ WritableList itemIds = new WritableList();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindList(itemIds, VaadinObservables
+ .observeContainerItemSetContents(container, String.class));
+
+ Assert.assertEquals(0, itemIds.size());
+ container.addItem("1");
+ Assert.assertEquals(1, itemIds.size());
+ }
+
+ @Test
+ public void test_targetToModel() {
+ // Binded
+ // VaadinObservables.observeItemSet(Container.ItemSetChangeNotifier)
+ // Am besten IndexedContainer verwenden und manuell item hinzuf��gen
+ IndexedContainer container = new IndexedContainer();
+ WritableList itemIds = new WritableList();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindList(itemIds, VaadinObservables
+ .observeContainerItemSetContents(container, String.class));
+
+ Assert.assertEquals(0, container.size());
+ itemIds.add("1");
+ Assert.assertEquals(1, container.size());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTests.java
new file mode 100644
index 0000000..d353874
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ContainerItemSetTests.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Florian Pirchner - initial implementation
+ *
+ *******************************************************************************/
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.util.IndexedContainer;
+
+public class ContainerItemSetTests {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_containerItemSet() {
+ // Binded
+ // VaadinObservables.observeItemSet(Container.ItemSetChangeNotifier)
+ // Am besten IndexedContainer verwenden und manuell item hinzuf��gen
+ IndexedContainer container = new IndexedContainer();
+ WritableList itemIds = new WritableList();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindList(itemIds, VaadinObservables
+ .observeContainerItemSetContents(container, String.class));
+
+ Assert.assertEquals(0, itemIds.size());
+ container.addItem("1");
+ Assert.assertEquals(1, itemIds.size());
+ }
+
+ @Test
+ public void test_targetToModel() {
+ // Binded
+ // VaadinObservables.observeItemSet(Container.ItemSetChangeNotifier)
+ // Am besten IndexedContainer verwenden und manuell item hinzuf��gen
+ IndexedContainer container = new IndexedContainer();
+ WritableList itemIds = new WritableList();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindList(itemIds, VaadinObservables
+ .observeContainerItemSetContents(container, String.class));
+
+ Assert.assertEquals(0, container.size());
+ itemIds.add("1");
+ Assert.assertEquals(1, container.size());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java
new file mode 100644
index 0000000..df46133
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/DefaultUI.java
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import java.util.Properties;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinService;
+import com.vaadin.server.VaadinServletService;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.shared.communication.PushMode;
+import com.vaadin.ui.UI;
+
+@SuppressWarnings("serial")
+public class DefaultUI extends UI {
+
+ public DefaultUI() {
+ try {
+ VaadinSession session = new CustomVaadinSession(new VaadinServletService(
+ null, new CustomDeploymentConfiguration()));
+ setSession(session);
+
+ VaadinSession.setCurrent(session);
+
+ } catch (ServiceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @Override
+ protected void init(VaadinRequest request) {
+
+ }
+
+ private class CustomVaadinSession extends VaadinSession {
+
+ Lock lock = new ReentrantLock();
+
+ public CustomVaadinSession(VaadinService service) {
+ super(service);
+ }
+
+ @Override
+ public Lock getLockInstance() {
+ return lock;
+ }
+
+ }
+
+
+ private static class CustomDeploymentConfiguration implements
+ DeploymentConfiguration {
+
+ @Override
+ public boolean isProductionMode() {
+ return false;
+ }
+
+ @Override
+ public boolean isXsrfProtectionEnabled() {
+ return false;
+ }
+
+ @Override
+ public boolean isSyncIdCheckEnabled() {
+ return false;
+ }
+
+ @Override
+ public int getResourceCacheTime() {
+ return 0;
+ }
+
+ @Override
+ public int getHeartbeatInterval() {
+ return 0;
+ }
+
+ @Override
+ public boolean isCloseIdleSessions() {
+ return false;
+ }
+
+ @Override
+ public PushMode getPushMode() {
+ return PushMode.DISABLED;
+ }
+
+ @Override
+ public Properties getInitParameters() {
+ return new Properties();
+ }
+
+ @Override
+ public String getApplicationOrSystemProperty(String propertyName,
+ String defaultValue) {
+ return null;
+ }
+
+ @Override
+ public LegacyProperyToStringMode getLegacyPropertyToStringMode() {
+ return LegacyProperyToStringMode.DISABLED;
+ }
+
+ @Override
+ public boolean isSendUrlsAsParameters() {
+ return false;
+ }
+
+ @Override
+ public String getUIClassName() {
+ return null;
+ }
+
+ @Override
+ public String getUIProviderClassName() {
+ return null;
+ }
+
+ @Override
+ public String getWidgetset(String defaultValue) {
+ return null;
+ }
+
+ @Override
+ public String getResourcesPath() {
+ return null;
+ }
+
+ @Override
+ public String getClassLoaderName() {
+ return null;
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTest.java
new file mode 100644
index 0000000..4946b29
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTest.java
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.PropertyInfo;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.PropertysetItem;
+
+public class ItemPropertySetInfoTest {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @SuppressWarnings("unchecked")
+ // @Test
+ public void test_itemPropertySet() {
+ PropertysetItem item = new PropertysetItem();
+ WritableValue value = new WritableValue();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value,
+ VaadinObservables.observeItemPropertySetInfoValue(item));
+
+ item.addItemProperty("1", new ObjectProperty<String>("1"));
+ Collection<PropertyInfo> infos = (Collection<PropertyInfo>) value
+ .getValue();
+ Assert.assertEquals(1, infos.size());
+
+ item.addItemProperty("2", new ObjectProperty<String>("2"));
+ infos = (Collection<PropertyInfo>) value.getValue();
+ Assert.assertEquals(2, infos.size());
+ }
+
+ // @Test
+ public void test_itemPropertySet_targetToModel() {
+ PropertysetItem item = new PropertysetItem();
+ WritableValue value = new WritableValue();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value,
+ VaadinObservables.observeItemPropertySetInfoValue(item));
+
+ List<PropertyInfo> props = new ArrayList<PropertyInfo>();
+ props.add(new PropertyInfo("1", new ObjectProperty<String>("1")));
+ value.setValue(props);
+ Assert.assertEquals(1, item.getItemPropertyIds().size());
+
+ props = new ArrayList<PropertyInfo>(props);
+ props.add(new PropertyInfo("2", new ObjectProperty<String>("2")));
+ value.setValue(props);
+ Assert.assertEquals(2, item.getItemPropertyIds().size());
+ }
+
+ @Test
+ public void test_itemPropertySet_2Items() {
+ PropertysetItem item1 = new PropertysetItem();
+ PropertysetItem item2 = new PropertysetItem();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(VaadinObservables.observeItemPropertySetInfoValue(item1),
+ VaadinObservables.observeItemPropertySetInfoValue(item2));
+
+ item1.addItemProperty("1", new ObjectProperty<String>("1"));
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ item2.addItemProperty("2", new ObjectProperty<String>("2"));
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ item1.removeItemProperty("1");
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ item2.removeItemProperty("2");
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTests.java
new file mode 100644
index 0000000..1c6c520
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetInfoTests.java
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.PropertyInfo;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.PropertysetItem;
+
+public class ItemPropertySetInfoTests {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @SuppressWarnings("unchecked")
+ // @Test
+ public void test_itemPropertySet() {
+ PropertysetItem item = new PropertysetItem();
+ WritableValue value = new WritableValue();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value,
+ VaadinObservables.observeItemPropertySetInfoValue(item));
+
+ item.addItemProperty("1", new ObjectProperty<String>("1"));
+ Collection<PropertyInfo> infos = (Collection<PropertyInfo>) value
+ .getValue();
+ Assert.assertEquals(1, infos.size());
+
+ item.addItemProperty("2", new ObjectProperty<String>("2"));
+ infos = (Collection<PropertyInfo>) value.getValue();
+ Assert.assertEquals(2, infos.size());
+ }
+
+ // @Test
+ public void test_itemPropertySet_targetToModel() {
+ PropertysetItem item = new PropertysetItem();
+ WritableValue value = new WritableValue();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value,
+ VaadinObservables.observeItemPropertySetInfoValue(item));
+
+ List<PropertyInfo> props = new ArrayList<PropertyInfo>();
+ props.add(new PropertyInfo("1", new ObjectProperty<String>("1")));
+ value.setValue(props);
+ Assert.assertEquals(1, item.getItemPropertyIds().size());
+
+ props = new ArrayList<PropertyInfo>(props);
+ props.add(new PropertyInfo("2", new ObjectProperty<String>("2")));
+ value.setValue(props);
+ Assert.assertEquals(2, item.getItemPropertyIds().size());
+ }
+
+ @Test
+ public void test_itemPropertySet_2Items() {
+ PropertysetItem item1 = new PropertysetItem();
+ PropertysetItem item2 = new PropertysetItem();
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(VaadinObservables.observeItemPropertySetInfoValue(item1),
+ VaadinObservables.observeItemPropertySetInfoValue(item2));
+
+ item1.addItemProperty("1", new ObjectProperty<String>("1"));
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ item2.addItemProperty("2", new ObjectProperty<String>("2"));
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ item1.removeItemProperty("1");
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ item2.removeItemProperty("2");
+ Assert.assertEquals(item1.getItemPropertyIds().size(), item2
+ .getItemPropertyIds().size());
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTest.java
new file mode 100644
index 0000000..162287d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTest.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.PropertysetItem;
+
+public class ItemPropertySetTest {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void test_itemPropertySet() {
+ // Binded
+ // VaadinObservables.observePropertySet(Item.PropertySetChangeNotifier)
+ // Am besten ProperySetItem verwenden und manuell properties hinzuf��gen
+ PropertysetItem property = new PropertysetItem();
+ WritableValue value = new WritableValue();
+ Assert.assertNotNull(value);
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeItemPropertySetValue(property));
+
+ property.addItemProperty("1", new ObjectProperty<String>("1"));
+ Collection<PropertysetItem> properties = (Collection<PropertysetItem>) value.getValue();
+ Assert.assertEquals(1, properties.size());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTests.java
new file mode 100644
index 0000000..5c2ab4f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/ItemPropertySetTests.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Florian Pirchner - initial implementation
+ *
+ *******************************************************************************/
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.data.util.PropertysetItem;
+
+public class ItemPropertySetTests {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ @SuppressWarnings("unchecked")
+ public void test_itemPropertySet() {
+ // Binded
+ // VaadinObservables.observePropertySet(Item.PropertySetChangeNotifier)
+ // Am besten ProperySetItem verwenden und manuell properties hinzuf��gen
+ PropertysetItem property = new PropertysetItem();
+ WritableValue value = new WritableValue();
+ Assert.assertNotNull(value);
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeItemPropertySetValue(property));
+
+ property.addItemProperty("1", new ObjectProperty<String>("1"));
+ Collection<PropertysetItem> properties = (Collection<PropertysetItem>) value.getValue();
+ Assert.assertEquals(1, properties.size());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTest.java
new file mode 100644
index 0000000..3f8a0ff
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTest.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.ui.Table;
+
+public class PropertyDescriptionTest {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_table_propertyDescription() {
+ Table table = new Table();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeDescription(table));
+
+ Assert.assertEquals("", table.getDescription());
+ Assert.assertEquals("", value.getValue());
+
+ value.setValue("HUHU");
+ Assert.assertEquals("HUHU", table.getDescription());
+ }
+
+ @Test
+ public void test_table_propertyDescription_updateFromTarget() {
+ Table table = new Table();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeDescription(table));
+
+ Assert.assertEquals("", table.getDescription());
+ Assert.assertEquals("", value.getValue());
+
+ table.setDescription("HUHU");
+ Assert.assertEquals("", value.getValue());
+ Assert.assertEquals("HUHU", table.getDescription());
+ dbc.updateTargets();
+
+ Assert.assertEquals("HUHU", value.getValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTests.java
new file mode 100644
index 0000000..e1a0f9f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyDescriptionTests.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.ui.Table;
+
+public class PropertyDescriptionTests {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_table_propertyDescription() {
+ Table table = new Table();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeDescription(table));
+
+ Assert.assertEquals("", table.getDescription());
+ Assert.assertEquals("", value.getValue());
+
+ value.setValue("HUHU");
+ Assert.assertEquals("HUHU", table.getDescription());
+ }
+
+ @Test
+ public void test_table_propertyDescription_updateFromTarget() {
+ Table table = new Table();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeDescription(table));
+
+ Assert.assertEquals("", table.getDescription());
+ Assert.assertEquals("", value.getValue());
+
+ table.setDescription("HUHU");
+ Assert.assertEquals("", value.getValue());
+ Assert.assertEquals("HUHU", table.getDescription());
+ dbc.updateTargets();
+
+ Assert.assertEquals("HUHU", value.getValue());
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTest.java
new file mode 100644
index 0000000..0b9ae77
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTest.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.ui.CheckBox;
+
+public class PropertyReadonlyTest {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_propertyReadonly() {
+ CheckBox property = new CheckBox();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeReadonly(property));
+ Assert.assertEquals(false, value.getValue());
+
+ property.setReadOnly(true);
+ Assert.assertEquals(true, value.getValue());
+ }
+
+ @Test
+ public void test_propertyReadonly_updateFromTarget() {
+ CheckBox property = new CheckBox();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeReadonly(property));
+ Assert.assertEquals(false, value.getValue());
+
+ value.setValue(true);
+ Assert.assertTrue(property.isReadOnly());
+ value.setValue(false);
+ Assert.assertFalse(property.isReadOnly());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTests.java
new file mode 100644
index 0000000..0f493cc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyReadonlyTests.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Florian Pirchner - initial implementation
+ *
+ *******************************************************************************/
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.ui.CheckBox;
+
+public class PropertyReadonlyTests {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_propertyReadonly() {
+ CheckBox property = new CheckBox();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeReadonly(property));
+ Assert.assertEquals(false, value.getValue());
+
+ property.setReadOnly(true);
+ Assert.assertEquals(true, value.getValue());
+ }
+
+ @Test
+ public void test_propertyReadonly_updateFromTarget() {
+ CheckBox property = new CheckBox();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeReadonly(property));
+ Assert.assertEquals(false, value.getValue());
+
+ value.setValue(true);
+ Assert.assertTrue(property.isReadOnly());
+ value.setValue(false);
+ Assert.assertFalse(property.isReadOnly());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTest.java
new file mode 100644
index 0000000..32566f6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTest.java
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.TextField;
+
+public class PropertyValueTest {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_propertyValue() {
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ ObjectProperty<String> property = new ObjectProperty<String>("");
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeValue(property));
+ Assert.assertEquals("", value.getValue());
+
+ property.setValue("Huhu");
+ Assert.assertEquals("Huhu", value.getValue());
+ }
+
+ @Test
+ public void test_propertyValue_updateFromTarget() {
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ ObjectProperty<String> property = new ObjectProperty<String>("Huhu");
+
+ WritableValue value = new WritableValue();
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeValue(property));
+ Assert.assertEquals("Huhu", property.getValue());
+
+ value.setValue("Hahaha");
+ Assert.assertEquals("Hahaha", property.getValue());
+ }
+
+ @Test
+ public void test_propertyValue_updateModelToTarget() {
+ TextField text = new TextField();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ Binding binding = dbc.bindValue(value, VaadinObservables.observeInputPrompt(text));
+ Assert.assertNull(text.getInputPrompt());
+
+ text.setInputPrompt("Huhu");
+ Assert.assertNull(value.getValue());
+ binding.updateModelToTarget();
+
+ Assert.assertEquals("Huhu", value.getValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTests.java
new file mode 100644
index 0000000..49a7fc7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/PropertyValueTests.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Florian Pirchner - initial implementation
+ *
+ *******************************************************************************/
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.ui.TextField;
+
+public class PropertyValueTests {
+
+ @Before
+ public void setup() {
+ DefaultUI.setCurrent(new DefaultUI());
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ }
+
+ @Test
+ public void test_propertyValue() {
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ ObjectProperty<String> property = new ObjectProperty<String>("");
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeValue(property));
+ Assert.assertEquals("", value.getValue());
+
+ property.setValue("Huhu");
+ Assert.assertEquals("Huhu", value.getValue());
+ }
+
+ @Test
+ public void test_propertyValue_updateFromTarget() {
+ VaadinObservables.getRealm(DefaultUI.getCurrent());
+ ObjectProperty<String> property = new ObjectProperty<String>("Huhu");
+
+ WritableValue value = new WritableValue();
+ DataBindingContext dbc = new DataBindingContext();
+ dbc.bindValue(value, VaadinObservables.observeValue(property));
+ Assert.assertEquals("Huhu", property.getValue());
+
+ value.setValue("Hahaha");
+ Assert.assertEquals("Hahaha", property.getValue());
+ }
+
+ @Test
+ public void test_propertyValue_updateModelToTarget() {
+ TextField text = new TextField();
+
+ WritableValue value = new WritableValue();
+ Assert.assertNull(value.getValue());
+
+ DataBindingContext dbc = new DataBindingContext();
+ Binding binding = dbc.bindValue(value, VaadinObservables.observeInputPrompt(text));
+ Assert.assertNull(text.getInputPrompt());
+
+ text.setInputPrompt("Huhu");
+ Assert.assertNull(value.getValue());
+ binding.updateModelToTarget();
+
+ Assert.assertEquals("Huhu", value.getValue());
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTest.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTest.java
new file mode 100644
index 0000000..e061233
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTest.java
@@ -0,0 +1,135 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.IListChangeListener;
+import org.eclipse.core.databinding.observable.list.ListChangeEvent;
+import org.eclipse.core.databinding.observable.list.ListDiffEntry;
+import org.eclipse.core.databinding.observable.set.WritableSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.SetToListAdapter;
+
+public class SetToListAdapterTest {
+
+ @Before
+ public void setup() {
+ new TestRealm();
+ }
+
+ @Test
+ public void test() {
+ WritableSet set = new WritableSet(TestRealm.getDefault());
+ SetToListAdapter adapter = new SetToListAdapter(set, null);
+
+ ListChangeListener listener = new ListChangeListener();
+ adapter.addListChangeListener(listener);
+
+ set.add("Huhu");
+ ListDiffEntry e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(e1.isAddition());
+ assertEquals("Huhu", e1.getElement());
+ assertEquals(1, adapter.size());
+
+ set.add("Haha");
+ e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(e1.isAddition());
+ assertEquals("Haha", e1.getElement());
+ assertEquals(1, e1.getPosition());
+ assertEquals(2, adapter.size());
+
+ set.add("Blabla");
+ e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(e1.isAddition());
+ assertEquals("Blabla", e1.getElement());
+ assertEquals(2, e1.getPosition());
+ assertEquals(3, adapter.size());
+
+ List<String> added = Arrays.asList("Blublu", "Foo", "Bar");
+ set.addAll(added);
+ e1 = listener.event.diff.getDifferences()[0];
+ ListDiffEntry e2 = listener.event.diff.getDifferences()[1];
+ ListDiffEntry e3 = listener.event.diff.getDifferences()[2];
+ assertEquals(3, listener.event.diff.getDifferences().length);
+ assertEquals(6, adapter.size());
+ assertTrue(e1.isAddition());
+ assertTrue(e2.isAddition());
+ assertTrue(e3.isAddition());
+ assertTrue(added.contains(e1.getElement()));
+ assertTrue(added.contains(e2.getElement()));
+ assertTrue(added.contains(e3.getElement()));
+ assertTrue(e1.getPosition() >= 3 && e1.getPosition() <= 5);
+ assertTrue(e2.getPosition() >= 3 && e1.getPosition() <= 5);
+ assertTrue(e3.getPosition() >= 3 && e1.getPosition() <= 5);
+
+ set.remove("Haha");
+ e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(!e1.isAddition());
+ assertEquals("Haha", e1.getElement());
+ assertEquals(1, e1.getPosition());
+ assertEquals(5, adapter.size());
+
+ set.removeAll(added);
+ e1 = listener.event.diff.getDifferences()[0];
+ e2 = listener.event.diff.getDifferences()[1];
+ e3 = listener.event.diff.getDifferences()[2];
+ assertEquals(3, listener.event.diff.getDifferences().length);
+ assertEquals(2, adapter.size());
+ assertTrue(!e1.isAddition());
+ assertTrue(!e2.isAddition());
+ assertTrue(!e3.isAddition());
+ assertTrue(added.contains(e1.getElement()));
+ assertTrue(added.contains(e2.getElement()));
+ assertTrue(added.contains(e3.getElement()));
+ assertTrue(e1.getPosition() >= 2 && e1.getPosition() <= 4);
+ assertTrue(e2.getPosition() >= 2 && e1.getPosition() <= 4);
+ assertTrue(e3.getPosition() >= 2 && e1.getPosition() <= 4);
+
+ }
+
+ private static class ListChangeListener implements IListChangeListener {
+
+ private ListChangeEvent event;
+
+ @Override
+ public void handleListChange(ListChangeEvent event) {
+ this.event = event;
+ }
+
+ }
+
+ private static class TestRealm extends Realm {
+
+ private TestRealm() {
+ setDefault(this);
+ }
+
+ public boolean isCurrent() {
+ return true;
+ }
+
+ public void asyncExec(final Runnable runnable) {
+ throw new UnsupportedOperationException("Not a valid call!");
+ }
+
+ public void timerExec(int milliseconds, final Runnable runnable) {
+ throw new UnsupportedOperationException("Not a valid call!");
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTests.java b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTests.java
new file mode 100644
index 0000000..0c56df5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding.tests/src/org/eclipse/osbp/runtime/web/vaadin/databinding/tests/model/SetToListAdapterTests.java
@@ -0,0 +1,137 @@
+
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.tests.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.IListChangeListener;
+import org.eclipse.core.databinding.observable.list.ListChangeEvent;
+import org.eclipse.core.databinding.observable.list.ListDiffEntry;
+import org.eclipse.core.databinding.observable.set.WritableSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.SetToListAdapter;
+
+public class SetToListAdapterTests {
+
+ @Before
+ public void setup() {
+ new TestRealm();
+ }
+
+ @Test
+ public void test() {
+ WritableSet set = new WritableSet(TestRealm.getDefault());
+ SetToListAdapter adapter = new SetToListAdapter(set, null);
+
+ ListChangeListener listener = new ListChangeListener();
+ adapter.addListChangeListener(listener);
+
+ set.add("Huhu");
+ ListDiffEntry e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(e1.isAddition());
+ assertEquals("Huhu", e1.getElement());
+ assertEquals(1, adapter.size());
+
+ set.add("Haha");
+ e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(e1.isAddition());
+ assertEquals("Haha", e1.getElement());
+ assertEquals(1, e1.getPosition());
+ assertEquals(2, adapter.size());
+
+ set.add("Blabla");
+ e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(e1.isAddition());
+ assertEquals("Blabla", e1.getElement());
+ assertEquals(2, e1.getPosition());
+ assertEquals(3, adapter.size());
+
+ List<String> added = Arrays.asList("Blublu", "Foo", "Bar");
+ set.addAll(added);
+ e1 = listener.event.diff.getDifferences()[0];
+ ListDiffEntry e2 = listener.event.diff.getDifferences()[1];
+ ListDiffEntry e3 = listener.event.diff.getDifferences()[2];
+ assertEquals(3, listener.event.diff.getDifferences().length);
+ assertEquals(6, adapter.size());
+ assertTrue(e1.isAddition());
+ assertTrue(e2.isAddition());
+ assertTrue(e3.isAddition());
+ assertTrue(added.contains(e1.getElement()));
+ assertTrue(added.contains(e2.getElement()));
+ assertTrue(added.contains(e3.getElement()));
+ assertTrue(e1.getPosition() >= 3 && e1.getPosition() <= 5);
+ assertTrue(e2.getPosition() >= 3 && e1.getPosition() <= 5);
+ assertTrue(e3.getPosition() >= 3 && e1.getPosition() <= 5);
+
+ set.remove("Haha");
+ e1 = listener.event.diff.getDifferences()[0];
+ assertTrue(!e1.isAddition());
+ assertEquals("Haha", e1.getElement());
+ assertEquals(1, e1.getPosition());
+ assertEquals(5, adapter.size());
+
+ set.removeAll(added);
+ e1 = listener.event.diff.getDifferences()[0];
+ e2 = listener.event.diff.getDifferences()[1];
+ e3 = listener.event.diff.getDifferences()[2];
+ assertEquals(3, listener.event.diff.getDifferences().length);
+ assertEquals(2, adapter.size());
+ assertTrue(!e1.isAddition());
+ assertTrue(!e2.isAddition());
+ assertTrue(!e3.isAddition());
+ assertTrue(added.contains(e1.getElement()));
+ assertTrue(added.contains(e2.getElement()));
+ assertTrue(added.contains(e3.getElement()));
+ assertTrue(e1.getPosition() >= 2 && e1.getPosition() <= 4);
+ assertTrue(e2.getPosition() >= 2 && e1.getPosition() <= 4);
+ assertTrue(e3.getPosition() >= 2 && e1.getPosition() <= 4);
+
+ }
+
+ private static class ListChangeListener implements IListChangeListener {
+
+ private ListChangeEvent event;
+
+ @Override
+ public void handleListChange(ListChangeEvent event) {
+ this.event = event;
+ }
+
+ }
+
+ private static class TestRealm extends Realm {
+
+ private TestRealm() {
+ setDefault(this);
+ }
+
+ public boolean isCurrent() {
+ return true;
+ }
+
+ public void asyncExec(final Runnable runnable) {
+ throw new UnsupportedOperationException("Not a valid call!");
+ }
+
+ public void timerExec(int milliseconds, final Runnable runnable) {
+ throw new UnsupportedOperationException("Not a valid call!");
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/.project b/org.eclipse.osbp.runtime.web.vaadin.databinding/.project
new file mode 100644
index 0000000..31b2223
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/.project
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.databinding</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.databinding/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..486871d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/META-INF/MANIFEST.MF
@@ -0,0 +1,54 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.databinding
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.databinding
+Bundle-Version: 0.9.0.qualifier
+Bundle-ActivationPolicy: lazy
+Require-Bundle: javax.servlet;bundle-version="3.0.0",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ org.eclipse.core.databinding;bundle-version="[1.4.1,2.0.0)",
+ org.eclipse.core.databinding.observable;bundle-version="[1.4.1,2.0.0)",
+ org.eclipse.core.databinding.beans;bundle-version="[1.2.200,2.0.0)",
+ org.eclipse.core.databinding.property;bundle-version="[1.4.200,2.0.0)",
+ org.apache.commons.beanutils;bundle-version="1.9.2",
+ org.eclipse.core.runtime;bundle-version="3.9.0",
+ com.ibm.icu;bundle-version="50.1.1"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.osbp.runtime.web.vaadin.databinding;
+ uses:="org.eclipse.osbp.runtime.web.vaadin.databinding.values,
+ org.eclipse.osbp.runtime.web.vaadin.databinding.properties,
+ com.vaadin.data,
+ org.eclipse.core.databinding.observable,
+ org.eclipse.core.databinding.observable.value,
+ com.vaadin.server,
+ com.vaadin.ui.components.colorpicker,
+ com.vaadin.ui";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;x-internal:=true;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.databinding.container;
+ uses:="com.vaadin.data";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;x-internal:=true;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+ uses:="org.eclipse.osbp.runtime.web.vaadin.databinding.values,
+ org.eclipse.core.databinding.property,
+ org.eclipse.core.databinding.observable,
+ org.eclipse.core.databinding.property.set,
+ org.eclipse.core.databinding.observable.set,
+ com.vaadin.data,
+ org.eclipse.core.databinding.property.list,
+ org.eclipse.core.databinding.observable.masterdetail,
+ org.eclipse.core.databinding.property.value,
+ org.eclipse.core.databinding.observable.value,
+ org.eclipse.core.databinding.observable.list,
+ com.vaadin.ui";version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+ uses:="org.eclipse.core.databinding.observable.set,
+ org.eclipse.osbp.runtime.web.vaadin.databinding,
+ org.eclipse.core.databinding.property,
+ org.eclipse.core.databinding.property.list,
+ org.eclipse.core.databinding.observable,
+ org.eclipse.core.databinding.property.value,
+ org.eclipse.core.internal.databinding.property.value,
+ org.eclipse.core.databinding.observable.value,
+ org.eclipse.core.databinding.observable.list";version="0.9.0"
+Bundle-Vendor: Eclipse OSBP
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/about.html b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/about.ini b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/about.properties b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.properties
new file mode 100644
index 0000000..57189b1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.databinding
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/build.properties b/org.eclipse.osbp.runtime.web.vaadin.databinding/build.properties
new file mode 100644
index 0000000..edc7aca
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/build.properties
@@ -0,0 +1,6 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ LICENSE.txt
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.databinding/pom.xml
new file mode 100644
index 0000000..1497273
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/pom.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.databinding</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <description>An implementation of Eclipse Databinding for Vaadin widgets. Using the VaadinObservables static methods, IObservables can be created and used in Eclipse Databinding.</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/IVaadinObservable.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/IVaadinObservable.java
new file mode 100644
index 0000000..9a08058
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/IVaadinObservable.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding;
+
+import org.eclipse.core.databinding.observable.IObservable;
+
+/**
+ * {@link IObservable} observing an vaadin Component.
+ *
+ * @since 1.1
+ *
+ */
+public interface IVaadinObservable extends IObservable {
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinObservables.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinObservables.java
new file mode 100644
index 0000000..acb16d8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinObservables.java
@@ -0,0 +1,2605 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding;
+
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.databinding.beans.BeansObservables;
+import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableSet;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.SetToListAdapter;
+
+import com.vaadin.data.Buffered;
+import com.vaadin.data.BufferedValidatable;
+import com.vaadin.data.Container;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Validatable;
+import com.vaadin.server.Scrollable;
+import com.vaadin.server.Sizeable;
+import com.vaadin.server.VaadinService;
+import com.vaadin.ui.AbstractEmbedded;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.AbstractMedia;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.AbstractSplitPanel;
+import com.vaadin.ui.AbstractTextField;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Component.Focusable;
+import com.vaadin.ui.CustomLayout;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.Embedded;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout.MarginHandler;
+import com.vaadin.ui.Layout.SpacingHandler;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.MenuBar;
+import com.vaadin.ui.OptionGroup;
+import com.vaadin.ui.PopupDateField;
+import com.vaadin.ui.PopupView;
+import com.vaadin.ui.ProgressIndicator;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.SingleComponentContainer;
+import com.vaadin.ui.Slider;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.Tab;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.Tree;
+import com.vaadin.ui.TreeTable;
+import com.vaadin.ui.TwinColSelect;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.Upload;
+import com.vaadin.ui.Video;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.components.colorpicker.ColorPickerGradient;
+import com.vaadin.ui.components.colorpicker.ColorPickerGrid;
+import com.vaadin.ui.components.colorpicker.ColorPickerHistory;
+import com.vaadin.ui.components.colorpicker.ColorPickerSelect;
+import com.vaadin.ui.components.colorpicker.ColorSelector;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A factory for creating observables for Vaadin Components.
+ */
+public class VaadinObservables {
+
+ /** The realms. */
+ private static java.util.List<UIRealm> realms = new ArrayList<UIRealm>();
+
+ /**
+ * Returns the realm representing the UI thread for the given display.
+ *
+ * @param ui
+ * the ui
+ * @return the realm representing the UI thread for the given display
+ */
+ public static Realm getRealm(final UI ui) {
+ return getRealm(ui, true);
+ }
+
+ /**
+ * Returns the realm representing the UI thread for the given display.
+ *
+ * @param ui
+ * the ui
+ * @param autoSynchronize
+ * synchronize multi vaadin ui's
+ * @return the realm representing the UI thread for the given display
+ */
+ public static Realm getRealm(final UI ui, boolean autoSynchronize) {
+ synchronized (realms) {
+ for (Iterator<UIRealm> it = realms.iterator(); it.hasNext();) {
+ UIRealm displayRealm = it.next();
+ if (displayRealm.ui == ui) {
+ displayRealm.makeDefault();
+ return displayRealm;
+ }
+ }
+ UIRealm result = new UIRealm(ui, autoSynchronize);
+ realms.add(result);
+ return result;
+ }
+ }
+
+ /**
+ * Activates the realm for the current thread.
+ *
+ * @param ui
+ * the ui
+ */
+ public static void activateRealm(final UI ui) {
+ activateRealm(ui, true);
+ }
+
+ /**
+ * Activates the realm for the current thread.
+ *
+ * @param ui
+ * the ui
+ * @param autoSynchronize
+ * synchronize multi vaadin ui's
+ */
+ public static void activateRealm(final UI ui, boolean autoSynchronize) {
+ UIRealm uiRealm = (UIRealm) getRealm(ui, autoSynchronize);
+ uiRealm.makeDefault();
+ }
+
+ /**
+ * Returns the UI of the widget or the current UI.
+ *
+ * @param widget
+ * the widget
+ * @return the ui
+ */
+ public static UI getUI(Component widget) {
+ UI ui = widget != null ? widget.getUI() : null;
+ return ui != null ? ui : UI.getCurrent();
+ }
+
+ /**
+ * Returns the property type of the given field.
+ *
+ * @param field
+ * the field
+ * @return the property type
+ */
+ public static Class<?> getPropertyType(Field<?> field) {
+ return getProperty(field).getType();
+ }
+
+ /**
+ * Returns the property of the given field.
+ *
+ * @param field
+ * the field
+ * @return the property
+ */
+ public static Property<?> getProperty(Field<?> field) {
+ Property<?> property = field.getPropertyDataSource() != null ? field
+ .getPropertyDataSource() : field;
+ return property;
+ }
+
+ /**
+ * Returns an observable value tracking the propertyset of the given item
+ * notifier.
+ *
+ * @param notifier
+ * the notifier
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemPropertySetValue(
+ Item.PropertySetChangeNotifier notifier) {
+ return VaadinProperties.itemPropertysetValue().observe(notifier);
+ }
+
+ /**
+ * Returns an observable value tracking the propertyset of the given item
+ * notifier.
+ *
+ * @param notifier
+ * the notifier
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemPropertySetInfoValue(
+ Item.PropertySetChangeNotifier notifier) {
+ return VaadinProperties.itemPropertysetInfoValue().observe(notifier);
+ }
+
+ /**
+ * Returns an observable list tracking the item set of the given item
+ * notifier.
+ *
+ * @param notifier
+ * the field
+ * @param collectionType
+ * the type contained in the collection
+ * @return the i vaadin observable list
+ */
+ public static IVaadinObservableList observeContainerItemSetContents(
+ Container.ItemSetChangeNotifier notifier, Class<?> collectionType) {
+ return VaadinProperties.containerItemsetAsList(collectionType).observe(
+ notifier);
+ }
+
+ /**
+ * Returns an observable value tracking the container of the given viewer.
+ *
+ * @param viewer
+ * the viewer
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeContainerDatasource(
+ Container.Viewer viewer) {
+ return VaadinProperties.containerDatasource().observe(viewer);
+ }
+
+ /**
+ * Returns an observable value tracking the container of the given viewer.
+ *
+ * @param viewer
+ * the viewer
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemDatasource(
+ Item.Viewer viewer) {
+ return VaadinProperties.itemDatasource().observe(viewer);
+ }
+
+ /**
+ * Returns an observable value tracking the container of the given viewer.
+ *
+ * @param viewer
+ * the viewer
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemDatasource(
+ Property.Viewer viewer) {
+ return VaadinProperties.datasource().observe(viewer);
+ }
+
+ /**
+ * Returns an observable value tracking the selection of the given viewer.
+ *
+ * @param notifier
+ * the notifier
+ * @param type
+ * - the type of the selection object
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSingleSelection(
+ Property.ValueChangeNotifier notifier, Class<?> type) {
+ return VaadinProperties.singleSelection(type).observe(notifier);
+ }
+
+ /**
+ * Returns an observable value tracking nested attribute in the selected
+ * element.
+ * <p>
+ * For instance:<br>
+ * Given a list with Bar-beans. Bar has a relation to Foo-bean by
+ * myfoo-reference.<br>
+ * Then "myFoo.name" can be used as nestedPath to observe the foo#name
+ * attribute of the selected bean in the list.
+ * <p>
+ * This implementation supports pojos and beans. EObjects are not supported.
+ *
+ * @param notifier
+ * the notifier
+ * @param type
+ * - the type of the selection object
+ * @param nestedPath
+ * - the path from the selected element to the observed value.
+ * For instance "myFoo.name".
+ * @return the i observable value
+ */
+ public static IObservableValue observeSingleSelectionDetailValue(
+ Property.ValueChangeNotifier notifier, Class<?> type,
+ String nestedPath) {
+ IVaadinObservableValue masterObservable = VaadinProperties
+ .singleSelection(type).observe(notifier);
+
+ if (hasPropertyChangeSupport(type)) {
+ return BeansObservables.observeDetailValue(masterObservable, type,
+ nestedPath, null);
+ } else {
+ return PojoObservables.observeDetailValue(masterObservable,
+ nestedPath, null);
+ }
+ }
+
+ /**
+ * Returns true, if the bean has property change support.
+ *
+ * @param valueType
+ * the value type
+ * @return true, if successful
+ */
+ private static boolean hasPropertyChangeSupport(Class<?> valueType) {
+ @SuppressWarnings("unused")
+ Method method = null;
+ try {
+ try {
+ method = valueType.getMethod("addPropertyChangeListener",
+ new Class[] { String.class,
+ PropertyChangeListener.class });
+ return true;
+ } catch (NoSuchMethodException e) {
+ method = valueType.getMethod("addPropertyChangeListener",
+ new Class[] { PropertyChangeListener.class });
+ return true;
+ }
+ } catch (SecurityException e) {
+ } catch (NoSuchMethodException e) {
+ }
+ return false;
+ }
+
+ /**
+ * Returns an observable list tracking the multi selection of the given
+ * viewer.
+ *
+ * @param notifier
+ * the notifier
+ * @param collectionType
+ * the type contained in the multi selection
+ * @return the i vaadin observable list
+ */
+ public static IVaadinObservableList observeMultiSelectionAsList(
+ Property.ValueChangeNotifier notifier, Class<?> collectionType) {
+ return new SetToListAdapter(observeMultiSelectionAsSet(notifier,
+ collectionType), notifier);
+ }
+
+ /**
+ * Returns an observable set tracking the multi selection of the given
+ * viewer.
+ *
+ * @param notifier
+ * the notifier
+ * @param collectionType
+ * the type contained in the multi selection
+ * @return the i vaadin observable set
+ */
+ public static IVaadinObservableSet observeMultiSelectionAsSet(
+ Property.ValueChangeNotifier notifier, Class<?> collectionType) {
+ return VaadinProperties.propertyMultiSelectionAsSet(collectionType)
+ .observe(notifier);
+ }
+
+ /**
+ * Returns an observable value tracking the value of the given viewer.
+ *
+ * @param notifier
+ * the notifier
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeValue(
+ Property.ValueChangeNotifier notifier) {
+ return VaadinProperties.value().observeVaadinProperty(notifier);
+ }
+
+ /**
+ * Returns an observable value tracking the converted value of the given
+ * field.
+ *
+ * @param field
+ * the field
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeConvertedValue(
+ AbstractField<?> field) {
+ return VaadinProperties.accessor(AbstractField.class, "convertedValue")
+ .observeVaadinProperty(field);
+ }
+
+ /**
+ * Returns an observable value tracking the readonly state of the given
+ * notifier.
+ *
+ * @param notifier
+ * the notifier
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeReadonly(
+ Property.ReadOnlyStatusChangeNotifier notifier) {
+ return VaadinProperties.readonly().observe(notifier);
+ }
+
+ /**
+ * Returns an observable value tracking the focus state of the given
+ * focusable. Note that isFocus() can not be returned. You can only use
+ * setFocus().
+ *
+ * @param focusable
+ * the focusable
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeFocus(Focusable focusable) {
+ return VaadinProperties.focus().observe(focusable);
+ }
+
+ /**
+ * Returns an observable value tracking the caption of the given component.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCaption(Component component) {
+ return VaadinProperties.accessor(Component.class, "caption").observe(
+ component);
+ }
+
+ /**
+ * Returns an observable value tracking the enabled state of the given
+ * widget.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeEnabled(Component component) {
+ return VaadinProperties.accessor(Component.class, "enabled").observe(
+ component);
+ }
+
+ /**
+ * Returns an observable value tracking the enabled state of the given
+ * widget.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDescription(Component component) {
+ return VaadinProperties.description().observe(component);
+ }
+
+ /**
+ * Returns an observable value tracking the icon of the given widget.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeIcon(Component component) {
+ return VaadinProperties.accessor(Component.class, "icon").observe(
+ component);
+ }
+
+ /**
+ * Returns an observable value tracking the primary style name of the given
+ * widget.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observePrimaryStyleName(
+ Component component) {
+ return VaadinProperties.accessor(Component.class, "primaryStyleName")
+ .observe(component);
+ }
+
+ /**
+ * Returns an observable value tracking the styleName of the given widget.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeStyleName(Component component) {
+ return VaadinProperties.accessor(Component.class, "styleName").observe(
+ component);
+ }
+
+ /**
+ * Returns an observable value tracking the visible state of the given
+ * widget.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeVisible(Component component) {
+ return VaadinProperties.accessor(Component.class, "visible").observe(
+ component);
+ }
+
+ /**
+ * Returns an observable value tracking the required state of the given
+ * widget.
+ *
+ * @param field
+ * the field
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRequired(Field<?> field) {
+ return VaadinProperties.accessor(Field.class, "required")
+ .observe(field);
+ }
+
+ /**
+ * Returns an observable value tracking the "required error message" of the
+ * given widget.
+ *
+ * @param field
+ * the field
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRequiredError(Field<?> field) {
+ return VaadinProperties.accessor(Field.class, "requiredError").observe(
+ field);
+ }
+
+ /**
+ * Observe alternate text.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeAlternateText(
+ AbstractEmbedded component) {
+ return VaadinProperties.accessor(AbstractEmbedded.class,
+ "alternateText").observe(component);
+ }
+
+ /**
+ * Observe source.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSource(
+ AbstractEmbedded component) {
+ return VaadinProperties.accessor(AbstractEmbedded.class, "source")
+ .observe(component);
+ }
+
+ /**
+ * Observe item caption mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemCaptionMode(
+ AbstractSelect component) {
+ return VaadinProperties.accessor(AbstractSelect.class,
+ "itemCaptionMode").observe(component);
+ }
+
+ /**
+ * Observe item caption property id.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemCaptionPropertyId(
+ AbstractSelect component) {
+ return VaadinProperties.accessor(AbstractSelect.class,
+ "itemCaptionPropertyId").observe(component);
+ }
+
+ /**
+ * Observe item icon property id.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemIconPropertyId(
+ AbstractSelect component) {
+ return VaadinProperties.accessor(AbstractSelect.class,
+ "itemIconPropertyId").observe(component);
+ }
+
+ /**
+ * Observe multi select mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMultiSelectMode(
+ AbstractSelect component) {
+ return VaadinProperties.accessor(AbstractSelect.class, "multiSelect")
+ .observe(component);
+ }
+
+ /**
+ * Observe new item handler.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNewItemHandler(
+ AbstractSelect component) {
+ return VaadinProperties
+ .accessor(AbstractSelect.class, "newItemHandler").observe(
+ component);
+ }
+
+ /**
+ * Observe new items allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNewItemsAllowed(
+ AbstractSelect component) {
+ return VaadinProperties.accessor(AbstractSelect.class,
+ "newItemsAllowed").observe(component);
+ }
+
+ /**
+ * Observe null selection allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNullSelectionAllowed(
+ AbstractSelect component) {
+ return VaadinProperties.accessor(AbstractSelect.class,
+ "nullSelectionAllowed").observe(component);
+ }
+
+ /**
+ * Observe buffered.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeBuffered(Buffered component) {
+ return VaadinProperties.accessor(Buffered.class, "buffered").observe(
+ component);
+ }
+
+ /**
+ * Observe invalid committed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeInvalidCommitted(
+ BufferedValidatable component) {
+ return VaadinProperties.accessor(Buffered.class, "invalidCommitted")
+ .observe(component);
+ }
+
+ /**
+ * Observe invalid committed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeInvalidCommitted(
+ ComboBox component) {
+ return VaadinProperties.accessor(ComboBox.class, "pageLength").observe(
+ component);
+ }
+
+ /**
+ * Observe scroll to selected item.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeScrollToSelectedItem(
+ ComboBox component) {
+ return VaadinProperties
+ .accessor(ComboBox.class, "scrollToSelectedItem").observe(
+ component);
+ }
+
+ /**
+ * Observe text input allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTextInputAllowed(
+ ComboBox component) {
+ return VaadinProperties.accessor(ComboBox.class, "textInputAllowed")
+ .observe(component);
+ }
+
+ /**
+ * Observe template contents.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTemplateContents(
+ CustomLayout component) {
+ return VaadinProperties
+ .accessor(CustomLayout.class, "templateContents").observe(
+ component);
+ }
+
+ /**
+ * Observe template name property.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTemplateNameProperty(
+ CustomLayout component) {
+ return VaadinProperties.accessor(CustomLayout.class,
+ "templateNameProperty").observe(component);
+ }
+
+ /**
+ * Observe date format.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDateFormat(DateField component) {
+ return VaadinProperties.accessor(DateField.class, "dateFormat")
+ .observe(component);
+ }
+
+ /**
+ * Observe lenient.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeLenient(DateField component) {
+ return VaadinProperties.accessor(DateField.class, "lenient").observe(
+ component);
+ }
+
+ /**
+ * Observe parse error message.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeParseErrorMessage(
+ DateField component) {
+ return VaadinProperties.accessor(DateField.class, "parseErrorMessage")
+ .observe(component);
+ }
+
+ /**
+ * Observe resolution.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeResolution(DateField component) {
+ return VaadinProperties.accessor(DateField.class, "resolution")
+ .observe(component);
+ }
+
+ /**
+ * Observe show iso week numbers.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeShowISOWeekNumbers(
+ DateField component) {
+ return VaadinProperties.accessor(DateField.class, "showISOWeekNumbers")
+ .observe(component);
+ }
+
+ /**
+ * Observe text field enabled.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTextFieldEnabled(
+ DateField component) {
+ return VaadinProperties.accessor(DateField.class, "textFieldEnabled")
+ .observe(component);
+ }
+
+ /**
+ * Observe time zone.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTimeZone(DateField component) {
+ return VaadinProperties.accessor(DateField.class, "timeZone").observe(
+ component);
+ }
+
+ /**
+ * Observe validation visible.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeValidationVisible(
+ AbstractField<?> component) {
+ return VaadinProperties.accessor(AbstractField.class,
+ "validationVisible").observe(component);
+ }
+
+ /**
+ * Observe columns.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumns(GridLayout component) {
+ return VaadinProperties.accessor(GridLayout.class, "columns").observe(
+ component);
+ }
+
+ /**
+ * Observe cursor x.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCursorX(GridLayout component) {
+ return VaadinProperties.accessor(GridLayout.class, "cursorX").observe(
+ component);
+ }
+
+ /**
+ * Observe cursor y.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCursorY(GridLayout component) {
+ return VaadinProperties.accessor(GridLayout.class, "cursorY").observe(
+ component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(GridLayout component) {
+ return VaadinProperties.accessor(GridLayout.class, "rows").observe(
+ component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(ListSelect component) {
+ return VaadinProperties.accessor(ListSelect.class, "rows").observe(
+ component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(MarginHandler component) {
+ return VaadinProperties.accessor(MarginHandler.class, "marginInfo")
+ .observe(component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(OptionGroup component) {
+ return VaadinProperties.accessor(OptionGroup.class,
+ "htmlContentAllowed").observe(component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(PopupDateField component) {
+ return VaadinProperties.accessor(PopupDateField.class, "inputPrompt")
+ .observe(component);
+ }
+
+ /**
+ * Observe text field enabled.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTextFieldEnabled(
+ PopupDateField component) {
+ return VaadinProperties.accessor(PopupDateField.class,
+ "textFieldEnabled").observe(component);
+ }
+
+ /**
+ * Observe height.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeHeight(Sizeable component) {
+ return VaadinProperties.height().observe(component);
+ }
+
+ /**
+ * Observe width.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeWidth(Sizeable component) {
+ return VaadinProperties.width().observe(component);
+ }
+
+ /**
+ * Observe spacing.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSpacing(SpacingHandler component) {
+ return VaadinProperties.accessor(SpacingHandler.class, "spacing")
+ .observe(component);
+ }
+
+ /**
+ * Observe first component.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeFirstComponent(
+ AbstractSplitPanel component) {
+ return VaadinProperties.accessor(AbstractSplitPanel.class,
+ "firstComponent").observe(component);
+ }
+
+ /**
+ * Observe locked.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeLocked(
+ AbstractSplitPanel component) {
+ return VaadinProperties.accessor(AbstractSplitPanel.class, "locked")
+ .observe(component);
+ }
+
+ /**
+ * Observe max split position.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMaxSplitPosition(
+ AbstractSplitPanel component) {
+ return VaadinProperties.maxSplitPosition().observe(component);
+ }
+
+ /**
+ * Observe max split position unit.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMaxSplitPositionUnit(
+ AbstractSplitPanel component) {
+ return VaadinProperties.maxSplitPositionUnit().observe(component);
+ }
+
+ /**
+ * Observe min split position.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMinSplitPosition(
+ AbstractSplitPanel component) {
+ return VaadinProperties.minSplitPosition().observe(component);
+ }
+
+ /**
+ * Observe min split position unit.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMinSplitPositionUnit(
+ AbstractSplitPanel component) {
+ return VaadinProperties.minSplitPositionUnit().observe(component);
+ }
+
+ /**
+ * Observe split position.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSplitPosition(
+ AbstractSplitPanel component) {
+ return VaadinProperties.splitPosition().observe(component);
+ }
+
+ /**
+ * Observe split position unit.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSplitPositionUnit(
+ AbstractSplitPanel component) {
+ return VaadinProperties.splitPositionUnit().observe(component);
+ }
+
+ /**
+ * Observe secon component.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSeconComponent(
+ AbstractSplitPanel component) {
+ return VaadinProperties.accessor(AbstractSplitPanel.class,
+ "secondComponent").observe(component);
+ }
+
+ /**
+ * Observe cache.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCache(Table component) {
+ return VaadinProperties.accessor(Table.class, "cache").observe(
+ component);
+ }
+
+ /**
+ * Observe cell style generator.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCellStyleGenerator(
+ Table component) {
+ return VaadinProperties.accessor(Table.class, "cellStyleGenerator")
+ .observe(component);
+ }
+
+ /**
+ * Observe column alignments.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumnAlignments(Table component) {
+ return VaadinProperties.accessor(Table.class, "columnAlignments")
+ .observe(component);
+ }
+
+ /**
+ * Observe column collapsing allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumnCollapsingAllowed(
+ Table component) {
+ return VaadinProperties
+ .accessor(Table.class, "columnCollapsingAllowed").observe(
+ component);
+ }
+
+ /**
+ * Observe column header mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumnHeaderMode(Table component) {
+ return VaadinProperties.accessor(Table.class, "columnHeaderMode")
+ .observe(component);
+ }
+
+ /**
+ * Observe column headers.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumnHeaders(Table component) {
+ return VaadinProperties.accessor(Table.class, "columnHeaders").observe(
+ component);
+ }
+
+ /**
+ * Observe column icons.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumnIcons(Table component) {
+ return VaadinProperties.accessor(Table.class, "columnIcons").observe(
+ component);
+ }
+
+ /**
+ * Observe column reordering allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumnReorderingAllowed(
+ Table component) {
+ return VaadinProperties
+ .accessor(Table.class, "columnReorderingAllowed").observe(
+ component);
+ }
+
+ /**
+ * Observe current page first item id.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCurrentPageFirstItemId(
+ Table component) {
+ return VaadinProperties.accessor(Table.class, "currentPageFirstItemId")
+ .observe(component);
+ }
+
+ /**
+ * Observe current page first item index.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCurrentPageFirstItemIndex(
+ Table component) {
+ return VaadinProperties.accessor(Table.class,
+ "currentPageFirstItemIndex").observe(component);
+ }
+
+ /**
+ * Observe drop handler.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDropHandler(Table component) {
+ return VaadinProperties.accessor(Table.class, "dropHandler").observe(
+ component);
+ }
+
+ /**
+ * Observe drag mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDragMode(Table component) {
+ return VaadinProperties.accessor(Table.class, "dragMode").observe(
+ component);
+ }
+
+ /**
+ * Observe editable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeEditable(Table component) {
+ return VaadinProperties.accessor(Table.class, "editable").observe(
+ component);
+ }
+
+ /**
+ * Observe table field factory.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTableFieldFactory(
+ Table component) {
+ return VaadinProperties.accessor(Table.class, "tableFieldFactory")
+ .observe(component);
+ }
+
+ /**
+ * Observe footer visible.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeFooterVisible(Table component) {
+ return VaadinProperties.accessor(Table.class, "footerVisible").observe(
+ component);
+ }
+
+ /**
+ * Observe item description generator.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemDescriptionGenerator(
+ Table component) {
+ return VaadinProperties.accessor(Table.class,
+ "itemDescriptionGenerator").observe(component);
+ }
+
+ /**
+ * Observe multi select mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMultiSelectMode(Table component) {
+ return VaadinProperties.accessor(Table.class, "multiSelectMode")
+ .observe(component);
+ }
+
+ /**
+ * Observe row generator.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRowGenerator(Table component) {
+ return VaadinProperties.accessor(Table.class, "rowGenerator").observe(
+ component);
+ }
+
+ /**
+ * Observe row header mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRowHeaderMode(Table component) {
+ return VaadinProperties.accessor(Table.class, "rowHeaderMode").observe(
+ component);
+ }
+
+ /**
+ * Observe selectable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSelectable(Table component) {
+ return VaadinProperties.accessor(Table.class, "selectable").observe(
+ component);
+ }
+
+ /**
+ * Observe sort ascending.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSortAscending(Table component) {
+ return VaadinProperties.accessor(Table.class, "sortAscending").observe(
+ component);
+ }
+
+ /**
+ * Observe sort container property id.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSortContainerPropertyId(
+ Table component) {
+ return VaadinProperties
+ .accessor(Table.class, "sortContainerPropertyId").observe(
+ component);
+ }
+
+ /**
+ * Observe sort enabled.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSortEnabled(Table component) {
+ return VaadinProperties.accessor(Table.class, "sortEnabled").observe(
+ component);
+ }
+
+ /**
+ * Observe visible.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeVisible(Table component) {
+ return VaadinProperties.accessor(Table.class, "visible").observe(
+ component);
+ }
+
+ /**
+ * Observe selected tab.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSelectedTab(TabSheet component) {
+ return VaadinProperties.selectedTab().observe(component);
+ }
+
+ /**
+ * Observe tab index.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTabIndex(TabSheet component) {
+ return VaadinProperties.accessor(TabSheet.class, "tabIndex").observe(
+ component);
+ }
+
+ /**
+ * Observe tab caption.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTabCaption(Tab component) {
+ return VaadinProperties.accessor(Tab.class, "caption").observe(
+ component);
+ }
+
+ /**
+ * Observe tab description.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTabDescription(Tab component) {
+ return VaadinProperties.accessor(Tab.class, "description").observe(
+ component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(TextArea component) {
+ return VaadinProperties.accessor(TextArea.class, "rows").observe(
+ component);
+ }
+
+ /**
+ * Observe word wrap.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeWordWrap(TextArea component) {
+ return VaadinProperties.accessor(TextArea.class, "wordWrap").observe(
+ component);
+ }
+
+ /**
+ * Observe text change event mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTextChangeEventMode(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class,
+ "textChangeEventMode").observe(component);
+ }
+
+ /**
+ * Observe text change timeout.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTextChangeTimeout(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class,
+ "textChangeTimeout").observe(component);
+ }
+
+ /**
+ * Observe columns.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColumns(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class, "columns")
+ .observe(component);
+ }
+
+ /**
+ * Observe cursor position.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCursorPosition(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class,
+ "cursorPosition").observe(component);
+ }
+
+ /**
+ * Observe input prompt.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeInputPrompt(
+ AbstractTextField component) {
+ return VaadinProperties
+ .accessor(AbstractTextField.class, "inputPrompt").observe(
+ component);
+ }
+
+ /**
+ * Observe max length.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMaxLength(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class, "maxLength")
+ .observe(component);
+ }
+
+ /**
+ * Observe null representation.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNullRepresentation(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class,
+ "nullRepresentation").observe(component);
+ }
+
+ /**
+ * Observe null setting allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNullSettingAllowed(
+ AbstractTextField component) {
+ return VaadinProperties.accessor(AbstractTextField.class,
+ "nullSettingAllowed").observe(component);
+ }
+
+ /**
+ * Observe drag mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDragMode(Tree component) {
+ return VaadinProperties.accessor(Tree.class, "dragMode").observe(
+ component);
+ }
+
+ /**
+ * Observe drop handler.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDropHandler(Tree component) {
+ return VaadinProperties.accessor(Tree.class, "dropHandler").observe(
+ component);
+ }
+
+ /**
+ * Observe item description generator.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemDescriptionGenerator(
+ Tree component) {
+ return VaadinProperties
+ .accessor(Tree.class, "itemDescriptionGenerator").observe(
+ component);
+ }
+
+ /**
+ * Observe item style generator.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeItemStyleGenerator(
+ Tree component) {
+ return VaadinProperties.accessor(Tree.class, "itemStyleGenerator")
+ .observe(component);
+ }
+
+ /**
+ * Observe multi select mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMultiSelectMode(Tree component) {
+ return VaadinProperties.accessor(Tree.class, "multiSelectMode")
+ .observe(component);
+ }
+
+ /**
+ * Observe selectable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSelectable(Tree component) {
+ return VaadinProperties.accessor(Tree.class, "selectable").observe(
+ component);
+ }
+
+ /**
+ * Observe selectable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSelectable(TreeTable component) {
+ return VaadinProperties.accessor(TreeTable.class, "animationsEnabled")
+ .observe(component);
+ }
+
+ /**
+ * Observe hierachy column id.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeHierachyColumnId(
+ TreeTable component) {
+ return VaadinProperties.accessor(TreeTable.class, "hierachyColumnId")
+ .observe(component);
+ }
+
+ /**
+ * Observe rows.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRows(TwinColSelect component) {
+ return VaadinProperties.accessor(TwinColSelect.class, "rows").observe(
+ component);
+ }
+
+ /**
+ * Observe left column caption.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeLeftColumnCaption(
+ TwinColSelect component) {
+ return VaadinProperties.accessor(TwinColSelect.class,
+ "leftColumnCaption").observe(component);
+ }
+
+ /**
+ * Observe right column caption.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeRightColumnCaption(
+ TwinColSelect component) {
+ return VaadinProperties.accessor(TwinColSelect.class,
+ "rightColumnCaption").observe(component);
+ }
+
+ /**
+ * Observe invalid allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeInvalidAllowed(
+ Validatable component) {
+ return VaadinProperties.accessor(Validatable.class, "invalidAllowed")
+ .observe(component);
+ }
+
+ /**
+ * Observe indeterminate.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeIndeterminate(
+ ProgressIndicator component) {
+ return VaadinProperties.accessor(ProgressIndicator.class,
+ "indeterminate").observe(component);
+ }
+
+ /**
+ * Observe polling interval.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observePollingInterval(
+ ProgressIndicator component) {
+ return VaadinProperties.accessor(ProgressIndicator.class,
+ "pollingInterval").observe(component);
+ }
+
+ /**
+ * Observe null representation.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNullRepresentation(
+ RichTextArea component) {
+ return VaadinProperties.accessor(RichTextArea.class,
+ "nullRepresentation").observe(component);
+ }
+
+ /**
+ * Observe null setting allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNullSettingAllowed(
+ RichTextArea component) {
+ return VaadinProperties.accessor(RichTextArea.class,
+ "nullSettingAllowed").observe(component);
+ }
+
+ /**
+ * Observe max.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMax(Slider component) {
+ return VaadinProperties.accessor(Slider.class, "max")
+ .observe(component);
+ }
+
+ /**
+ * Observe min.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMin(Slider component) {
+ return VaadinProperties.accessor(Slider.class, "min")
+ .observe(component);
+ }
+
+ /**
+ * Observe orientation.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeOrientation(Slider component) {
+ return VaadinProperties.accessor(Slider.class, "orientation").observe(
+ component);
+ }
+
+ /**
+ * Observe resolution.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeResolution(Slider component) {
+ return VaadinProperties.accessor(Slider.class, "resolution").observe(
+ component);
+ }
+
+ /**
+ * Observe alt text.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeAltText(AbstractMedia component) {
+ return VaadinProperties.accessor(AbstractMedia.class, "altText")
+ .observe(component);
+ }
+
+ /**
+ * Observe autoplay.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeAutoplay(AbstractMedia component) {
+ return VaadinProperties.accessor(AbstractMedia.class, "autoplay")
+ .observe(component);
+ }
+
+ /**
+ * Observe html content allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeHtmlContentAllowed(
+ AbstractMedia component) {
+ return VaadinProperties.accessor(AbstractMedia.class,
+ "htmlContentAllowed").observe(component);
+ }
+
+ /**
+ * Observe muted.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMuted(AbstractMedia component) {
+ return VaadinProperties.accessor(AbstractMedia.class, "muted").observe(
+ component);
+ }
+
+ /**
+ * Observe show controls.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeShowControls(
+ AbstractMedia component) {
+ return VaadinProperties.accessor(AbstractMedia.class, "showControls")
+ .observe(component);
+ }
+
+ /**
+ * Observe poster.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observePoster(Video component) {
+ return VaadinProperties.accessor(Video.class, "poster").observe(
+ component);
+ }
+
+ /**
+ * Observe scroll left.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeScrollLeft(Scrollable component) {
+ return VaadinProperties.accessor(Scrollable.class, "scrollLeft")
+ .observe(component);
+ }
+
+ /**
+ * Observe scroll top.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeScrollTop(Scrollable component) {
+ return VaadinProperties.accessor(Scrollable.class, "scrollTop")
+ .observe(component);
+ }
+
+ /**
+ * Observe closable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeClosable(Window component) {
+ return VaadinProperties.accessor(Window.class, "closable").observe(
+ component);
+ }
+
+ /**
+ * Observe scroll top.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeScrollTop(Window component) {
+ return VaadinProperties.accessor(Window.class, "scrollTop").observe(
+ component);
+ }
+
+ /**
+ * Observe draggable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDraggable(Window component) {
+ return VaadinProperties.accessor(Window.class, "draggable").observe(
+ component);
+ }
+
+ /**
+ * Observe modal.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeModal(Window component) {
+ return VaadinProperties.accessor(Window.class, "modal").observe(
+ component);
+ }
+
+ /**
+ * Observe resizeable.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeResizeable(Window component) {
+ return VaadinProperties.accessor(Window.class, "resizable").observe(
+ component);
+ }
+
+ /**
+ * Observe resize lazy.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeResizeLazy(Window component) {
+ return VaadinProperties.accessor(Window.class, "resizeLazy").observe(
+ component);
+ }
+
+ /**
+ * Observe position x.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observePositionX(Window component) {
+ return VaadinProperties.accessor(Window.class, "positionX").observe(
+ component);
+ }
+
+ /**
+ * Observe position y.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observePositionY(Window component) {
+ return VaadinProperties.accessor(Window.class, "positionY").observe(
+ component);
+ }
+
+ /**
+ * Observe color.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColor(ColorSelector component) {
+ return VaadinProperties.accessor(ColorSelector.class, "color").observe(
+ component);
+ }
+
+ /**
+ * Observe content.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeContent(
+ SingleComponentContainer component) {
+ return VaadinProperties.accessor(SingleComponentContainer.class,
+ "content").observe(component);
+ }
+
+ /**
+ * Observe last heartbeat timestamp.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeLastHeartbeatTimestamp(
+ UI component) {
+ return VaadinProperties.accessor(UI.class, "lastHeartbeatTimestamp")
+ .observe(component);
+ }
+
+ /**
+ * Observe navigator.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeNavigator(UI component) {
+ return VaadinProperties.accessor(UI.class, "navigator").observe(
+ component);
+ }
+
+ /**
+ * Observe resize lazy.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeResizeLazy(UI component) {
+ return VaadinProperties.accessor(UI.class, "resizeLazy").observe(
+ component);
+ }
+
+ /**
+ * Observe scroll left.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeScrollLeft(UI component) {
+ return VaadinProperties.accessor(UI.class, "scrollLeft").observe(
+ component);
+ }
+
+ /**
+ * Observe scroll top.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeScrollTop(UI component) {
+ return VaadinProperties.accessor(UI.class, "scrollTop").observe(
+ component);
+ }
+
+ /**
+ * Observe session.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSession(UI component) {
+ return VaadinProperties.accessor(UI.class, "session")
+ .observe(component);
+ }
+
+ /**
+ * Observe disable on click.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeDisableOnClick(Button component) {
+ return VaadinProperties.accessor(Button.class, "disableOnClick")
+ .observe(component);
+ }
+
+ /**
+ * Observe html content allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeHtmlContentAllowed(
+ Button component) {
+ return VaadinProperties.accessor(Button.class, "htmlContentAllowed")
+ .observe(component);
+ }
+
+ /**
+ * Observe color.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColor(
+ ColorPickerGradient component) {
+ return VaadinProperties.colorColorPickerGradient().observe(component);
+ }
+
+ /**
+ * Observe color.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColor(ColorPickerGrid component) {
+ return VaadinProperties.colorColorPickerGrid().observe(component);
+ }
+
+ /**
+ * Observe color.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColor(
+ ColorPickerHistory component) {
+ return VaadinProperties.colorColorPickerHistory().observe(component);
+ }
+
+ /**
+ * Observe color.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeColor(
+ ColorPickerSelect component) {
+ return VaadinProperties.colorColorPickerSelect().observe(component);
+ }
+
+ /**
+ * Observe alternate text.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeAlternateText(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "alternateText")
+ .observe(component);
+ }
+
+ /**
+ * Observe archive.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeArchive(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "archive").observe(
+ component);
+ }
+
+ /**
+ * Observe class id.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeClassId(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "classId").observe(
+ component);
+ }
+
+ /**
+ * Observe codebase.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCodebase(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "codebase").observe(
+ component);
+ }
+
+ /**
+ * Observe codetype.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeCodetype(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "codetype").observe(
+ component);
+ }
+
+ /**
+ * Observe mime type.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMimeType(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "mimeType").observe(
+ component);
+ }
+
+ /**
+ * Observe source.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeSource(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "source").observe(
+ component);
+ }
+
+ /**
+ * Observe standby.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeStandby(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "standby").observe(
+ component);
+ }
+
+ /**
+ * Observe type.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeType(Embedded component) {
+ return VaadinProperties.accessor(Embedded.class, "type").observe(
+ component);
+ }
+
+ /**
+ * Observe content mode.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeContentMode(Label component) {
+ return VaadinProperties.accessor(Label.class, "contentMode").observe(
+ component);
+ }
+
+ /**
+ * Observe converter.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeConverter(Label component) {
+ return VaadinProperties.accessor(Label.class, "converter").observe(
+ component);
+ }
+
+ /**
+ * Observe resource.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeResource(Link component) {
+ return VaadinProperties.accessor(Link.class, "resource").observe(
+ component);
+ }
+
+ /**
+ * Observe target border.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTargetBorder(Link component) {
+ return VaadinProperties.accessor(Link.class, "targetBorder").observe(
+ component);
+ }
+
+ /**
+ * Observe target height.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTargetHeight(Link component) {
+ return VaadinProperties.accessor(Link.class, "targetHeight").observe(
+ component);
+ }
+
+ /**
+ * Observe target name.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTargetName(Link component) {
+ return VaadinProperties.accessor(Link.class, "targetName").observe(
+ component);
+ }
+
+ /**
+ * Observe target width.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeTargetWidth(Link component) {
+ return VaadinProperties.accessor(Link.class, "targetWidth").observe(
+ component);
+ }
+
+ /**
+ * Observe auto open.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeAutoOpen(MenuBar component) {
+ return VaadinProperties.accessor(MenuBar.class, "autoOpen").observe(
+ component);
+ }
+
+ /**
+ * Observe html content allowed.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeHtmlContentAllowed(
+ MenuBar component) {
+ return VaadinProperties.accessor(MenuBar.class, "htmlContentAllowed")
+ .observe(component);
+ }
+
+ /**
+ * Observe more menu item.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeMoreMenuItem(MenuBar component) {
+ return VaadinProperties.accessor(MenuBar.class, "moreMenuItem")
+ .observe(component);
+ }
+
+ /**
+ * Observe content.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeContent(PopupView component) {
+ return VaadinProperties.accessor(PopupView.class, "content").observe(
+ component);
+ }
+
+ /**
+ * Observe hide on mouse out.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeHideOnMouseOut(
+ PopupView component) {
+ return VaadinProperties.accessor(PopupView.class, "hideOnMouseOut")
+ .observe(component);
+ }
+
+ /**
+ * Observe popup visible.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observePopupVisible(PopupView component) {
+ return VaadinProperties.accessor(PopupView.class, "popupVisible")
+ .observe(component);
+ }
+
+ /**
+ * Button clicks will send the current activation time in ms as Long-value
+ * to the receiver. So the type is long.
+ *
+ * @param button
+ * the button
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeButtonClick(Button button) {
+ return VaadinProperties.buttonClick().observe(button);
+ }
+
+ /**
+ * Observe button caption.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeButtonCaption(Upload component) {
+ return VaadinProperties.accessor(PopupView.class, "buttonCaption")
+ .observe(component);
+ }
+
+ /**
+ * Observe receiver.
+ *
+ * @param component
+ * the component
+ * @return the i vaadin observable value
+ */
+ public static IVaadinObservableValue observeReceiver(Upload component) {
+ return VaadinProperties.accessor(PopupView.class, "receiver").observe(
+ component);
+ }
+
+ /**
+ * The Class UIRealm.
+ */
+ private static class UIRealm extends Realm {
+
+ /** The ui. */
+ private final UI ui;
+
+ /** The auto synchronize. */
+ private boolean autoSynchronize;
+
+ /**
+ * Instantiates a new UI realm.
+ *
+ * @param ui
+ * the ui
+ * @param autoSynchronize
+ * the auto synchronize
+ */
+ private UIRealm(UI ui, boolean autoSynchronize) {
+ this.ui = ui;
+ this.autoSynchronize = autoSynchronize;
+ setDefault(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.Realm#isCurrent()
+ */
+ @Override
+ public boolean isCurrent() {
+ return UI.getCurrent() == ui;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.Realm#exec(java.lang.Runnable)
+ */
+ public void exec(Runnable runnable) {
+ if (isCurrent()) {
+ ui.accessSynchronously(runnable);
+ } else {
+ asyncExec(runnable);
+ }
+ }
+
+ /**
+ * Checks if is http thread.
+ *
+ * @return true, if is http thread
+ */
+ private boolean isHttpThread() {
+ return VaadinService.getCurrentRequest() != null;
+ }
+
+ /**
+ * Makes the realm to the thread default.
+ */
+ public void makeDefault() {
+ setDefault(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.Realm#asyncExec(java.lang.Runnable)
+ */
+ @Override
+ public void asyncExec(final Runnable runnable) {
+ if(autoSynchronize){
+ ui.access(runnable);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.Realm#timerExec(int, java.lang.Runnable)
+ */
+ @Override
+ public void timerExec(int milliseconds, final Runnable runnable) {
+ throw new UnsupportedOperationException("Not a valid call!");
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return (ui == null) ? 0 : ui.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final UIRealm other = (UIRealm) obj;
+ if (ui == null) {
+ if (other.ui != null) {
+ return false;
+ }
+ } else if (!ui.equals(other.ui)) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinProperties.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinProperties.java
new file mode 100644
index 0000000..6459407
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/VaadinProperties.java
@@ -0,0 +1,389 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ButtonClickProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerGradientColorProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerGridColorProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerHistoryColorProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ColorPickerSelectColorProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentDescriptionProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentFocusedProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SimpleAccessorProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SizeableHeightProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SizeableWidthProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMaxSplitPositionProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMaxSplitPositionUnitProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMinSplitPositionProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelMinSplitPositionUnitProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelSplitPositionProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.SplitPanelSplitPositionUnitProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.TabSheetSelectedTabProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ContainerItemSetContentProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.GridSelectionSetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.GridSelectionValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ItemPropertySetInfoValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ItemPropertySetValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.MultiSelectionListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.MultiSelectionSetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.PropertyReadonlyProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.PropertyValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.SingleSelectionProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ViewerContainerDatasourceProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ViewerItemDatasourceProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ViewerPropertyDatasourceProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinSetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.VaadinListPropertyDecorator;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.VaadinSetPropertyDecorator;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.ui.AbstractSplitPanel;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Field;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.components.colorpicker.ColorPickerGradient;
+import com.vaadin.ui.components.colorpicker.ColorPickerGrid;
+import com.vaadin.ui.components.colorpicker.ColorPickerHistory;
+import com.vaadin.ui.components.colorpicker.ColorPickerSelect;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A factory for creating properties of SWT {@link Component components}.
+ *
+ * @since 1.3
+ */
+public class VaadinProperties {
+
+ /**
+ * Returns a property that handles the attribute defined by the given
+ * property.
+ *
+ * @param componentClass
+ * the component class
+ * @param property
+ * the property
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty accessor(Class<?> componentClass,
+ String property) {
+ return new SimpleAccessorProperty(componentClass, property);
+ }
+
+ /**
+ * Returns a property that handles the focus for {@link Field fields}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty focus() {
+ return new ComponentFocusedProperty();
+ }
+
+ /**
+ * Returns a property that observes a button click.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty buttonClick() {
+ return new ButtonClickProperty();
+ }
+
+ /**
+ * Returns a property that handles the description attribute of components.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty description() {
+ return new ComponentDescriptionProperty();
+ }
+
+ /**
+ * Returns a property that handles the max split position for the
+ * {@link AbstractSplitPanel}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty maxSplitPosition() {
+ return new SplitPanelMaxSplitPositionProperty();
+ }
+
+ /**
+ * Returns a property that handles the unit of the maximum split position
+ * for the {@link AbstractSplitPanel}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty maxSplitPositionUnit() {
+ return new SplitPanelMaxSplitPositionUnitProperty();
+ }
+
+ /**
+ * Returns a property that handles the minimal split position for the
+ * {@link AbstractSplitPanel}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty minSplitPosition() {
+ return new SplitPanelMinSplitPositionProperty();
+ }
+
+ /**
+ * Returns a property that handles the unit of the minimal split position
+ * for the {@link AbstractSplitPanel}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty minSplitPositionUnit() {
+ return new SplitPanelMinSplitPositionUnitProperty();
+ }
+
+ /**
+ * Returns a property that handles the split position for the
+ * {@link AbstractSplitPanel}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty splitPosition() {
+ return new SplitPanelSplitPositionProperty();
+ }
+
+ /**
+ * Returns a property that handles the unit of the split position for the
+ * {@link AbstractSplitPanel}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty splitPositionUnit() {
+ return new SplitPanelSplitPositionUnitProperty();
+ }
+
+ /**
+ * Returns a property that handles the selected tab of {@link TabSheet}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty selectedTab() {
+ return new TabSheetSelectedTabProperty();
+ }
+
+ /**
+ * Returns a property that handles the color attribute of the
+ * {@link ColorPickerGradient}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty colorColorPickerGradient() {
+ return new ColorPickerGradientColorProperty();
+ }
+
+ /**
+ * Returns a property that handles the color attribute of the
+ * {@link ColorPickerGrid}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty colorColorPickerGrid() {
+ return new ColorPickerGridColorProperty();
+ }
+
+ /**
+ * Returns a property that handles the color attribute of the
+ * {@link ColorPickerHistory}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty colorColorPickerHistory() {
+ return new ColorPickerHistoryColorProperty();
+ }
+
+ /**
+ * Returns a property that handles the color attribute of a
+ * {@link ColorPickerSelect}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty colorColorPickerSelect() {
+ return new ColorPickerSelectColorProperty();
+ }
+
+ /**
+ * Returns a property that handles the height attribute.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty height() {
+ return new SizeableHeightProperty();
+ }
+
+ /**
+ * Returns a property that handles the width attribute.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty width() {
+ return new SizeableWidthProperty();
+ }
+
+ /**
+ * TODO change to observableList.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty itemPropertysetValue() {
+ return new ItemPropertySetValueProperty();
+ }
+
+ /**
+ * TODO.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty itemPropertysetInfoValue() {
+ return new ItemPropertySetInfoValueProperty();
+ }
+
+ /**
+ * Creates a list property that observes changes of multi selections. The
+ * sort order of the list random since vaadin selects handle the selections
+ * in a set. So the list is just a wrapper for the set.
+ *
+ * @param collectionType
+ * the types contained in the collection
+ * @return listProperty
+ */
+ public static IVaadinListProperty propertyMultiSelectionAsList(
+ Class<?> collectionType) {
+ MultiSelectionListProperty property = new MultiSelectionListProperty(
+ collectionType);
+ return new VaadinListPropertyDecorator(property);
+ }
+
+ /**
+ * Creates a set property that observes changes of multi selections.
+ *
+ * @param collectionType
+ * the types contained in the collection
+ * @return setProperty
+ */
+ public static IVaadinSetProperty propertyMultiSelectionAsSet(
+ Class<?> collectionType) {
+ MultiSelectionSetProperty property = new MultiSelectionSetProperty(
+ collectionType);
+ return new VaadinSetPropertyDecorator(property);
+ }
+
+ /**
+ * Creates a set property that observes changes of multi selections of Grid
+ * component. Grid.SelectionModel#SINGLE and #MULTI are supported.
+ *
+ * @param collectionType
+ * the types contained in the collection
+ * @return setProperty
+ */
+ public static IVaadinSetProperty propertyGridSelectionSetPropertyAsSet(
+ Class<?> collectionType) {
+ GridSelectionSetProperty property = new GridSelectionSetProperty(
+ collectionType);
+ return property;
+ }
+
+ /**
+ * Creates a value property that observes changes of single selections of
+ * Grid component. Grid.SelectionModel#SINGLE and #MULTI are supported.
+ *
+ * @param valueType
+ * the type of the value
+ * @return valueProperty
+ */
+ public static IVaadinValueProperty propertyGridSelectionValueProperty(
+ Class<?> valueType) {
+ GridSelectionValueProperty property = new GridSelectionValueProperty(
+ valueType);
+ return property;
+ }
+
+ /**
+ * Creates a list property that observes changes of item sets in container.
+ *
+ * @param collectionType
+ * the types contained in the collection
+ * @return listProperty
+ */
+ public static IVaadinListProperty containerItemsetAsList(
+ Class<?> collectionType) {
+ ContainerItemSetContentProperty property = new ContainerItemSetContentProperty(
+ collectionType);
+ return new VaadinListPropertyDecorator(property);
+ }
+
+ /**
+ * Returns a property that handles the containerDatasource attribute of
+ * {@link Container.Viewer}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty containerDatasource() {
+ return new ViewerContainerDatasourceProperty();
+ }
+
+ /**
+ * Returns a property that handles the itemDatasource attribute of
+ * {@link Item.Viewer}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty itemDatasource() {
+ return new ViewerItemDatasourceProperty();
+ }
+
+ /**
+ * Returns a property that handles the propertyDatasource attribute of
+ * {@link Property.Viewer}.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty datasource() {
+ return new ViewerPropertyDatasourceProperty();
+ }
+
+ /**
+ * Returns a property that handles the value attribute.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty value() {
+ return new PropertyValueProperty();
+ }
+
+ /**
+ * Returns a property that handles single selections.
+ *
+ * @param type
+ * the type
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty singleSelection(Class<?> type) {
+ return new SingleSelectionProperty(type);
+ }
+
+ /**
+ * Returns a property that handles the readonly attribute.
+ *
+ * @return the i vaadin value property
+ */
+ public static IVaadinValueProperty readonly() {
+ return new PropertyReadonlyProperty();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ButtonClickProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ButtonClickProperty.java
new file mode 100644
index 0000000..f215c0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ButtonClickProperty.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal.ButtonClickListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.ui.Button;
+
+/**
+ * Button click property uses the current Date#time value to represent the last
+ * time a button was clicked. Using the boolean would not meet the objectives.
+ */
+public class ButtonClickProperty extends AbstractVaadinValueProperty {
+
+ private ButtonClickListener clickListener;
+
+ public String toString() {
+ return "ButtonClickProperty"; //$NON-NLS-1$
+ }
+
+ public ButtonClickProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Long.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ return clickListener.getLastActivation();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ Button component = (Button) source;
+ component.click();
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ clickListener = new ButtonClickListener(this, listener);
+ return clickListener;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGradientColorProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGradientColorProperty.java
new file mode 100644
index 0000000..cbc8c3b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGradientColorProperty.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
+import com.vaadin.ui.components.colorpicker.ColorPickerGradient;
+
+/**
+ */
+public class ColorPickerGradientColorProperty extends
+ AbstractVaadinValueProperty {
+
+ public ColorPickerGradientColorProperty() {
+ super(ColorChangeEvent.class);
+ }
+
+ public Object getValueType() {
+ return Color.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ ColorPickerGradient component = (ColorPickerGradient) source;
+ return component.getColor();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ ColorPickerGradient component = (ColorPickerGradient) source;
+ component.setColor((Color) value);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGridColorProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGridColorProperty.java
new file mode 100644
index 0000000..036b41b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerGridColorProperty.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
+import com.vaadin.ui.components.colorpicker.ColorPickerGrid;
+
+/**
+ */
+public class ColorPickerGridColorProperty extends AbstractVaadinValueProperty {
+
+ public ColorPickerGridColorProperty() {
+ super(ColorChangeEvent.class);
+ }
+
+ public Object getValueType() {
+ return Color.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ ColorPickerGrid component = (ColorPickerGrid) source;
+ return component.getColor();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ ColorPickerGrid component = (ColorPickerGrid) source;
+ component.setColor((Color) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerHistoryColorProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerHistoryColorProperty.java
new file mode 100644
index 0000000..1ec707e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerHistoryColorProperty.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
+import com.vaadin.ui.components.colorpicker.ColorPickerHistory;
+
+/**
+ */
+public class ColorPickerHistoryColorProperty extends
+ AbstractVaadinValueProperty {
+
+ public ColorPickerHistoryColorProperty() {
+ super(ColorChangeEvent.class);
+ }
+
+ public Object getValueType() {
+ return Color.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ ColorPickerHistory component = (ColorPickerHistory) source;
+ return component.getColor();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ ColorPickerHistory component = (ColorPickerHistory) source;
+ component.setColor((Color) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerSelectColorProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerSelectColorProperty.java
new file mode 100644
index 0000000..e0c8635
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ColorPickerSelectColorProperty.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
+import com.vaadin.ui.components.colorpicker.ColorPickerSelect;
+
+/**
+ */
+public class ColorPickerSelectColorProperty extends AbstractVaadinValueProperty {
+
+ public ColorPickerSelectColorProperty() {
+ super(ColorChangeEvent.class);
+ }
+
+ public Object getValueType() {
+ return Color.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ ColorPickerSelect component = (ColorPickerSelect) source;
+ return component.getColor();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ ColorPickerSelect component = (ColorPickerSelect) source;
+ component.setColor((Color) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentDescriptionProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentDescriptionProperty.java
new file mode 100644
index 0000000..14fe76f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentDescriptionProperty.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
+
+/**
+ *
+ */
+public class ComponentDescriptionProperty extends AbstractVaadinValueProperty {
+ public String toString() {
+ return "ComponentDescriptionProperty"; //$NON-NLS-1$
+ }
+
+ public ComponentDescriptionProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return String.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ Component component = (Component) source;
+ return component.getDescription();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ if (source instanceof AbstractComponent) {
+ AbstractComponent comp = (AbstractComponent) source;
+ comp.setDescription((String) value);
+ } else {
+ throw new UnsupportedOperationException(
+ "setDescription missing in interface!");
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentFocusedProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentFocusedProperty.java
new file mode 100644
index 0000000..2313633
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentFocusedProperty.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.ui.Field;
+
+public class ComponentFocusedProperty extends AbstractVaadinValueProperty {
+
+ public String toString() {
+ return "ComponentFocusedProperty"; //$NON-NLS-1$
+ }
+
+ public ComponentFocusedProperty() {
+ super(FocusEvent.class);
+ }
+
+ public Object getValueType() {
+ return Boolean.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ return false;
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected void doSetValue(Object source, Object value) {
+ Boolean booleanValue = (Boolean) value;
+ if (booleanValue) {
+ Field field = (Field) source;
+ field.focus();
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListener.java
new file mode 100644
index 0000000..fde8a16
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListener.java
@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+
+import com.vaadin.event.MethodEventSource;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Component.Event;
+import com.vaadin.util.ReflectTools;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The listener interface for receiving component events. The class that is
+ * interested in processing a component event implements this interface, and the
+ * object created with that class is registered with a component using the
+ * component's <code>addComponentListener</code> method. When
+ * the component event occurs, that object's appropriate
+ * method is invoked.
+ *
+ * @see #componentEvent
+ */
+@SuppressWarnings("serial")
+public class ComponentListener extends NativePropertyListener implements
+ Component.Listener {
+
+ /** The Constant COMPONENT_EVENT_METHOD. */
+ public static final Method COMPONENT_EVENT_METHOD = ReflectTools
+ .findMethod(ComponentListener.class, "componentEvent",
+ Component.Event.class);
+
+ /** The change events. */
+ private final Class<? extends Component.Event>[] changeEvents;
+
+ /** The stale events. */
+ private final Class<? extends Component.Event>[] staleEvents;
+
+ /**
+ * Instantiates a new component listener.
+ *
+ * @param property
+ * the property
+ * @param listener
+ * the listener
+ * @param changeEvents
+ * the change events
+ * @param staleEvents
+ * the stale events
+ */
+ public ComponentListener(IProperty property,
+ ISimplePropertyListener listener,
+ Class<? extends Component.Event>[] changeEvents,
+ Class<? extends Component.Event>[] staleEvents) {
+ super(property, listener);
+ this.changeEvents = Arrays.copyOf(changeEvents, changeEvents.length);
+ this.staleEvents = Arrays.copyOf(staleEvents, staleEvents.length);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.Component.Listener#componentEvent(com.vaadin.ui.Component.Event)
+ */
+ @Override
+ public void componentEvent(com.vaadin.ui.Component.Event event) {
+ if (staleEvents != null) {
+ for (int i = 0; i < staleEvents.length; i++) {
+ if (event.getClass().isAssignableFrom(staleEvents[i])) {
+ fireStale(event.getComponent());
+ break;
+ }
+ }
+ }
+ if (changeEvents != null) {
+ for (int i = 0; i < changeEvents.length; i++) {
+ if (event.getClass().isAssignableFrom(changeEvents[i])) {
+ fireChange(event.getComponent(), null);
+ break;
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.NativePropertyListener#doAddTo(java.lang.Object)
+ */
+ protected void doAddTo(Object source) {
+ Component widget = (Component) source;
+ if (changeEvents != null) {
+ for (int i = 0; i < changeEvents.length; i++) {
+ Class<? extends Event> event = changeEvents[i];
+ if (event != null) {
+ ComponentListenerUtil.asyncAddListener(
+ (MethodEventSource) widget, event, this,
+ COMPONENT_EVENT_METHOD);
+ }
+ }
+ }
+ if (staleEvents != null) {
+ for (int i = 0; i < staleEvents.length; i++) {
+ Class<? extends Event> event = staleEvents[i];
+ if (event != null) {
+ ComponentListenerUtil.asyncAddListener(
+ (MethodEventSource) widget, event, this,
+ COMPONENT_EVENT_METHOD);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.NativePropertyListener#doRemoveFrom(java.lang.Object)
+ */
+ protected void doRemoveFrom(Object source) {
+ Component widget = (Component) source;
+ if (changeEvents != null) {
+ for (int i = 0; i < changeEvents.length; i++) {
+ Class<? extends Event> event = changeEvents[i];
+ if (event != null) {
+ ComponentListenerUtil.asyncRemoveListener(
+ (MethodEventSource) widget, event, this,
+ COMPONENT_EVENT_METHOD);
+ }
+ }
+ }
+ if (staleEvents != null) {
+ for (int i = 0; i < staleEvents.length; i++) {
+ Class<? extends Event> event = staleEvents[i];
+ if (event != null) {
+ ComponentListenerUtil.asyncRemoveListener(
+ (MethodEventSource) widget, event, this,
+ COMPONENT_EVENT_METHOD);
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListenerUtil.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListenerUtil.java
new file mode 100644
index 0000000..8efbe9e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/ComponentListenerUtil.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import java.lang.reflect.Method;
+
+import com.vaadin.event.MethodEventSource;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.UI;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ComponentListenerUtil.
+ */
+public class ComponentListenerUtil {
+
+ /**
+ * Async add listener.
+ *
+ * @param widget
+ * the widget
+ * @param event
+ * the event
+ * @param listener
+ * the listener
+ * @param listenerMethod
+ * the listener method
+ */
+ public static void asyncAddListener(final MethodEventSource widget,
+ final Class<? extends Component.Event> event,
+ final Component.Listener listener, Method listenerMethod) {
+ if (widget == null) {
+ return;
+ }
+
+ UI ui = UI.getCurrent();
+ if (ui != null) {
+ widget.addListener(event, listener, listenerMethod);
+ } else {
+ throw new IllegalStateException("Not a valid web transaction");
+ }
+ }
+
+ /**
+ * Async remove listener.
+ *
+ * @param widget
+ * the widget
+ * @param event
+ * the event
+ * @param listener
+ * the listener
+ * @param listenerMethod
+ * the listener method
+ */
+ public static void asyncRemoveListener(final MethodEventSource widget,
+ final Class<? extends Component.Event> event,
+ final Component.Listener listener, Method listenerMethod) {
+ if (widget == null) {
+ return;
+ }
+
+ UI ui = UI.getCurrent();
+ if (ui != null) {
+ widget.removeListener(event, listener, listenerMethod);
+ } else {
+ throw new IllegalStateException("Not a valid web transaction");
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SimpleAccessorProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SimpleAccessorProperty.java
new file mode 100644
index 0000000..2c9339c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SimpleAccessorProperty.java
@@ -0,0 +1,115 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Uses reflection to access getter and setter method.
+ */
+public class SimpleAccessorProperty extends AbstractVaadinValueProperty {
+
+ /** The type. */
+ private Class<?> type;
+
+ /** The getter. */
+ private Method getter;
+
+ /** The setter. */
+ private Method setter;
+
+ /**
+ * Instantiates a new simple accessor property.
+ *
+ * @param componentClass
+ * the component class
+ * @param property
+ * the property
+ */
+ public SimpleAccessorProperty(Class<?> componentClass, String property) {
+ super();
+
+ PropertyDescriptor result = getPropertyDescriptor(componentClass,
+ property);
+ this.getter = PropertyUtils.getReadMethod(result);
+ this.setter = PropertyUtils.getWriteMethod(result);
+ this.type = getter.getReturnType();
+ }
+
+ /**
+ * Returns the property descriptor for the given class and the property.
+ *
+ * @param componentClass
+ * the component class
+ * @param property
+ * the property
+ * @return the property descriptor
+ */
+ protected PropertyDescriptor getPropertyDescriptor(Class<?> componentClass,
+ String property) {
+ PropertyDescriptor result = null;
+ for (PropertyDescriptor descriptor : PropertyUtils
+ .getPropertyDescriptors(componentClass)) {
+ if (descriptor.getName().equals(property)) {
+ result = descriptor;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.IValueProperty#getValueType()
+ */
+ public Object getValueType() {
+ return type;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.SimpleValueProperty#doGetValue(java.lang.Object)
+ */
+ protected Object doGetValue(Object source) {
+ try {
+ return getter.invoke(source);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.SimpleValueProperty#doSetValue(java.lang.Object, java.lang.Object)
+ */
+ protected void doSetValue(Object source, Object value) {
+ if (setter == null) {
+ throw new UnsupportedOperationException("Not supported!");
+ }
+ try {
+ setter.invoke(source, value);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableHeightProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableHeightProperty.java
new file mode 100644
index 0000000..6c5dee9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableHeightProperty.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable;
+import com.vaadin.server.Sizeable.Unit;
+
+/**
+ */
+public class SizeableHeightProperty extends AbstractVaadinValueProperty {
+
+ public SizeableHeightProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return String.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ Sizeable component = (Sizeable) source;
+
+ Unit heightUnit = component.getHeightUnits();
+ if (heightUnit == null) {
+ heightUnit = Unit.PIXELS;
+ }
+
+ return String.format("%s%s", Float.toString(component.getHeight()),
+ heightUnit.getSymbol());
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ Sizeable component = (Sizeable) source;
+ component.setHeight((String) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableWidthProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableWidthProperty.java
new file mode 100644
index 0000000..b278dfe
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SizeableWidthProperty.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable;
+import com.vaadin.server.Sizeable.Unit;
+
+/**
+ */
+public class SizeableWidthProperty extends AbstractVaadinValueProperty {
+
+ public SizeableWidthProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return String.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ Sizeable component = (Sizeable) source;
+
+ Unit widthUnit = component.getWidthUnits();
+ if (widthUnit == null) {
+ widthUnit = Unit.PIXELS;
+ }
+
+ return String.format("%s%s", Float.toString(component.getWidth()),
+ widthUnit.getSymbol());
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ Sizeable component = (Sizeable) source;
+ component.setWidth((String) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionProperty.java
new file mode 100644
index 0000000..4c8ecba
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionProperty.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+
+/**
+ */
+public class SplitPanelMaxSplitPositionProperty extends
+ AbstractVaadinValueProperty {
+ public String toString() {
+ return "SplitPanelMaxSplitPositionProperty"; //$NON-NLS-1$
+ }
+
+ public SplitPanelMaxSplitPositionProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Integer.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ return component.getMaxSplitPosition();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ Unit unit = component.getMaxSplitPositionUnit();
+
+ int pos = (Integer) value;
+ if (unit != Unit.PIXELS && unit != Unit.PERCENTAGE) {
+ if (pos <= 100) {
+ unit = Unit.PERCENTAGE;
+ } else {
+ unit = Unit.PIXELS;
+ }
+ }
+ component.setMaxSplitPosition((Integer) value, unit);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionUnitProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionUnitProperty.java
new file mode 100644
index 0000000..310ea66
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMaxSplitPositionUnitProperty.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+
+/**
+ */
+public class SplitPanelMaxSplitPositionUnitProperty extends
+ AbstractVaadinValueProperty {
+ public SplitPanelMaxSplitPositionUnitProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Unit.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ return component.getMaxSplitPositionUnit();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ component.setMaxSplitPosition(component.getMaxSplitPosition(),
+ (Unit) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionProperty.java
new file mode 100644
index 0000000..4976c57
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionProperty.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+
+/**
+ */
+public class SplitPanelMinSplitPositionProperty extends
+ AbstractVaadinValueProperty {
+ public String toString() {
+ return "SplitPanelMinSplitPositionProperty"; //$NON-NLS-1$
+ }
+
+ public SplitPanelMinSplitPositionProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Integer.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ return component.getMinSplitPosition();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ Unit unit = component.getMinSplitPositionUnit();
+
+ int pos = (Integer) value;
+ if (unit != Unit.PIXELS && unit != Unit.PERCENTAGE) {
+ if (pos <= 100) {
+ unit = Unit.PERCENTAGE;
+ } else {
+ unit = Unit.PIXELS;
+ }
+ }
+ component.setMinSplitPosition((Integer) value, unit);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionUnitProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionUnitProperty.java
new file mode 100644
index 0000000..c114b09
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelMinSplitPositionUnitProperty.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+
+/**
+ */
+public class SplitPanelMinSplitPositionUnitProperty extends
+ AbstractVaadinValueProperty {
+
+ public SplitPanelMinSplitPositionUnitProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Unit.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ return component.getMinSplitPositionUnit();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ component.setMinSplitPosition(component.getMinSplitPosition(),
+ (Unit) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionProperty.java
new file mode 100644
index 0000000..4cd45ba
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionProperty.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+
+/**
+ */
+public class SplitPanelSplitPositionProperty extends
+ AbstractVaadinValueProperty {
+
+ public SplitPanelSplitPositionProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Integer.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ return component.getSplitPosition();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ Unit unit = component.getMaxSplitPositionUnit();
+
+ int pos = (Integer) value;
+ if (unit != Unit.PIXELS && unit != Unit.PERCENTAGE) {
+ if (pos <= 100) {
+ unit = Unit.PERCENTAGE;
+ } else {
+ unit = Unit.PIXELS;
+ }
+ }
+ component.setSplitPosition((Integer) value, unit);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionUnitProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionUnitProperty.java
new file mode 100644
index 0000000..28f4ff0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/SplitPanelSplitPositionUnitProperty.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.server.Sizeable.Unit;
+import com.vaadin.ui.AbstractSplitPanel;
+
+/**
+ */
+public class SplitPanelSplitPositionUnitProperty extends
+ AbstractVaadinValueProperty {
+
+ public SplitPanelSplitPositionUnitProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Unit.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ return component.getSplitPositionUnit();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractSplitPanel component = (AbstractSplitPanel) source;
+ component.setSplitPosition(component.getSplitPosition(), (Unit) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/TabSheetSelectedTabProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/TabSheetSelectedTabProperty.java
new file mode 100644
index 0000000..0ad3f73
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/component/internal/TabSheetSelectedTabProperty.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal;
+
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
+
+/**
+ */
+public class TabSheetSelectedTabProperty extends AbstractVaadinValueProperty {
+
+ public TabSheetSelectedTabProperty() {
+ super(SelectedTabChangeEvent.class);
+ }
+
+ @Override
+ public Object getValueType() {
+ return Component.class;
+ }
+
+ @Override
+ protected Object doGetValue(Object source) {
+ TabSheet component = (TabSheet) source;
+ return component.getSelectedTab();
+ }
+
+ @Override
+ protected void doSetValue(Object source, Object value) {
+ TabSheet component = (TabSheet) source;
+ component.setSelectedTab((Component) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/container/IEnhancedFilterableContainer.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/container/IEnhancedFilterableContainer.java
new file mode 100644
index 0000000..9153b89
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/container/IEnhancedFilterableContainer.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.container;
+
+import java.util.List;
+
+import com.vaadin.data.Container;
+
+// TODO: Auto-generated Javadoc
+/**
+ * ECView databinding needs to access ALL item ids. Filters and sort orders must
+ * not change the underlying domain model.
+ *
+ * @param <ITEM>
+ * the generic type
+ */
+public interface IEnhancedFilterableContainer<ITEM> extends
+ Container.Filterable {
+
+ /**
+ * Returns a collection of unfiltered item ides.
+ *
+ * @return the unfiltered item ids
+ */
+ List<ITEM> getUnfilteredItemIds();
+
+ /**
+ * Returns the size of the unfiltered item ids.
+ *
+ * @return the int
+ */
+ int sizeUnfiltered();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ButtonClickListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ButtonClickListener.java
new file mode 100644
index 0000000..4666c22
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ButtonClickListener.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.Date;
+
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The listener interface for receiving buttonClick events. The class that is
+ * interested in processing a buttonClick event implements this interface, and
+ * the object created with that class is registered with a component using the
+ * component's <code>addButtonClickListener</code> method. When
+ * the buttonClick event occurs, that object's appropriate
+ * method is invoked.
+ *
+ * @see #buttonClick(ClickEvent)
+ */
+@SuppressWarnings("serial")
+public class ButtonClickListener extends NativePropertyListener implements
+ Button.ClickListener {
+
+ /** The last activation. */
+ private long lastActivation;
+
+ /**
+ * Instantiates a new button click listener.
+ *
+ * @param property
+ * the property
+ * @param listener
+ * the listener
+ */
+ public ButtonClickListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.NativePropertyListener#doAddTo(java.lang.Object)
+ */
+ protected void doAddTo(Object source) {
+ if (source instanceof Button) {
+ Button notifier = (Button) source;
+ notifier.addClickListener(this);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.NativePropertyListener#doRemoveFrom(java.lang.Object)
+ */
+ protected void doRemoveFrom(Object source) {
+ if (source instanceof Button) {
+ Button notifier = (Button) source;
+ notifier.removeClickListener(this);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.Button.ClickListener#buttonClick(com.vaadin.ui.Button.ClickEvent)
+ */
+ @Override
+ public void buttonClick(ClickEvent event) {
+ // on button click, just send the current time in ms to the receiver
+ lastActivation = new Date().getTime();
+ fireChange(lastActivation, null);
+ }
+
+ /**
+ * Returns the time of the last activation.
+ *
+ * @return the last activation
+ */
+ public long getLastActivation() {
+ return lastActivation;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetChangeListener.java
new file mode 100644
index 0000000..e8f0292
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetChangeListener.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.list.ListDiff;
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.ItemSetChangeNotifier;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class ContainerItemSetChangeListener extends NativePropertyListener
+ implements Container.ItemSetChangeListener {
+
+ private ArrayList<Object> oldItems = new ArrayList<Object>();
+ private Object source;
+
+ public ContainerItemSetChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ this.source = source;
+ getNotifier(source).addItemSetChangeListener(this);
+
+ cacheOldItems(source);
+ }
+
+ protected void cacheOldItems(Object source) {
+ Container container = getContainer(source);
+ oldItems = new ArrayList<Object>(container.getItemIds());
+ }
+
+ protected Container.ItemSetChangeNotifier getNotifier(Object source) {
+ Container.ItemSetChangeNotifier notifierToUse = (Container.ItemSetChangeNotifier) source;
+
+ // if the container can be used, then use it
+ if (source instanceof Container.Viewer) {
+ Container ds = getContainer(source);
+ if (ds instanceof Container.ItemSetChangeNotifier) {
+ notifierToUse = (ItemSetChangeNotifier) ds;
+ }
+ }
+ return notifierToUse;
+ }
+
+ protected Container getContainer(Object source) {
+ Container ds = Util.getContainer(source);
+ return ds;
+ }
+
+ protected void doRemoveFrom(Object source) {
+ getNotifier(source).removeItemSetChangeListener(this);
+ }
+
+ @Override
+ public void containerItemSetChange(Container.ItemSetChangeEvent event) {
+ List<Object> oldValues = oldItems;
+ ListDiff diffs = Diffs.computeListDiff(oldValues, convertToList(event
+ .getContainer().getItemIds()));
+ cacheOldItems(source);
+
+ fireChange(source, diffs);
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Object> convertToList(Collection<?> itemIds) {
+ return (List<Object>) ((itemIds instanceof List) ? itemIds
+ : new ArrayList<Object>(itemIds));
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java
new file mode 100644
index 0000000..1a509d8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ContainerItemSetContentProperty.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.list.ListDiff;
+import org.eclipse.core.databinding.observable.list.ListDiffVisitor;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.container.IEnhancedFilterableContainer;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.ui.AbstractSelect;
+
+/**
+ */
+public class ContainerItemSetContentProperty extends AbstractVaadinListProperty {
+
+ private Class<?> collectionType;
+
+ public ContainerItemSetContentProperty(Class<?> collectionType) {
+ this.collectionType = collectionType;
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new ContainerItemSetChangeListener(this, listener);
+ }
+
+ public Object getElementType() {
+ return collectionType;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ protected List<?> doGetList(Object source) {
+
+ Container ds = Util.getContainer(source);
+ Collection<?> result = null;
+ if (ds instanceof IEnhancedFilterableContainer<?>) {
+ result = ((IEnhancedFilterableContainer<?>) ds)
+ .getUnfilteredItemIds();
+ } else {
+ result = ds.getItemIds();
+ }
+ return (List<?>) ((result instanceof List) ? result : new ArrayList(
+ result));
+ }
+
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected void doSetList(final Object source, List list, ListDiff diff) {
+ final Container ds = Util.getContainer(source);
+ // set changes on datasource. It will notify listener - BUT ensure
+ // that selection is unset. Vaadin does not!
+ diff.accept(new ListDiffVisitor() {
+ @Override
+ public void handleRemove(int index, Object element) {
+ //
+ if (source instanceof AbstractSelect) {
+ AbstractSelect select = (AbstractSelect) source;
+ select.unselect(element);
+ }
+ ds.removeItem(element);
+ }
+
+ @Override
+ public void handleAdd(int index, Object element) {
+ if (ds instanceof Container.Indexed) {
+ Container.Indexed indexedDs = (Indexed) ds;
+ indexedDs.addItemAt(index, element);
+ } else {
+ ds.addItem(element);
+ }
+ }
+ });
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionSetProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionSetProperty.java
new file mode 100644
index 0000000..0f7f5a1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionSetProperty.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.set.SetDiff;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinSetProperty;
+
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.SelectionModel;
+import com.vaadin.ui.Grid.SelectionModel.Multi;
+
+/**
+ */
+public class GridSelectionSetProperty extends AbstractVaadinSetProperty {
+
+ private Class<?> collectionType;
+
+ public GridSelectionSetProperty(Class<?> collectionType) {
+ this.collectionType = collectionType;
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new SelectionNotifierSetDiffChangeListener(this, listener);
+ }
+
+ public Object getElementType() {
+ return collectionType;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected Set doGetSet(Object source) {
+ SelectionModel model = ((Grid) source).getSelectionModel();
+ if (model instanceof SelectionModel.Single) {
+ return Collections.singleton(((SelectionModel.Single) model)
+ .getSelectedRow());
+ } else if (model instanceof SelectionModel.Multi) {
+ SelectionModel.Multi cModel = (Multi) model;
+ return new HashSet(cModel.getSelectedRows());
+ }
+ return Collections.emptySet();
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected void doSetSet(Object source, Set set, SetDiff diff) {
+ SelectionModel model = ((Grid) source).getSelectionModel();
+ if (model instanceof SelectionModel.Single) {
+ Object itemId = diff.getAdditions().size() > 0 ? diff
+ .getAdditions().iterator().next() : null;
+ ((SelectionModel.Single) model).select(itemId);
+ } else if (model instanceof SelectionModel.Multi) {
+ SelectionModel.Multi cModel = (Multi) model;
+ cModel.deselect(diff.getRemovals());
+ cModel.select(diff.getAdditions());
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionValueProperty.java
new file mode 100644
index 0000000..3a24a01
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/GridSelectionValueProperty.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.SelectionModel;
+import com.vaadin.ui.Grid.SelectionModel.Multi;
+
+/**
+ */
+public class GridSelectionValueProperty extends AbstractVaadinValueProperty {
+
+ private Class<?> valueType;
+
+ public GridSelectionValueProperty(Class<?> valueType) {
+ this.valueType = valueType;
+ }
+
+ @Override
+ public Object getValueType() {
+ return valueType;
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new SelectionNotifierValueChangeListener(this, listener);
+ }
+
+ @Override
+ protected Object doGetValue(Object source) {
+ SelectionModel model = ((Grid) source).getSelectionModel();
+ if (model instanceof SelectionModel.Single) {
+ return ((SelectionModel.Single) model).getSelectedRow();
+ } else if (model instanceof SelectionModel.Multi) {
+ SelectionModel.Multi cModel = (Multi) model;
+ return cModel.getSelectedRows().stream().findFirst().orElse(null);
+ }
+ return null;
+ }
+
+ @Override
+ protected void doSetValue(Object source, Object value) {
+ SelectionModel model = ((Grid) source).getSelectionModel();
+ if (model instanceof SelectionModel.Single) {
+ ((SelectionModel.Single) model).select(value);
+ } else if (model instanceof SelectionModel.Multi) {
+ SelectionModel.Multi cModel = (Multi) model;
+ cModel.deselectAll();
+ cModel.select(value);
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetChangeListener.java
new file mode 100644
index 0000000..15f472b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetChangeListener.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Item.PropertySetChangeEvent;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class ItemPropertySetChangeListener extends NativePropertyListener
+ implements Item.PropertySetChangeListener {
+
+ public ItemPropertySetChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ @Override
+ protected void doAddTo(Object source) {
+ Item.PropertySetChangeNotifier notifier = (Item.PropertySetChangeNotifier) source;
+ notifier.addPropertySetChangeListener(this);
+ }
+
+ @Override
+ protected void doRemoveFrom(Object source) {
+ Item.PropertySetChangeNotifier notifier = (Item.PropertySetChangeNotifier) source;
+ notifier.removePropertySetChangeListener(this);
+ }
+
+ @Override
+ public void itemPropertySetChange(PropertySetChangeEvent event) {
+ List<Object> propertyList = new ArrayList<Object>(event.getItem()
+ .getItemPropertyIds());
+ fireChange(propertyList, null);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoChangeListener.java
new file mode 100644
index 0000000..d3ae112
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoChangeListener.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.PropertyInfo;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Item.PropertySetChangeEvent;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class ItemPropertySetInfoChangeListener extends NativePropertyListener
+ implements Item.PropertySetChangeListener {
+
+ public ItemPropertySetInfoChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ @Override
+ protected void doAddTo(Object source) {
+ Item.PropertySetChangeNotifier notifier = (Item.PropertySetChangeNotifier) source;
+ notifier.addPropertySetChangeListener(this);
+ }
+
+ @Override
+ protected void doRemoveFrom(Object source) {
+ Item.PropertySetChangeNotifier notifier = (Item.PropertySetChangeNotifier) source;
+ notifier.removePropertySetChangeListener(this);
+ }
+
+ @Override
+ public void itemPropertySetChange(PropertySetChangeEvent event) {
+ Item item = event.getItem();
+
+ List<PropertyInfo> infos = new ArrayList<PropertyInfo>();
+ for (Object id : item.getItemPropertyIds()) {
+ infos.add(new PropertyInfo(id, item.getItemProperty(id)));
+ }
+ fireChange(infos, null);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoValueProperty.java
new file mode 100644
index 0000000..9638237
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetInfoValueProperty.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.PropertyInfo;
+
+import com.vaadin.data.Item;
+
+/**
+ */
+public class ItemPropertySetInfoValueProperty extends
+ AbstractVaadinValueProperty {
+
+ public ItemPropertySetInfoValueProperty() {
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new ItemPropertySetInfoChangeListener(this, listener);
+ }
+
+ @Override
+ public Object getValueType() {
+ return Collection.class;
+ }
+
+ @Override
+ protected Object doGetValue(Object source) {
+ Item item = (Item) source;
+
+ List<PropertyInfo> infos = new ArrayList<PropertyInfo>();
+ for (Object id : item.getItemPropertyIds()) {
+ infos.add(new PropertyInfo(id, item.getItemProperty(id)));
+ }
+
+ return infos;
+ }
+
+ @Override
+ protected void doSetValue(Object source, Object value) {
+ Item item = (Item) source;
+ @SuppressWarnings("unchecked")
+ Collection<PropertyInfo> props = (Collection<PropertyInfo>) value;
+
+ for (Object id : item.getItemPropertyIds().toArray()) {
+ item.removeItemProperty(id);
+ }
+
+ for (PropertyInfo info : props) {
+ item.addItemProperty(info.getId(), info.getProperty());
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetValueProperty.java
new file mode 100644
index 0000000..d013e95
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ItemPropertySetValueProperty.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.data.Item;
+
+/**
+ */
+public class ItemPropertySetValueProperty extends AbstractVaadinValueProperty {
+
+ public ItemPropertySetValueProperty() {
+
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new ItemPropertySetChangeListener(this, listener);
+ }
+
+ @Override
+ public Object getValueType() {
+ return Collection.class;
+ }
+
+ @Override
+ protected Object doGetValue(Object source) {
+ Item item = (Item) source;
+ return new ArrayList<Object>(item.getItemPropertyIds());
+ }
+
+ @Override
+ protected void doSetValue(Object source, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListChangeListener.java
new file mode 100644
index 0000000..36902ed
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListChangeListener.java
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.list.ListDiff;
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Viewer;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeNotifier;
+import com.vaadin.ui.AbstractSelect;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class MultiSelectionListChangeListener extends NativePropertyListener
+ implements Property.ValueChangeListener {
+
+ private ArrayList<Object> oldItems;
+ private Object source;
+
+ public MultiSelectionListChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ this.source = source;
+ getNotifier(source).addValueChangeListener(this);
+
+ cacheOldValues(source);
+ }
+
+ protected void cacheOldValues(Object source) {
+ Collection<?> oldValues = (Collection<?>) getWidget(source).getValue();
+ oldItems = new ArrayList<Object>(oldValues);
+ }
+
+ protected Property.ValueChangeNotifier getNotifier(Object source) {
+ return (ValueChangeNotifier) source;
+ }
+
+ protected AbstractSelect getWidget(Object source) {
+ return (AbstractSelect) source;
+ }
+
+ protected Container getContainer(Object source) {
+ Container.Viewer viewer = (Viewer) source;
+ Container ds = viewer.getContainerDataSource();
+ return ds;
+ }
+
+ protected void doRemoveFrom(Object source) {
+ getNotifier(source).removeValueChangeListener(this);
+ }
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ List<Object> oldValues = oldItems;
+ ListDiff diffs = Diffs.computeListDiff(oldValues,
+ convertToList((Collection<?>) event.getProperty().getValue()));
+ cacheOldValues(source);
+
+ fireChange(source, diffs);
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Object> convertToList(Collection<?> itemIds) {
+ return (List<Object>) ((itemIds instanceof List) ? itemIds
+ : new ArrayList<Object>(itemIds));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListProperty.java
new file mode 100644
index 0000000..80220d1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionListProperty.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.list.ListDiff;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Property;
+
+/**
+ */
+public class MultiSelectionListProperty extends AbstractVaadinListProperty {
+
+ private Class<?> collectionType;
+
+ public MultiSelectionListProperty(Class<?> collectionType) {
+ this.collectionType = collectionType;
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new MultiSelectionListChangeListener(this, listener);
+ }
+
+ public Object getElementType() {
+ return collectionType;
+ }
+
+ @Override
+ protected List<?> doGetList(Object source) {
+ Property<Object> property = Util.getProperty(source);
+ Collection<?> values = (Collection<?>) property.getValue();
+ return (List<?>) ((values instanceof List) ? values
+ : values != null ? new ArrayList<Object>(values)
+ : new ArrayList<Object>());
+ }
+
+ @Override
+ @SuppressWarnings("rawtypes")
+ protected void doSetList(final Object source, List list, ListDiff diff) {
+ Property<Object> property = Util.getProperty(source);
+ Collection<?> values = (Collection<?>) property.getValue();
+ // convert values to list to apply listDiff
+ List<?> newValues = values != null ? new ArrayList<Object>(values)
+ : new ArrayList<Object>();
+ diff.applyTo(newValues);
+ // set the hashSet
+ property.setValue(new HashSet<Object>(newValues));
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetChangeListener.java
new file mode 100644
index 0000000..8d6b3f0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetChangeListener.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.set.SetDiff;
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Viewer;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeNotifier;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class MultiSelectionSetChangeListener extends NativePropertyListener
+ implements Property.ValueChangeListener {
+
+ private Set<Object> oldItems;
+ private Object source;
+
+ public MultiSelectionSetChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ this.source = source;
+ getNotifier(source).addValueChangeListener(this);
+
+ cacheOldValues(source);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void cacheOldValues(Object source) {
+ Property<Object> property = Util.getProperty(source);
+ oldItems = (Set<Object>) property.getValue();
+ }
+
+ protected Property.ValueChangeNotifier getNotifier(Object source) {
+ Property<Object> property = Util.getProperty(source);
+ if (property instanceof ValueChangeNotifier) {
+ return (ValueChangeNotifier) property;
+ } else {
+ return (ValueChangeNotifier) source;
+ }
+ }
+
+ // protected AbstractSelect getWidget(Object source) {
+ // return (AbstractSelect) source;
+ // }
+
+ protected Container getContainer(Object source) {
+ Container.Viewer viewer = (Viewer) source;
+ Container ds = viewer.getContainerDataSource();
+ return ds;
+ }
+
+ protected void doRemoveFrom(Object source) {
+ getNotifier(source).removeValueChangeListener(this);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ SetDiff diffs = Diffs.computeSetDiff(oldItems, (Set) event
+ .getProperty().getValue());
+ cacheOldValues(source);
+
+ fireChange(source, diffs);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetProperty.java
new file mode 100644
index 0000000..96f6dba
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/MultiSelectionSetProperty.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.set.SetDiff;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinSetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Property;
+
+/**
+ */
+public class MultiSelectionSetProperty extends AbstractVaadinSetProperty {
+
+ private Class<?> collectionType;
+
+ public MultiSelectionSetProperty(Class<?> collectionType) {
+ this.collectionType = collectionType;
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new MultiSelectionSetChangeListener(this, listener);
+ }
+
+ public Object getElementType() {
+ return collectionType;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected Set doGetSet(Object source) {
+ Set result = (Set) Util.getProperty(source).getValue();
+ return result != null ? result : new HashSet();
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected void doSetSet(Object source, Set set, SetDiff diff) {
+ Property<Object> property = Util.getProperty(source);
+ property.setValue(set);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyChangeListener.java
new file mode 100644
index 0000000..b837253
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyChangeListener.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ReadOnlyStatusChangeEvent;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class PropertyReadonlyChangeListener extends NativePropertyListener
+ implements Property.ReadOnlyStatusChangeListener {
+
+ public PropertyReadonlyChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ if (source instanceof Property.ReadOnlyStatusChangeNotifier) {
+ Property.ReadOnlyStatusChangeNotifier notifier = (Property.ReadOnlyStatusChangeNotifier) source;
+ notifier.addReadOnlyStatusChangeListener(this);
+ }
+ }
+
+ protected void doRemoveFrom(Object source) {
+ if (source instanceof Property.ReadOnlyStatusChangeNotifier) {
+ Property.ReadOnlyStatusChangeNotifier notifier = (Property.ReadOnlyStatusChangeNotifier) source;
+ notifier.removeReadOnlyStatusChangeListener(this);
+ }
+ }
+
+ @Override
+ public void readOnlyStatusChange(ReadOnlyStatusChangeEvent event) {
+ fireChange(event.getProperty().isReadOnly(), null);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyProperty.java
new file mode 100644
index 0000000..a355aa6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyReadonlyProperty.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.ui.AbstractField;
+
+/**
+ */
+public class PropertyReadonlyProperty extends AbstractVaadinValueProperty {
+
+ public PropertyReadonlyProperty() {
+ super();
+ }
+
+ public Object getValueType() {
+ return Boolean.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ AbstractField<?> component = (AbstractField<?>) source;
+ return component.isReadOnly();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ AbstractField<?> component = (AbstractField<?>) source;
+ component.setReadOnly((Boolean) value);
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new PropertyReadonlyChangeListener(this, listener);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueChangeListener.java
new file mode 100644
index 0000000..fd9afee
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueChangeListener.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class PropertyValueChangeListener extends NativePropertyListener
+ implements Property.ValueChangeListener {
+
+ public PropertyValueChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ if (source instanceof Property.ValueChangeNotifier) {
+ Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) source;
+ notifier.addValueChangeListener(this);
+ }
+ }
+
+ protected void doRemoveFrom(Object source) {
+ if (source instanceof Property.ValueChangeNotifier) {
+ Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) source;
+ notifier.removeValueChangeListener(this);
+ }
+ }
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ fireChange(event.getProperty(), null);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java
new file mode 100644
index 0000000..a6d7347
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/PropertyValueProperty.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Property;
+import com.vaadin.ui.AbstractField;
+
+/**
+ */
+public class PropertyValueProperty extends AbstractVaadinValueProperty {
+
+ public PropertyValueProperty() {
+
+ }
+
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new PropertyValueChangeListener(this, listener);
+ }
+
+ @Override
+ public Object getValueType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Object doGetValue(Object source) {
+ Property<?> property = Util.getProperty(source);
+ return property.getValue();
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ protected void doSetValue(Object source, Object value) {
+ if (source instanceof AbstractField) {
+ AbstractField field = (AbstractField) source;
+ if (!field.isValid()) {
+ // workaround - if value is invalid, then property#setValue will
+ // not change the field value. So we need to reset the value
+ // internally to the datasource value
+ field.discard();
+ }
+ }
+
+ Property<Object> property = Util.getProperty(source);
+ property.setValue(value);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierSetDiffChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierSetDiffChangeListener.java
new file mode 100644
index 0000000..2d0c642
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierSetDiffChangeListener.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.set.SetDiff;
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Viewer;
+import com.vaadin.data.Property;
+import com.vaadin.event.SelectionEvent;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class SelectionNotifierSetDiffChangeListener extends NativePropertyListener
+ implements com.vaadin.event.SelectionEvent.SelectionListener {
+
+ private Object source;
+
+ public SelectionNotifierSetDiffChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ this.source = source;
+ getNotifier(source).addSelectionListener(this);
+ }
+
+ protected SelectionEvent.SelectionNotifier getNotifier(Object source) {
+ Property<Object> property = Util.getProperty(source);
+ if (property instanceof SelectionEvent.SelectionNotifier) {
+ return (SelectionEvent.SelectionNotifier) property;
+ } else {
+ return (SelectionEvent.SelectionNotifier) source;
+ }
+ }
+
+ protected Container getContainer(Object source) {
+ Container.Viewer viewer = (Viewer) source;
+ Container ds = viewer.getContainerDataSource();
+ return ds;
+ }
+
+ protected void doRemoveFrom(Object source) {
+ getNotifier(source).removeSelectionListener(this);
+ }
+
+ @Override
+ public void select(SelectionEvent event) {
+ SetDiff diffs = Diffs.createSetDiff(event.getAdded(),
+ event.getRemoved());
+ fireChange(source, diffs);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierValueChangeListener.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierValueChangeListener.java
new file mode 100644
index 0000000..7d04a46
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SelectionNotifierValueChangeListener.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.NativePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Viewer;
+import com.vaadin.data.Property;
+import com.vaadin.event.SelectionEvent;
+
+/**
+ */
+@SuppressWarnings("serial")
+public class SelectionNotifierValueChangeListener extends
+ NativePropertyListener implements
+ com.vaadin.event.SelectionEvent.SelectionListener {
+
+ private Object source;
+
+ public SelectionNotifierValueChangeListener(IProperty property,
+ ISimplePropertyListener listener) {
+ super(property, listener);
+ }
+
+ protected void doAddTo(Object source) {
+ this.source = source;
+ getNotifier(source).addSelectionListener(this);
+ }
+
+ protected SelectionEvent.SelectionNotifier getNotifier(Object source) {
+ Property<Object> property = Util.getProperty(source);
+ if (property instanceof SelectionEvent.SelectionNotifier) {
+ return (SelectionEvent.SelectionNotifier) property;
+ } else {
+ return (SelectionEvent.SelectionNotifier) source;
+ }
+ }
+
+ protected Container getContainer(Object source) {
+ Container.Viewer viewer = (Viewer) source;
+ Container ds = viewer.getContainerDataSource();
+ return ds;
+ }
+
+ protected void doRemoveFrom(Object source) {
+ getNotifier(source).removeSelectionListener(this);
+ }
+
+ @Override
+ public void select(SelectionEvent event) {
+ Object added = event.getAdded().stream().findFirst().orElse(null);
+ Object removed = event.getRemoved().stream().findFirst().orElse(null);
+ ValueDiff diffs = Diffs.createValueDiff(added, removed);
+ fireChange(source, diffs);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SingleSelectionProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SingleSelectionProperty.java
new file mode 100644
index 0000000..97f8ca9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/SingleSelectionProperty.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.Util;
+
+import com.vaadin.data.Property;
+
+/**
+ * A property that is responsible for single selections.
+ */
+public class SingleSelectionProperty extends AbstractVaadinValueProperty {
+
+ private final Class<?> type;
+
+ public SingleSelectionProperty(Class<?> type) {
+ this.type = type;
+ }
+
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return new PropertyValueChangeListener(this, listener);
+ }
+
+ @Override
+ public Object getValueType() {
+ return type;
+ }
+
+ @Override
+ protected Object doGetValue(Object source) {
+ Property<?> property = Util.getProperty(source);
+ return property.getValue();
+ }
+
+ @Override
+ protected void doSetValue(Object source, Object value) {
+ Property<Object> property = Util.getProperty(source);
+ property.setValue(value);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerContainerDatasourceProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerContainerDatasourceProperty.java
new file mode 100644
index 0000000..9608247
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerContainerDatasourceProperty.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.data.Container;
+
+/**
+ */
+public class ViewerContainerDatasourceProperty extends
+ AbstractVaadinValueProperty {
+
+ public ViewerContainerDatasourceProperty() {
+ super();
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return null;
+ }
+
+ public Object getValueType() {
+ return Container.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ Container.Viewer component = (Container.Viewer) source;
+ return component.getContainerDataSource();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ Container.Viewer component = (Container.Viewer) source;
+ component.setContainerDataSource((Container) value);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerItemDatasourceProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerItemDatasourceProperty.java
new file mode 100644
index 0000000..be1fef3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerItemDatasourceProperty.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.data.Item;
+
+/**
+ */
+public class ViewerItemDatasourceProperty extends AbstractVaadinValueProperty {
+ public ViewerItemDatasourceProperty() {
+ super();
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return null;
+ }
+
+ public Object getValueType() {
+ return Item.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ Item.Viewer component = (Item.Viewer) source;
+ return component.getItemDataSource();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ Item.Viewer component = (Item.Viewer) source;
+ component.setItemDataSource((Item) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerPropertyDatasourceProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerPropertyDatasourceProperty.java
new file mode 100644
index 0000000..11cb119
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/model/internal/ViewerPropertyDatasourceProperty.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.model.internal;
+
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.properties.AbstractVaadinValueProperty;
+
+import com.vaadin.data.Property;
+
+/**
+ */
+public class ViewerPropertyDatasourceProperty extends
+ AbstractVaadinValueProperty {
+ public ViewerPropertyDatasourceProperty() {
+ super();
+ }
+
+ @Override
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ return null;
+ }
+
+ public Object getValueType() {
+ return Property.class;
+ }
+
+ protected Object doGetValue(Object source) {
+ Property.Viewer component = (Property.Viewer) source;
+ return component.getPropertyDataSource();
+ }
+
+ protected void doSetValue(Object source, Object value) {
+ Property.Viewer component = (Property.Viewer) source;
+ component.setPropertyDataSource((Property<?>) value);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinListProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinListProperty.java
new file mode 100644
index 0000000..6d7fc7f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinListProperty.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import java.util.Arrays;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.list.SimpleListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.SimpleVaadinPropertyObservableList;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableListDecorator;
+
+import com.vaadin.ui.Component;
+
+public abstract class AbstractVaadinListProperty extends SimpleListProperty
+ implements IVaadinListProperty {
+
+ private Class<? extends Component.Event>[] changeEvents;
+ private Class<? extends Component.Event>[] staleEvents;
+
+ /**
+ * Constructs a ComponentValueProperty which does not listen for any vaadin
+ * events.
+ */
+ protected AbstractVaadinListProperty() {
+ this(null, null);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event type
+ *
+ * @param changeEvent
+ * vaadin event type of the event that signifies a property
+ * change.
+ */
+ @SuppressWarnings("unchecked")
+ protected AbstractVaadinListProperty(
+ Class<? extends Component.Event> changeEvent) {
+ this(new Class[] { changeEvent }, null);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event
+ * type(s).
+ *
+ * @param changeEvents
+ * array of vaadin event constants of the events that signify a
+ * property change.
+ */
+ protected AbstractVaadinListProperty(
+ Class<? extends Component.Event>[] changeEvents) {
+ this(changeEvents, null);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event
+ * types.
+ *
+ * @param changeEvents
+ * array of vaadin event types of the events that signify a
+ * property change.
+ * @param staleEvents
+ * array of vaadin event types of the events that signify a
+ * property became stale.
+ */
+ public AbstractVaadinListProperty(
+ Class<? extends Component.Event>[] changeEvents,
+ Class<? extends Component.Event>[] staleEvents) {
+ this.changeEvents = changeEvents != null ? Arrays.copyOf(changeEvents,
+ changeEvents.length) : changeEvents;
+ this.staleEvents = staleEvents != null ? Arrays.copyOf(staleEvents,
+ staleEvents.length) : staleEvents;
+ }
+
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ if (changeEvents == null && staleEvents == null) {
+ return null;
+ }
+ return new ComponentListener(this, listener, changeEvents, staleEvents);
+ }
+
+ public IVaadinObservableList observe(Object source) {
+ if (source instanceof Component) {
+ return observe((Component) source);
+ }
+ return (IVaadinObservableList) super.observe(source);
+ }
+
+ public IObservableList observe(Realm realm, Object source) {
+ return wrapObservable(new SimpleVaadinPropertyObservableList(realm,
+ source, this), source);
+ }
+
+ protected IVaadinObservableList wrapObservable(IObservableList observable,
+ Object widget) {
+ return new VaadinObservableListDecorator(observable);
+ }
+
+ public IVaadinObservableList observe(Component widget) {
+ return (IVaadinObservableList) observe(
+ VaadinObservables.getRealm(VaadinObservables.getUI(widget)),
+ widget);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinSetProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinSetProperty.java
new file mode 100644
index 0000000..3c05ce0
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinSetProperty.java
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import java.util.Arrays;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.set.IObservableSet;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.set.SimpleSetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableSet;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableSetDecorator;
+
+import com.vaadin.ui.Component;
+
+public abstract class AbstractVaadinSetProperty extends SimpleSetProperty
+ implements IVaadinSetProperty {
+
+ private Class<? extends Component.Event>[] changeEvents;
+ private Class<? extends Component.Event>[] staleEvents;
+
+ /**
+ * Constructs a ComponentValueProperty which does not listen for any vaadin
+ * events.
+ */
+ protected AbstractVaadinSetProperty() {
+ this(null, null);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event type
+ *
+ * @param changeEvent
+ * vaadin event type of the event that signifies a property
+ * change.
+ */
+ @SuppressWarnings("unchecked")
+ protected AbstractVaadinSetProperty(
+ Class<? extends Component.Event> changeEvent) {
+ this(new Class[] { changeEvent }, null);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event
+ * type(s).
+ *
+ * @param changeEvents
+ * array of vaadin event constants of the events that signify a
+ * property change.
+ */
+ protected AbstractVaadinSetProperty(
+ Class<? extends Component.Event>[] changeEvents) {
+ this(changeEvents, null);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event
+ * types.
+ *
+ * @param changeEvents
+ * array of vaadin event types of the events that signify a
+ * property change.
+ * @param staleEvents
+ * array of vaadin event types of the events that signify a
+ * property became stale.
+ */
+ public AbstractVaadinSetProperty(
+ Class<? extends Component.Event>[] changeEvents,
+ Class<? extends Component.Event>[] staleEvents) {
+ this.changeEvents = changeEvents != null ? Arrays.copyOf(changeEvents,
+ changeEvents.length) : changeEvents;
+ this.staleEvents = staleEvents != null ? Arrays.copyOf(staleEvents,
+ staleEvents.length) : staleEvents;
+
+ }
+
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ if (changeEvents == null && staleEvents == null) {
+ return null;
+ }
+ return new ComponentListener(this, listener, changeEvents, staleEvents);
+ }
+
+ public IVaadinObservableSet observe(Object source) {
+ if (source instanceof Component) {
+ return observe((Component) source);
+ }
+ return (IVaadinObservableSet) super.observe(source);
+ }
+
+ public IObservableSet observe(Realm realm, Object source) {
+ return wrapObservable(super.observe(realm, source), (Component) source);
+ }
+
+ protected IVaadinObservableSet wrapObservable(IObservableSet observable,
+ Object widget) {
+ return new VaadinObservableSetDecorator(observable);
+ }
+
+ public IVaadinObservableSet observe(Component widget) {
+ return (IVaadinObservableSet) observe(
+ VaadinObservables.getRealm(VaadinObservables.getUI(widget)),
+ widget);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinValueProperty.java
new file mode 100644
index 0000000..4c449f2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/AbstractVaadinValueProperty.java
@@ -0,0 +1,209 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import java.util.Arrays;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.value.SimpleValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.component.internal.ComponentListener;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.SimpleVaadinPropertyObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableValueDecorator;
+
+import com.vaadin.ui.Component;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Abstract value property implementation for {@link Component} properties. This
+ * class implements some basic behavior that widget properties are generally
+ * expected to have, namely:
+ * <ul>
+ * <li>Calling {@link #observe(Object)} should create the observable on the UI
+ * realm of the widget, rather than the current default realm
+ * <li>All <code>observe()</code> methods should return an
+ * {@link IVaadinObservableValue}
+ * </ul>
+ * This class also provides a default widget listener implementation using
+ * vaadins event concept. Subclasses may pass one or more vaadin event types
+ * (sub class of {@link Component.Event}) to the super constructor to indicate
+ * which events signal a property change.
+ */
+public abstract class AbstractVaadinValueProperty extends SimpleValueProperty
+ implements IVaadinValueProperty {
+
+ /** The change events. */
+ private Class<? extends Component.Event>[] changeEvents;
+
+ /** The stale events. */
+ private Class<? extends Component.Event>[] staleEvents;
+
+ /**
+ * Constructs a ComponentValueProperty which does not listen for any vaadin
+ * events.
+ */
+ protected AbstractVaadinValueProperty() {
+ this(new Class[0], new Class[0]);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event type.
+ *
+ * @param changeEvent
+ * vaadin event type of the event that signifies a property
+ * change.
+ */
+ @SuppressWarnings("unchecked")
+ protected AbstractVaadinValueProperty(
+ Class<? extends Component.Event> changeEvent) {
+ this(new Class[] { changeEvent }, new Class[0]);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event
+ * type(s).
+ *
+ * @param changeEvents
+ * array of vaadin event constants of the events that signify a
+ * property change.
+ */
+ @SuppressWarnings("unchecked")
+ protected AbstractVaadinValueProperty(
+ Class<? extends Component.Event>[] changeEvents) {
+ this(changeEvents, new Class[0]);
+ }
+
+ /**
+ * Constructs a ComponentValueProperty with the specified vaadin event
+ * types.
+ *
+ * @param changeEvents
+ * array of vaadin event types of the events that signify a
+ * property change.
+ * @param staleEvents
+ * array of vaadin event types of the events that signify a
+ * property became stale.
+ */
+ public AbstractVaadinValueProperty(
+ Class<? extends Component.Event>[] changeEvents,
+ Class<? extends Component.Event>[] staleEvents) {
+ this.changeEvents = Arrays.copyOf(changeEvents, changeEvents.length);
+ this.staleEvents = Arrays.copyOf(staleEvents, staleEvents.length);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.SimpleValueProperty#adaptListener(org.eclipse.core.databinding.property.ISimplePropertyListener)
+ */
+ public INativePropertyListener adaptListener(
+ ISimplePropertyListener listener) {
+ if (changeEvents == null && staleEvents == null) {
+ return null;
+ }
+ return new ComponentListener(this, listener, changeEvents, staleEvents);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.ValueProperty#observe(java.lang.Object)
+ */
+ public IVaadinObservableValue observe(Object source) {
+ if (source instanceof Component) {
+ return observe((Component) source);
+ }
+ return (IVaadinObservableValue) super.observe(source);
+ }
+
+ /**
+ * Is used to observe the com.vaadin.data.Property#value attribute.
+ *
+ * @param realm
+ * the realm
+ * @param source
+ * the source
+ * @return the i vaadin observable value
+ */
+ public IVaadinObservableValue observeVaadinProperty(Realm realm,
+ Object source) {
+ if (source instanceof com.vaadin.data.Property) {
+ return wrapObservable(new SimpleVaadinPropertyObservableValue(
+ realm, source, this));
+ }
+ return wrapObservable(super.observe(realm, source));
+ }
+
+ /**
+ * Is used to observe the com.vaadin.data.Property#value attribute.
+ *
+ * @param source
+ * the source
+ * @return the i vaadin observable value
+ */
+ public IVaadinObservableValue observeVaadinProperty(Object source) {
+ return observeVaadinProperty(Realm.getDefault(), source);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.SimpleValueProperty#observe(org.eclipse.core.databinding.observable.Realm, java.lang.Object)
+ */
+ public IObservableValue observe(Realm realm, Object source) {
+ return wrapObservable(super.observe(realm, source));
+ }
+
+ /**
+ * Wrap observable.
+ *
+ * @param observable
+ * the observable
+ * @return the i vaadin observable value
+ */
+ protected IVaadinObservableValue wrapObservable(IObservableValue observable) {
+ return new VaadinObservableValueDecorator(observable);
+ }
+
+ /**
+ * Observe.
+ *
+ * @param widget
+ * the widget
+ * @return the i vaadin observable value
+ */
+ public IVaadinObservableValue observe(Component widget) {
+ return (IVaadinObservableValue) observe(
+ VaadinObservables.getRealm(VaadinObservables.getUI(widget)),
+ widget);
+ }
+
+ /**
+ * Observe delayed.
+ *
+ * @param delay
+ * the delay
+ * @param widget
+ * the widget
+ * @return the i vaadin observable value
+ */
+ public IVaadinObservableValue observeDelayed(int delay, Component widget) {
+ throw new UnsupportedOperationException("Delayed not allowed");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinValueProperty#observeDelayed(int, java.lang.Object)
+ */
+ @Override
+ public IVaadinObservableValue observeDelayed(int delay, Object component) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinListProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinListProperty.java
new file mode 100644
index 0000000..64e00d1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinListProperty.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import org.eclipse.core.databinding.property.list.IListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList;
+
+/**
+ * {@link IListProperty} for observing an vaadin Component
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IVaadinListProperty extends IListProperty {
+
+ /**
+ * Returns an observable list observing this list property on the given
+ * property source.
+ *
+ * @param source
+ * the property source
+ * @return an observable list observing this value property on the given
+ * property source
+ */
+ public IVaadinObservableList observe(Object source);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinSetProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinSetProperty.java
new file mode 100644
index 0000000..ac505d1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinSetProperty.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import org.eclipse.core.databinding.property.list.IListProperty;
+import org.eclipse.core.databinding.property.set.ISetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableSet;
+
+/**
+ * {@link IListProperty} for observing an vaadin Component
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IVaadinSetProperty extends ISetProperty {
+
+ /**
+ * Returns an observable list observing this list property on the given
+ * property source.
+ *
+ * @param source
+ * the property source
+ * @return an observable list observing this value property on the given
+ * property source
+ */
+ public IVaadinObservableSet observe(Object source);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinValueProperty.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinValueProperty.java
new file mode 100644
index 0000000..ae585c8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/IVaadinValueProperty.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import org.eclipse.core.databinding.property.value.IValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
+
+// TODO: Auto-generated Javadoc
+/**
+ * {@link IValueProperty} for observing an vaadin Component.
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface IVaadinValueProperty extends IValueProperty {
+
+ /**
+ * Returns an observable value observing this value property on the given
+ * property source.
+ *
+ * @param source
+ * the property source
+ * @return an observable value observing this value property on the given
+ * property source
+ */
+ IVaadinObservableValue observe(Object source);
+
+ /**
+ * Is used to observe the com.vaadin.data.Property#value attribute.
+ *
+ * @param source
+ * the source
+ * @return the i vaadin observable value
+ */
+ IVaadinObservableValue observeVaadinProperty(Object source);
+
+ /**
+ * Returns an {@link IVaadinObservableValue} observing this value
+ * property on the given Component, which delays notification of value
+ * changes until at least <code>delay</code> milliseconds have elapsed since
+ * that last change event, or until a FocusOut event is received from the
+ * Component (whichever happens first).
+ * <p>
+ * This method is equivalent to
+ * <code>vaadinObservables.observeDelayedValue(delay, observe(Component))</code>.
+ * <p>
+ * Attention: Currently without functionality
+ *
+ * @param delay
+ * the delay in milliseconds.
+ * @param component
+ * the component
+ * @return an observable value observing this value property on the given
+ * Component, and which delays change notifications for
+ * <code>delay</code> milliseconds.
+ */
+ public IVaadinObservableValue observeDelayed(int delay, Object component);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/PropertyInfo.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/PropertyInfo.java
new file mode 100644
index 0000000..5c5008a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/PropertyInfo.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import com.vaadin.data.Property;
+
+public class PropertyInfo {
+ private final Object id;
+ private final Property<?> prop;
+
+ public PropertyInfo(Object id, Property<?> prop) {
+ super();
+ this.id = id;
+ this.prop = prop;
+ }
+
+ /**
+ * @return the id
+ */
+ public Object getId() {
+ return id;
+ }
+
+ /**
+ * @return the prop
+ */
+ public Property<?> getProperty() {
+ return prop;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((prop == null) ? 0 : prop.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PropertyInfo other = (PropertyInfo) obj;
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
+ }
+ if (prop == null) {
+ if (other.prop != null) {
+ return false;
+ }
+ } else if (!prop.equals(other.prop)) {
+ return false;
+ }
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/Util.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/Util.java
new file mode 100644
index 0000000..8651aa2
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/Util.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Property;
+import com.vaadin.ui.AbstractSelect;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Util.
+ */
+public class Util {
+
+ /**
+ * Returns the property datasource if available, the source as a property or
+ * null.
+ *
+ * @param source
+ * the source
+ * @return the property
+ */
+ @SuppressWarnings("unchecked")
+ public static Property<Object> getProperty(Object source) {
+ Property<Object> result = null;
+ if (source instanceof Property.Viewer) {
+ result = ((Property.Viewer) source).getPropertyDataSource();
+ }
+
+ if (result == null && source instanceof Property<?>) {
+ result = (Property<Object>) source;
+ }
+ return result;
+ }
+
+ /**
+ * Returns the container datasource for the given element.
+ *
+ * @param source
+ * the source
+ * @return the container
+ */
+ public static Container getContainer(Object source) {
+ // if source is AbstractSelect, then access the container by
+ // #getContainerDataSource
+ if (source instanceof Container && !(source instanceof AbstractSelect)) {
+ return (Container) source;
+ }
+ Container result = null;
+ if (source instanceof Container.Viewer) {
+ result = ((Container.Viewer) source).getContainerDataSource();
+ }
+
+ return result;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinListPropertyDecorator.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinListPropertyDecorator.java
new file mode 100644
index 0000000..1ba5d71
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinListPropertyDecorator.java
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.property.list.IListProperty;
+import org.eclipse.core.databinding.property.list.ListProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableListDecorator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class VaadinListPropertyDecorator.
+ */
+public class VaadinListPropertyDecorator extends ListProperty implements
+ IVaadinListProperty {
+
+ /** The delegate. */
+ private final IListProperty delegate;
+
+ /**
+ * Instantiates a new vaadin list property decorator.
+ *
+ * @param delegate
+ * the delegate
+ */
+ public VaadinListPropertyDecorator(IListProperty delegate) {
+ this.delegate = delegate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.list.IListProperty#getElementType()
+ */
+ public Object getElementType() {
+ return delegate.getElementType();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.list.ListProperty#observe(java.lang.Object)
+ */
+ @Override
+ public IVaadinObservableList observe(Object source) {
+ return new VaadinObservableListDecorator(delegate.observe(source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.list.IListProperty#observe(org.eclipse.core.databinding.observable.Realm, java.lang.Object)
+ */
+ public IObservableList observe(Realm realm, Object source) {
+ return new VaadinObservableListDecorator(
+ delegate.observe(realm, source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.list.ListProperty#listFactory()
+ */
+ @Override
+ public IObservableFactory listFactory() {
+ return delegate.listFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.list.ListProperty#listFactory(org.eclipse.core.databinding.observable.Realm)
+ */
+ @Override
+ public IObservableFactory listFactory(Realm realm) {
+ return delegate.listFactory(realm);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.list.ListProperty#observeDetail(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ @Override
+ public IObservableList observeDetail(IObservableValue master) {
+ return new VaadinObservableListDecorator(delegate.observeDetail(master));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinSetPropertyDecorator.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinSetPropertyDecorator.java
new file mode 100644
index 0000000..1ea185d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinSetPropertyDecorator.java
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory;
+import org.eclipse.core.databinding.observable.set.IObservableSet;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.property.set.ISetProperty;
+import org.eclipse.core.databinding.property.set.SetProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableSet;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableSetDecorator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class VaadinSetPropertyDecorator.
+ */
+public class VaadinSetPropertyDecorator extends SetProperty implements
+ IVaadinSetProperty {
+
+ /** The delegate. */
+ private final ISetProperty delegate;
+
+ /**
+ * Instantiates a new vaadin set property decorator.
+ *
+ * @param delegate
+ * the delegate
+ */
+ public VaadinSetPropertyDecorator(ISetProperty delegate) {
+ this.delegate = delegate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.set.ISetProperty#getElementType()
+ */
+ public Object getElementType() {
+ return delegate.getElementType();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.set.SetProperty#observe(java.lang.Object)
+ */
+ @Override
+ public IVaadinObservableSet observe(Object source) {
+ return new VaadinObservableSetDecorator(delegate.observe(source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.set.ISetProperty#observe(org.eclipse.core.databinding.observable.Realm, java.lang.Object)
+ */
+ public IObservableSet observe(Realm realm, Object source) {
+ return new VaadinObservableSetDecorator(delegate.observe(realm, source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.set.SetProperty#setFactory()
+ */
+ @Override
+ public IObservableFactory setFactory() {
+ return delegate.setFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.set.SetProperty#setFactory(org.eclipse.core.databinding.observable.Realm)
+ */
+ @Override
+ public IObservableFactory setFactory(Realm realm) {
+ return delegate.setFactory(realm);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.set.SetProperty#observeDetail(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ @Override
+ public IObservableSet observeDetail(IObservableValue master) {
+ return new VaadinObservableSetDecorator(delegate.observeDetail(master));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinValuePropertyDecorator.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinValuePropertyDecorator.java
new file mode 100644
index 0000000..dd02e66
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/properties/VaadinValuePropertyDecorator.java
@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.properties;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.property.value.ValueProperty;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableListDecorator;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.values.VaadinObservableValueDecorator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class VaadinValuePropertyDecorator.
+ */
+public class VaadinValuePropertyDecorator extends ValueProperty implements
+ IVaadinValueProperty {
+
+ /** The delegate. */
+ private final IVaadinValueProperty delegate;
+
+ /**
+ * Instantiates a new vaadin value property decorator.
+ *
+ * @param delegate
+ * the delegate
+ */
+ public VaadinValuePropertyDecorator(IVaadinValueProperty delegate) {
+ this.delegate = delegate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.IValueProperty#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ return delegate.getValueType();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.ValueProperty#observe(java.lang.Object)
+ */
+ @Override
+ public IVaadinObservableValue observe(Object source) {
+ return new VaadinObservableValueDecorator(delegate.observe(source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinValueProperty#observeVaadinProperty(java.lang.Object)
+ */
+ @Override
+ public IVaadinObservableValue observeVaadinProperty(Object source) {
+ return new VaadinObservableValueDecorator(
+ delegate.observeVaadinProperty(source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.IValueProperty#observe(org.eclipse.core.databinding.observable.Realm, java.lang.Object)
+ */
+ public IObservableValue observe(Realm realm, Object source) {
+ return new VaadinObservableValueDecorator(delegate.observe(realm,
+ source));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.properties.IVaadinValueProperty#observeDelayed(int, java.lang.Object)
+ */
+ @Override
+ public IVaadinObservableValue observeDelayed(int delay, Object component) {
+ return delegate.observeDelayed(delay, component);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.ValueProperty#valueFactory()
+ */
+ @Override
+ public IObservableFactory valueFactory() {
+ return delegate.valueFactory();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.ValueProperty#valueFactory(org.eclipse.core.databinding.observable.Realm)
+ */
+ @Override
+ public IObservableFactory valueFactory(Realm realm) {
+ return delegate.valueFactory(realm);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.ValueProperty#observeDetail(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ @Override
+ public IObservableValue observeDetail(IObservableValue master) {
+ return new VaadinObservableValueDecorator(
+ delegate.observeDetail(master));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.value.ValueProperty#observeDetail(org.eclipse.core.databinding.observable.list.IObservableList)
+ */
+ @SuppressWarnings("all")
+ public IVaadinObservableList observeDetail(IObservableList master) {
+ return new VaadinObservableListDecorator(delegate.observeDetail(master));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableList.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableList.java
new file mode 100644
index 0000000..6cf1bc8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableList.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.IVaadinObservable;
+
+/**
+ * {@link IObservableList} observing a vaadin component.
+ */
+public interface IVaadinObservableList extends IVaadinObservable,
+ IObservableList {
+
+ /**
+ * Returns the model element that is observed.
+ *
+ * @return the model source object
+ */
+ public Object getSource();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableSet.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableSet.java
new file mode 100644
index 0000000..71b133a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableSet.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.set.IObservableSet;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.IVaadinObservable;
+
+/**
+ * {@link IObservableList} observing a vaadin component.
+ */
+public interface IVaadinObservableSet extends IVaadinObservable, IObservableSet {
+
+ /**
+ * Returns the model element that is observed.
+ *
+ * @return the model source object
+ */
+ public Object getSource();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableValue.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableValue.java
new file mode 100644
index 0000000..d33ec53
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/IVaadinObservableValue.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.osbp.runtime.web.vaadin.databinding.IVaadinObservable;
+
+/**
+ * {@link IObservableValue} observing a vaadin component.
+ */
+public interface IVaadinObservableValue extends IVaadinObservable,
+ IObservableValue {
+
+ /**
+ * Returns the model element that is observed.
+ *
+ * @return the model source object
+ */
+ public Object getSource();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SetToListAdapter.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SetToListAdapter.java
new file mode 100644
index 0000000..079c8a8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SetToListAdapter.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.list.IListChangeListener;
+import org.eclipse.core.databinding.observable.list.ListChangeEvent;
+import org.eclipse.core.databinding.observable.list.ListDiffEntry;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.core.databinding.observable.set.IObservableSet;
+import org.eclipse.core.databinding.observable.set.ISetChangeListener;
+import org.eclipse.core.databinding.observable.set.SetChangeEvent;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SetToListAdapter.
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class SetToListAdapter extends WritableList implements
+ IVaadinObservableList, IListChangeListener {
+
+ /** The set. */
+ private final IObservableSet set;
+
+ /** The source. */
+ private final Object source;
+
+ /** The set listener. */
+ private ISetChangeListener setListener = new ISetChangeListener() {
+ public void handleSetChange(SetChangeEvent event) {
+ List originalList = new ArrayList(wrappedList);
+ for (Object addedElement : event.diff.getAdditions()) {
+ if (!wrappedList.contains(addedElement)) {
+ wrappedList.add(addedElement);
+ }
+ }
+ for (Object removedElement : event.diff.getRemovals()) {
+ wrappedList.remove(removedElement);
+ }
+ fireListChange(Diffs.computeListDiff(originalList, wrappedList));
+ }
+ };
+
+ /**
+ * Instantiates a new sets the to list adapter.
+ *
+ * @param set
+ * the set
+ * @param source
+ * the source
+ */
+ public SetToListAdapter(IObservableSet set, Object source) {
+ super(set.getRealm(), new ArrayList(), set.getElementType());
+ this.set = set;
+ this.source = source;
+ wrappedList.addAll(set);
+ this.set.addSetChangeListener(setListener);
+ this.addListChangeListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.ObservableList#dispose()
+ */
+ public synchronized void dispose() {
+ super.dispose();
+
+ this.removeListChangeListener(this);
+
+ if (set != null && setListener != null) {
+ set.removeSetChangeListener(setListener);
+ setListener = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList#getSource()
+ */
+ @Override
+ public Object getSource() {
+ return source;
+ }
+
+ /**
+ * Observes changes of this instance of the list and transforms it to
+ * changes for the set. Set listeners are beeing detached during update.
+ *
+ * @param event
+ * the event
+ */
+ @Override
+ public void handleListChange(ListChangeEvent event) {
+
+ try {
+ Set<Object> addons = new HashSet<Object>();
+ Set<Object> removals = new HashSet<Object>();
+
+ set.removeSetChangeListener(setListener);
+ ListDiffEntry[] differences = event.diff.getDifferences();
+ for (int i = 0; i < differences.length; i++) {
+ ListDiffEntry entry = differences[i];
+ Object element = entry.getElement();
+ if (entry.isAddition()) {
+ addons.add(element);
+ } else {
+ removals.add(element);
+ }
+ }
+
+ // remove double entries
+ addons.removeAll(removals);
+
+ set.addAll(addons);
+ set.removeAll(removals);
+ } finally {
+ set.addSetChangeListener(setListener);
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableList.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableList.java
new file mode 100644
index 0000000..92d99fa
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableList.java
@@ -0,0 +1,761 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 Matthew Hall and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Hall - initial API and implementation (bug 194734)
+ * Matthew Hall - bugs 265561, 262287, 268203, 268688, 301774
+ * Florian Pirchner - ensured proper diff calculation for Vaadin containers
+ *
+ ******************************************************************************/
+
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.ObservableTracker;
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.list.AbstractObservableList;
+import org.eclipse.core.databinding.observable.list.ListDiff;
+import org.eclipse.core.databinding.observable.list.ListDiffEntry;
+import org.eclipse.core.databinding.property.INativePropertyListener;
+import org.eclipse.core.databinding.property.IProperty;
+import org.eclipse.core.databinding.property.IPropertyObservable;
+import org.eclipse.core.databinding.property.ISimplePropertyListener;
+import org.eclipse.core.databinding.property.SimplePropertyEvent;
+import org.eclipse.core.databinding.property.list.SimpleListProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleVaadinPropertyObservableList.
+ */
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class SimpleVaadinPropertyObservableList extends AbstractObservableList
+ implements IPropertyObservable {
+
+ /** The source. */
+ private Object source;
+
+ /** The property. */
+ private SimpleListProperty property;
+
+ /** The updating. */
+ private volatile boolean updating = false;
+
+ /** The mod count. */
+ private volatile int modCount = 0;
+
+ /** The listener. */
+ private INativePropertyListener listener;
+
+ /** The cached list. */
+ private List cachedList;
+
+ /** The stale. */
+ private boolean stale;
+
+ /**
+ * Instantiates a new simple vaadin property observable list.
+ *
+ * @param realm
+ * the realm
+ * @param source
+ * the source
+ * @param property
+ * the property
+ */
+ public SimpleVaadinPropertyObservableList(Realm realm, Object source,
+ SimpleListProperty property) {
+ super(realm);
+ this.source = source;
+ this.property = property;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#firstListenerAdded()
+ */
+ protected void firstListenerAdded() {
+ if (!isDisposed()) {
+ if (listener == null) {
+ listener = property
+ .adaptListener(new ISimplePropertyListener() {
+ public void handleEvent(
+ final SimplePropertyEvent event) {
+ if (!isDisposed() && !updating) {
+ getRealm().exec(new Runnable() {
+ public void run() {
+ if (event.type == SimplePropertyEvent.CHANGE) {
+ modCount++;
+ notifyIfChanged((ListDiff) event.diff);
+ } else if (event.type == SimplePropertyEvent.STALE
+ && !stale) {
+ stale = true;
+ fireStale();
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+
+ getRealm().exec(new Runnable() {
+ public void run() {
+ cachedList = new ArrayList(getList());
+ stale = false;
+
+ if (listener != null)
+ listener.addTo(source);
+ }
+ });
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#lastListenerRemoved()
+ */
+ protected void lastListenerRemoved() {
+ if (listener != null)
+ listener.removeFrom(source);
+
+ cachedList = null;
+ stale = false;
+ }
+
+ /**
+ * Gets the ter called.
+ *
+ * @return the ter called
+ */
+ private void getterCalled() {
+ ObservableTracker.getterCalled(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.IObservableList#getElementType()
+ */
+ public Object getElementType() {
+ return property.getElementType();
+ }
+
+ // Queries
+
+ /**
+ * Gets the list.
+ *
+ * @return the list
+ */
+ private List getList() {
+ return property.getList(source);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#doGetSize()
+ */
+ protected int doGetSize() {
+ return getList().size();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#contains(java.lang.Object)
+ */
+ public boolean contains(Object o) {
+ getterCalled();
+ return getList().contains(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#containsAll(java.util.Collection)
+ */
+ public boolean containsAll(Collection c) {
+ getterCalled();
+ return getList().containsAll(c);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#get(int)
+ */
+ public Object get(int index) {
+ getterCalled();
+ return getList().get(index);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#indexOf(java.lang.Object)
+ */
+ public int indexOf(Object o) {
+ getterCalled();
+ return getList().indexOf(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#isEmpty()
+ */
+ public boolean isEmpty() {
+ getterCalled();
+ return getList().isEmpty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#lastIndexOf(java.lang.Object)
+ */
+ public int lastIndexOf(Object o) {
+ getterCalled();
+ return getList().lastIndexOf(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#toArray()
+ */
+ public Object[] toArray() {
+ getterCalled();
+ return getList().toArray();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#toArray(java.lang.Object[])
+ */
+ public Object[] toArray(Object[] a) {
+ getterCalled();
+ return getList().toArray(a);
+ }
+
+ // Single change operations
+
+ /**
+ * Update list.
+ *
+ * @param list
+ * the list
+ * @param diff
+ * the diff
+ */
+ private void updateList(List list, ListDiff diff) {
+ if (!diff.isEmpty()) {
+ boolean wasUpdating = updating;
+ updating = true;
+ try {
+ property.updateList(source, diff);
+ modCount++;
+ } finally {
+ updating = wasUpdating;
+ }
+
+ notifyIfChanged(null);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#add(java.lang.Object)
+ */
+ public boolean add(Object o) {
+ checkRealm();
+
+ List list = getList();
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
+ list.size(), true, o));
+ updateList(list, diff);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#add(int, java.lang.Object)
+ */
+ public void add(int index, Object o) {
+ checkRealm();
+
+ List list = getList();
+
+ if (index < 0 || index > list.size())
+ throw new IndexOutOfBoundsException();
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
+ true, o));
+ updateList(list, diff);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#iterator()
+ */
+ public Iterator iterator() {
+ getterCalled();
+ return new Iterator() {
+ int expectedModCount = modCount;
+ List list = new ArrayList(getList());
+ ListIterator iterator = list.listIterator();
+
+ Object lastElement = null;
+ int lastIndex = -1;
+
+ public boolean hasNext() {
+ getterCalled();
+ checkForComodification();
+ return iterator.hasNext();
+ }
+
+ public Object next() {
+ getterCalled();
+ checkForComodification();
+ Object next = lastElement = iterator.next();
+ lastIndex = iterator.previousIndex();
+ return next;
+ }
+
+ public void remove() {
+ checkRealm();
+ checkForComodification();
+ if (lastIndex == -1)
+ throw new IllegalStateException();
+
+ iterator.remove(); // stay in sync
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
+ lastIndex, false, lastElement));
+
+ updateList(list, diff);
+
+ lastElement = null;
+ lastIndex = -1;
+
+ expectedModCount = modCount;
+ }
+
+ private void checkForComodification() {
+ if (expectedModCount != modCount)
+ throw new ConcurrentModificationException();
+ }
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#move(int, int)
+ */
+ public Object move(int oldIndex, int newIndex) {
+ checkRealm();
+
+ List list = getList();
+ int size = list.size();
+ if (oldIndex < 0 || oldIndex >= size || newIndex < 0
+ || newIndex >= size)
+ throw new IndexOutOfBoundsException();
+
+ if (oldIndex == newIndex)
+ return list.get(oldIndex);
+
+ Object element = list.get(oldIndex);
+
+ ListDiff diff = Diffs.createListDiff(
+ Diffs.createListDiffEntry(oldIndex, false, element),
+ Diffs.createListDiffEntry(newIndex, true, element));
+ updateList(list, diff);
+
+ return element;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#remove(java.lang.Object)
+ */
+ public boolean remove(Object o) {
+ checkRealm();
+
+ List list = getList();
+
+ int index = list.indexOf(o);
+ if (index == -1)
+ return false;
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
+ false, o));
+ updateList(list, diff);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#listIterator()
+ */
+ public ListIterator listIterator() {
+ return listIterator(0);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#listIterator(int)
+ */
+ public ListIterator listIterator(final int index) {
+ getterCalled();
+ return new ListIterator() {
+ int expectedModCount = modCount;
+ List list = new ArrayList(getList());
+ ListIterator iterator = list.listIterator(index);
+
+ Object lastElement = null;
+ int lastIndex = -1;
+
+ public boolean hasNext() {
+ getterCalled();
+ checkForComodification();
+ return iterator.hasNext();
+ }
+
+ public int nextIndex() {
+ getterCalled();
+ checkForComodification();
+ return iterator.nextIndex();
+ }
+
+ public Object next() {
+ getterCalled();
+ checkForComodification();
+ lastElement = iterator.next();
+ lastIndex = iterator.previousIndex();
+ return lastElement;
+ }
+
+ public boolean hasPrevious() {
+ getterCalled();
+ checkForComodification();
+ return iterator.hasPrevious();
+ }
+
+ public int previousIndex() {
+ getterCalled();
+ checkForComodification();
+ return iterator.previousIndex();
+ }
+
+ public Object previous() {
+ getterCalled();
+ checkForComodification();
+ lastElement = iterator.previous();
+ lastIndex = iterator.nextIndex();
+ return lastElement;
+ }
+
+ public void add(Object o) {
+ checkRealm();
+ checkForComodification();
+ int index = iterator.nextIndex();
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
+ index, true, o));
+ updateList(list, diff);
+
+ iterator.add(o); // keep in sync
+
+ lastElement = null;
+ lastIndex = -1;
+ expectedModCount = modCount;
+ }
+
+ public void set(Object o) {
+ checkRealm();
+ checkForComodification();
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
+ lastIndex, false, lastElement), Diffs
+ .createListDiffEntry(lastIndex, true, o));
+ updateList(list, diff);
+
+ iterator.set(o);
+
+ lastElement = o;
+ expectedModCount = modCount;
+ }
+
+ public void remove() {
+ checkRealm();
+ checkForComodification();
+ if (lastIndex == -1)
+ throw new IllegalStateException();
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(
+ lastIndex, false, lastElement));
+ updateList(list, diff);
+
+ iterator.remove(); // keep in sync
+
+ lastElement = null;
+ lastIndex = -1;
+ expectedModCount = modCount;
+ }
+
+ private void checkForComodification() {
+ if (expectedModCount != modCount)
+ throw new ConcurrentModificationException();
+ }
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#remove(int)
+ */
+ public Object remove(int index) {
+ checkRealm();
+
+ List list = getList();
+ Object element = list.get(index);
+
+ ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
+ false, element));
+ updateList(list, diff);
+
+ return element;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#set(int, java.lang.Object)
+ */
+ public Object set(int index, Object o) {
+ checkRealm();
+
+ List list = getList();
+ Object oldElement = list.get(index);
+
+ ListDiff diff = Diffs.createListDiff(
+ Diffs.createListDiffEntry(index, false, oldElement),
+ Diffs.createListDiffEntry(index, true, o));
+ updateList(list, diff);
+
+ return oldElement;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#subList(int, int)
+ */
+ public List subList(int fromIndex, int toIndex) {
+ getterCalled();
+ return Collections.unmodifiableList(getList().subList(fromIndex,
+ toIndex));
+ }
+
+ // Bulk change operations
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#addAll(java.util.Collection)
+ */
+ public boolean addAll(Collection c) {
+ checkRealm();
+
+ if (c.isEmpty())
+ return false;
+
+ List list = getList();
+ return addAll(list, list.size(), c);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#addAll(int, java.util.Collection)
+ */
+ public boolean addAll(int index, Collection c) {
+ checkRealm();
+
+ if (c.isEmpty())
+ return false;
+
+ return addAll(getList(), index, c);
+ }
+
+ /**
+ * Adds the all.
+ *
+ * @param list
+ * the list
+ * @param index
+ * the index
+ * @param c
+ * the c
+ * @return true, if successful
+ */
+ private boolean addAll(List list, int index, Collection c) {
+ if (index < 0 || index > list.size())
+ throw new IndexOutOfBoundsException();
+
+ ListDiffEntry[] entries = new ListDiffEntry[c.size()];
+ int offsetIndex = 0;
+ for (Iterator it = c.iterator(); it.hasNext();) {
+ Object element = it.next();
+ entries[offsetIndex] = Diffs.createListDiffEntry(index
+ + offsetIndex, true, element);
+ offsetIndex++;
+ }
+ ListDiff diff = Diffs.createListDiff(entries);
+
+ updateList(list, diff);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#removeAll(java.util.Collection)
+ */
+ public boolean removeAll(Collection c) {
+ checkRealm();
+
+ if (c.isEmpty())
+ return false;
+
+ List list = getList();
+ if (list.isEmpty())
+ return false;
+
+ List entries = new ArrayList();
+ for (ListIterator it = list.listIterator(); it.hasNext();) {
+ int index = it.nextIndex() - entries.size();
+ Object element = it.next();
+ if (c.contains(element)) {
+ entries.add(Diffs.createListDiffEntry(index, false, element));
+ }
+ }
+
+ if (entries.isEmpty())
+ return false;
+
+ ListDiff diff = Diffs.createListDiff((ListDiffEntry[]) entries
+ .toArray(new ListDiffEntry[entries.size()]));
+ updateList(list, diff);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#retainAll(java.util.Collection)
+ */
+ public boolean retainAll(Collection c) {
+ checkRealm();
+
+ List list = getList();
+ if (list.isEmpty())
+ return false;
+
+ if (c.isEmpty()) {
+ clear();
+ return true;
+ }
+
+ List entries = new ArrayList();
+ for (ListIterator it = list.listIterator(); it.hasNext();) {
+ int index = it.nextIndex() - entries.size();
+ Object element = it.next();
+ if (!c.contains(element)) {
+ entries.add(Diffs.createListDiffEntry(index, false, element));
+ }
+ }
+
+ if (entries.isEmpty())
+ return false;
+
+ ListDiff diff = Diffs.createListDiff((ListDiffEntry[]) entries
+ .toArray(new ListDiffEntry[entries.size()]));
+ updateList(list, diff);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#clear()
+ */
+ public void clear() {
+ checkRealm();
+
+ List list = getList();
+ if (list.isEmpty())
+ return;
+
+ List entries = new ArrayList();
+ for (ListIterator it = list.listIterator(list.size()); it.hasPrevious();) {
+ // always report 0 as the remove index
+ int index = it.previousIndex();
+ Object element = it.previous();
+ entries.add(Diffs.createListDiffEntry(index, false, element));
+ }
+ ListDiff diff = Diffs.createListDiff((ListDiffEntry[]) entries
+ .toArray(new ListDiffEntry[entries.size()]));
+
+ updateList(list, diff);
+ }
+
+ /**
+ * Notify if changed.
+ *
+ * @param diff
+ * the diff
+ */
+ private void notifyIfChanged(ListDiff diff) {
+ if (hasListeners()) {
+ List oldList = cachedList;
+ List newList = cachedList = new ArrayList(getList());
+ // for Vaadin containers we need to calculate the diff each time.
+ // Vaadin containers also send list diffs, if an UI filter was added
+ // But an UI filter must never change the underlying datasource
+ diff = Diffs.computeListDiff(oldList, newList);
+ if (!diff.isEmpty() || stale) {
+ stale = false;
+ fireListChange(diff);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#isStale()
+ */
+ public boolean isStale() {
+ getterCalled();
+ return stale;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#equals(java.lang.Object)
+ */
+ public boolean equals(Object o) {
+ getterCalled();
+ return getList().equals(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#hashCode()
+ */
+ public int hashCode() {
+ getterCalled();
+ return getList().hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.IObserving#getObserved()
+ */
+ public Object getObserved() {
+ return source;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.property.IPropertyObservable#getProperty()
+ */
+ public IProperty getProperty() {
+ return property;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.databinding.observable.list.AbstractObservableList#dispose()
+ */
+ public synchronized void dispose() {
+ if (!isDisposed()) {
+ if (listener != null)
+ listener.removeFrom(source);
+ property = null;
+ source = null;
+ listener = null;
+ stale = false;
+ }
+ super.dispose();
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableValue.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableValue.java
new file mode 100644
index 0000000..c1fb96c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/SimpleVaadinPropertyObservableValue.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.property.value.SimpleValueProperty;
+import org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.Viewer;
+import com.vaadin.ui.AbstractSelect;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SimpleVaadinPropertyObservableValue.
+ */
+@SuppressWarnings("restriction")
+public class SimpleVaadinPropertyObservableValue extends
+ SimplePropertyObservableValue {
+
+ /**
+ * Instantiates a new simple vaadin property observable value.
+ *
+ * @param realm
+ * the realm
+ * @param source
+ * the source
+ * @param property
+ * the property
+ */
+ public SimpleVaadinPropertyObservableValue(Realm realm, Object source,
+ SimpleValueProperty property) {
+ super(realm, source, property);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ // delegate call to getValueType to vaadin property
+ com.vaadin.data.Property<?> property = (com.vaadin.data.Property<?>) getObserved();
+
+ if (property instanceof AbstractSelect) {
+ AbstractSelect select = (AbstractSelect) property;
+ if (select.isMultiSelect()) {
+ return select.getType();
+ }
+ }
+
+ if (property instanceof Property.Viewer) {
+ Property.Viewer viewer = (Viewer) property;
+ com.vaadin.data.Property<?> internalProperty = viewer
+ .getPropertyDataSource();
+ if (internalProperty != null) {
+ return internalProperty.getType();
+ }
+ }
+
+ return property.getType();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableListDecorator.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableListDecorator.java
new file mode 100644
index 0000000..e6177fb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableListDecorator.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.list.DecoratingObservableList;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class VaadinObservableListDecorator.
+ */
+public class VaadinObservableListDecorator extends DecoratingObservableList
+ implements IVaadinObservableList {
+
+ /**
+ * Instantiates a new vaadin observable list decorator.
+ *
+ * @param decorated
+ * the decorated
+ */
+ public VaadinObservableListDecorator(IObservableList decorated) {
+ super(decorated, true);
+ }
+
+ /**
+ * Gets the observed.
+ *
+ * @return the observed
+ */
+ public Object getObserved() {
+ IObservable decorated = getDecorated();
+ if (decorated instanceof IObserving) {
+ return ((IObserving) decorated).getObserved();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableList#getSource()
+ */
+ @Override
+ public Object getSource() {
+ return getObserved();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableSetDecorator.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableSetDecorator.java
new file mode 100644
index 0000000..936a9e8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableSetDecorator.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.set.DecoratingObservableSet;
+import org.eclipse.core.databinding.observable.set.IObservableSet;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class VaadinObservableSetDecorator.
+ */
+public class VaadinObservableSetDecorator extends DecoratingObservableSet
+ implements IVaadinObservableSet {
+
+ /**
+ * Instantiates a new vaadin observable set decorator.
+ *
+ * @param decorated
+ * the decorated
+ */
+ public VaadinObservableSetDecorator(IObservableSet decorated) {
+ super(decorated, true);
+ }
+
+ /**
+ * Gets the observed.
+ *
+ * @return the observed
+ */
+ public Object getObserved() {
+ IObservable decorated = getDecorated();
+ if (decorated instanceof IObserving) {
+ return ((IObserving) decorated).getObserved();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableSet#getSource()
+ */
+ @Override
+ public Object getSource() {
+ return getObserved();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableValueDecorator.java b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableValueDecorator.java
new file mode 100644
index 0000000..a39f7dc
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.databinding/src/org/eclipse/osbp/runtime/web/vaadin/databinding/values/VaadinObservableValueDecorator.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.databinding.values;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.value.DecoratingObservableValue;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class VaadinObservableValueDecorator.
+ */
+public class VaadinObservableValueDecorator extends DecoratingObservableValue
+ implements IVaadinObservableValue {
+
+ /**
+ * Instantiates a new vaadin observable value decorator.
+ *
+ * @param decorated
+ * the decorated
+ */
+ public VaadinObservableValueDecorator(IObservableValue decorated) {
+ super(decorated, true);
+ }
+
+ /**
+ * Gets the observed.
+ *
+ * @return the observed
+ */
+ public Object getObserved() {
+ IObservable decorated = getDecorated();
+ if (decorated instanceof IObserving) {
+ return ((IObserving) decorated).getObserved();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.databinding.values.IVaadinObservableValue#getSource()
+ */
+ public Object getSource() {
+ return getObserved();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ae21bd7
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.filter.jpa
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.filter.jpa
+Bundle-Version: 0.9.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse OSBP
+Import-Package: javax.persistence;version="2.1.0",
+ javax.persistence.criteria;version="2.1.0",
+ javax.persistence.metamodel;version="2.1.0",
+ javax.persistence.spi;version="2.1.0",
+ org.osgi.framework;version="1.8.0",
+ org.osgi.service.component;version="1.2.2",
+ org.osgi.service.component.annotations;version="1.2.0"
+Require-Bundle: com.vaadin.client;bundle-version="[7.0.0,7.7.0)",
+ com.vaadin.server;bundle-version="[7.0.0,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.0.0,7.7.0)",
+ com.google.guava;bundle-version="15.0.0",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)"
+Service-Component: OSGI-INF/org.eclipse.osbp.runtime.web.vaadin.filter.jpa.Filters.xml
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.html b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.ini b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.properties b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.properties
new file mode 100644
index 0000000..bd342b1
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.filter.jpa
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/pom.xml
new file mode 100644
index 0000000..5f6f553
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.filter.jpa/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.filter.jpa</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <description>Contains Vaadin Filters for JPA</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.project b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.project
new file mode 100644
index 0000000..c67773f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/.project
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.osgi.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e521c3c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,35 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.osgi.tests
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.osgi.tests;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Require-Bundle: org.junit;bundle-version="4.10.0",
+ org.eclipse.jetty.servlet;bundle-version="8.1.3",
+ org.eclipse.jetty.http;bundle-version="8.1.3",
+ org.eclipse.jetty.util;bundle-version="8.1.3",
+ org.eclipse.jetty.io;bundle-version="8.1.3",
+ org.eclipse.jetty.server;bundle-version="8.1.3",
+ org.apache.httpcomponents.httpclient;bundle-version="4.1.2",
+ org.apache.httpcomponents.httpcore;bundle-version="4.1.4",
+ org.knowhowlab.osgi.testing.assertions;bundle-version="[1.3.0,1.3.1)",
+ org.knowhowlab.osgi.testing.utils;bundle-version="[1.2.2,1.2.3)",
+ org.eclipse.osbp.runtime.web.vaadin.osgi;bundle-version="[0.9.0,0.10.0)",
+ org.apache.shiro.core;bundle-version="1.2.1",
+ org.eclipse.osbp.runtime.web.vaadin.common;bundle-version="[0.9.0,0.10.0)",
+ org.eclipse.equinox.common;bundle-version="3.6.100",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ org.jsoup;bundle-version="1.7.2"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse OSBP
+Service-Component: OSGI-INF/*.xml
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.eclipse.equinox.http.servlet;version="1.1.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.service.cm;version="1.4.0",
+ org.osgi.service.component;version="1.2.0",
+ org.osgi.service.http;version="1.2.1",
+ org.slf4j;version="1.6.1"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.osbp.runtime.web.vaadin.osgi.tests.Activator
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/component.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/component.xml
new file mode 100644
index 0000000..ab4d02b
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osbp.runtime.web.vaadin.osgi.tests">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.Activator$Component"/>
+ <reference bind="addHttpService" cardinality="0..n" interface="org.eclipse.equinox.http.servlet.ExtendedHttpService" name="httpServices" policy="dynamic" unbind="removeHttpService"/>
+ <reference bind="addVaadinApplication" cardinality="0..n" interface="org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication" name="vaadinApplications" policy="dynamic" unbind="removeVaadinApplication"/>
+ <reference bind="setCMAdmin" cardinality="0..1" interface="org.osgi.service.cm.ConfigurationAdmin" name="configurationAdmin" policy="dynamic" unbind="unsetCMAdmin"/>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_NoProviderFactory.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_NoProviderFactory.xml
new file mode 100644
index 0000000..5dabe9c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_NoProviderFactory.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" factory="org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper.UI_WithProviderFactory@noProviderFactoryTest" immediate="false" name="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.noproviderfactory">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper.UI_NoProviderFactory"/>
+ <service>
+ <provide interface="org.osgi.service.component.ComponentFactory"/>
+ </service>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory.xml
new file mode 100644
index 0000000..475b38c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" factory="org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper.UI_WithProviderFactory@providerFactoryTest" immediate="false" name="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.withproviderfactory">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper.UI_WithProviderFactory"/>
+ <service>
+ <provide interface="org.osgi.service.component.ComponentFactory"/>
+ </service>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory_ProviderFactory.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory_ProviderFactory.xml
new file mode 100644
index 0000000..03018ca
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/OSGI-INF/vaadinUI_WithProviderFactory_ProviderFactory.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper.UI_WithProviderFactory_ProviderFactory">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper.UI_WithProviderFactory$ProviderFactory"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.vaadin.osgi.common.IOSGiUiProviderFactory"/>
+ </service>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/build.properties b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/build.properties
new file mode 100644
index 0000000..98b1124
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/build.properties
@@ -0,0 +1,7 @@
+output.. = target/classes/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ OSGI-INF/component.xml,\
+ OSGI-INF/vaadinUI_WithProviderFactory_ProviderFactory.xml
+source.. = src/
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/pom.xml
new file mode 100644
index 0000000..a036d73
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany). -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Florian Pirchner - initial API and implementation -->
+<!--#======================================================================= -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.osgi.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/Activator.java b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/Activator.java
new file mode 100644
index 0000000..250dd50
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/Activator.java
@@ -0,0 +1,159 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.equinox.http.servlet.ExtendedHttpService;
+import org.knowhowlab.osgi.testing.assertions.BundleAssert;
+import org.knowhowlab.osgi.testing.assertions.ServiceAssert;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator implements BundleActivator {
+
+ private static final Logger logger = LoggerFactory
+ .getLogger(Activator.class);
+
+ private static Activator instance;
+ public static BundleContext context;
+
+ private ConfigurationAdmin cmAdmin;
+ private List<IVaadinApplication> httpApplications = new ArrayList<IVaadinApplication>();
+ private List<ExtendedHttpService> httpServices = new ArrayList<ExtendedHttpService>();
+
+ /**
+ * @return the instance
+ */
+ public static Activator getInstance() {
+ return instance;
+ }
+
+ /**
+ * @return the applications
+ */
+ public List<IVaadinApplication> getVaadinApplications() {
+ return httpApplications;
+ }
+
+ /**
+ * @return the httpServices
+ */
+ public List<ExtendedHttpService> getHttpServices() {
+ return httpServices;
+ }
+
+ /**
+ * Returns the configuration admin service.
+ *
+ * @return
+ */
+ public ConfigurationAdmin getConfigurationAdmin() {
+ return cmAdmin;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ Activator.context = context;
+ instance = this;
+
+ BundleAssert.setDefaultBundleContext(context);
+ ServiceAssert.setDefaultBundleContext(context);
+ }
+
+ /**
+ * Returns the bundle with the given id.
+ *
+ * @param id
+ * @return
+ */
+ public static Bundle findBundle(String id) {
+ for (Bundle bundle : context.getBundles()) {
+ if (bundle.getSymbolicName().equals(id)) {
+ return bundle;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ Activator.context = null;
+ instance = null;
+ }
+
+ /**
+ * OSGi-DS component
+ */
+ public static final class Component {
+
+ /**
+ * Called by OSGi-DS
+ *
+ * @param httpService
+ */
+ public void addHttpService(ExtendedHttpService httpService) {
+ Activator.getInstance().httpServices.add(httpService);
+ }
+
+ /**
+ * Called by OSGi-DS
+ *
+ * @param httpService
+ */
+ public void removeHttpService(ExtendedHttpService httpService) {
+ Activator.getInstance().httpServices.remove(httpService);
+ }
+
+ /**
+ * Called by OSGi-DS
+ *
+ * @param vaadinApplication
+ */
+ public void addVaadinApplication(IVaadinApplication vaadinApplication) {
+ Activator.getInstance().httpApplications.add(vaadinApplication);
+ }
+
+ /**
+ * Called by OSGi-DS
+ *
+ * @param vaadinApplication
+ */
+ public void removeVaadinApplication(IVaadinApplication vaadinApplication) {
+ Activator.getInstance().httpApplications.remove(vaadinApplication);
+ }
+
+ /**
+ * Called by OSGi-DS
+ *
+ * @param cmAdmin
+ */
+ public void setCMAdmin(ConfigurationAdmin cmAdmin) {
+ Activator.getInstance().cmAdmin = cmAdmin;
+ }
+
+ /**
+ * Called by OSGi-DS
+ *
+ * @param httpApplication
+ */
+ public void unsetCMAdmin(ConfigurationAdmin cmAdmin) {
+ Activator.getInstance().cmAdmin = null;
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/BundleHelper.java b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/BundleHelper.java
new file mode 100644
index 0000000..e014c4c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/BundleHelper.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context;
+
+import static org.knowhowlab.osgi.testing.assertions.BundleAssert.assertBundleAvailable;
+import static org.knowhowlab.osgi.testing.assertions.ServiceAssert.assertServiceAvailable;
+
+import org.knowhowlab.osgi.testing.utils.BundleUtils;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.tests.Activator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * Helps checking required bundles
+ *
+ * @author admin
+ *
+ */
+public class BundleHelper {
+
+ public static void ensureSetup() throws BundleException {
+ ensureNeededBundlesAvailable();
+ ensureNeededServicesAvailable();
+ }
+
+ public static void ensureNeededBundlesAvailable() throws BundleException {
+
+ // check bundles available
+ assertBundleAvailable("org.eclipse.osbp.runtime.web.http");
+ assertBundleAvailable("org.eclipse.osbp.runtime.web.jetty");
+ assertBundleAvailable("org.eclipse.equinox.ds");
+ assertBundleAvailable("org.eclipse.equinox.util");
+ assertBundleAvailable("org.eclipse.equinox.cm");
+
+ // stop jetty
+ Bundle jetty = BundleUtils.findBundle(Activator.context,
+ "org.eclipse.equinox.http.jetty");
+ if (jetty != null) {
+ jetty.stop();
+ }
+
+ // start ds
+ Bundle ds = BundleUtils.findBundle(Activator.context,
+ "org.eclipse.equinox.ds");
+ if (ds == null) {
+ throw new IllegalStateException(
+ "Bundle org.eclipse.equinox.ds is missing!");
+ }
+ if (ds.getState() != Bundle.STARTING && ds.getState() != Bundle.ACTIVE) {
+ ds.start();
+ }
+
+ // start cm
+ Bundle cm = BundleUtils.findBundle(Activator.context,
+ "org.eclipse.equinox.cm");
+ if (cm == null) {
+ throw new IllegalStateException(
+ "Bundle org.eclipse.equinox.cm is missing!");
+ }
+ if (cm.getState() != Bundle.STARTING && cm.getState() != Bundle.ACTIVE) {
+ cm.start();
+ }
+ }
+
+ public static void ensureNeededServicesAvailable() throws BundleException {
+ assertServiceAvailable("org.osgi.service.cm.ConfigurationAdmin");
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/VaadinRequestTests.java b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/VaadinRequestTests.java
new file mode 100644
index 0000000..52a8b43
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/VaadinRequestTests.java
@@ -0,0 +1,529 @@
+/**
+ * Copyright (c) 2012, 2015 Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - initial API and implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context;
+
+public class VaadinRequestTests {
+
+ // private ConfigurationAdmin cm;
+ // private Activator activator;
+ // private List<Configuration> toDelete = new ArrayList<Configuration>();
+ //
+ // /**
+ // * Setup tests.
+ // *
+ // * @throws ConfigurationException
+ // * @throws BundleException
+ // */
+ // @Before
+ // public void setup() throws ConfigurationException, BundleException {
+ // BundleHelper.ensureSetup();
+ // cm = Activator.getInstance().getConfigurationAdmin();
+ // activator = Activator.getInstance();
+ // }
+ //
+ // @After
+ // public void tearDown() throws IOException {
+ // for (Configuration config : toDelete) {
+ // config.delete();
+ // }
+ // }
+ //
+ // /**
+ // * Tests that requests are processed properly by the servlets.
+ // *
+ // * @throws IOException
+ // * @throws InvalidSyntaxException
+ // * @throws NamespaceException
+ // * @throws ServletException
+ // */
+ // @Test
+ // public void test_Servlet_Request() throws IOException,
+ // InvalidSyntaxException, ServletException, NamespaceException {
+ //
+ // // create new applications
+ // startHttpApp1("Server1");
+ // startHttpApp7("Server1");
+ // waitCM();
+ //
+ // // start a new jetty server
+ // startJetty1();
+ //
+ // // create vaadin applications
+ // startVaadin1("HttpApp1");
+ // startVaadin2("HttpApp7");
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ //
+ // assertStatusOK("Application1");
+ // assertStatusOK("Application2");
+ //
+ // // test vaadin application 1
+ // HttpResponse response =
+ // httpGET("http://localhost:8091/app1/test/alias1/");
+ // Assert.assertEquals(500, response.getStatusLine().getStatusCode());
+ // Assert.assertEquals(
+ // "Server Error",
+ // response.getStatusLine().getReasonPhrase());
+ //
+ // // alias not registered
+ // HttpResponse response2 =
+ // httpGET("http://localhost:8091/app1/test/aliasXY/");
+ // Assert.assertEquals(404, response2.getStatusLine().getStatusCode());
+ //
+ // // test vaadin application 2
+ // HttpResponse response3 =
+ // httpGET("http://localhost:8091/app7/test/alias2");
+ // Assert.assertEquals(500, response3.getStatusLine().getStatusCode());
+ // Assert.assertEquals(
+ // "Server Error",
+ // response3.getStatusLine().getReasonPhrase());
+ //
+ // assertStatusOK("Application1");
+ // assertStatusOK("Application2");
+ //
+ // }
+ //
+ // /**
+ // * Tests that requests are processed properly by the servlets.
+ // *
+ // * @throws IOException
+ // * @throws InvalidSyntaxException
+ // * @throws NamespaceException
+ // * @throws ServletException
+ // */
+ // @Test
+ // public void test_Servlet_Request_on_different_server() throws
+ // IOException,
+ // InvalidSyntaxException, ServletException, NamespaceException {
+ //
+ // // create new applications
+ // startHttpApp1("Server1");
+ // startHttpApp7("Server2");
+ // waitCM();
+ //
+ // // start a new jetty server
+ // startJetty1();
+ // startJetty2();
+ //
+ // // create vaadin applications
+ // startVaadin1("HttpApp1");
+ // startVaadin2("HttpApp7");
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ //
+ // assertStatusOK("Application1");
+ // assertStatusOK("Application2");
+ //
+ // // test vaadin application 1
+ // HttpResponse response =
+ // httpGET("http://localhost:8091/app1/test/alias1/");
+ // Assert.assertEquals(500, response.getStatusLine().getStatusCode());
+ // Assert.assertEquals(
+ // "Server Error",
+ // response.getStatusLine().getReasonPhrase());
+ // Assert.assertEquals(404,
+ // httpGET("http://localhost:8091/app7/test/alias2")
+ // .getStatusLine().getStatusCode());
+ //
+ // // test vaadin application 2
+ // HttpResponse response3 =
+ // httpGET("http://localhost:8099/app7/test/alias2");
+ // Assert.assertEquals(500, response3.getStatusLine().getStatusCode());
+ // Assert.assertEquals(
+ // "Server Error",
+ // response3.getStatusLine().getReasonPhrase());
+ // Assert.assertEquals(404,
+ // httpGET("http://localhost:8099/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ //
+ // assertStatusOK("Application1");
+ // assertStatusOK("Application2");
+ //
+ // }
+ //
+ // /**
+ // * Tests that requests are processed properly by the servlets.
+ // *
+ // * @throws IOException
+ // * @throws InvalidSyntaxException
+ // * @throws NamespaceException
+ // * @throws ServletException
+ // */
+ // @Test
+ // public void test_Servlet_Request_switch_server() throws IOException,
+ // InvalidSyntaxException, ServletException, NamespaceException {
+ //
+ // // create new applications
+ // Configuration httpApp1Config = startHttpApp1("Server1");
+ // startHttpApp7("Server2");
+ // waitCM();
+ //
+ // // start a new jetty server
+ // startJetty1();
+ // startJetty2();
+ //
+ // // create vaadin applications
+ // startVaadin1("HttpApp1");
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ //
+ // assertStatusOK("Application1");
+ //
+ // // test vaadin application 1
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8091/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // Assert.assertEquals(404,
+ // httpGET("http://localhost:8099/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ //
+ // // update the httpApplication 1 to run on server 2
+ // //
+ // Dictionary<String, Object> props1 = httpApp1Config.getProperties();
+ // props1.put(HttpConstants.JETTY_SERVER_NAME, "Server2");
+ // httpApp1Config.update(props1);
+ // waitCM(); // server restart
+ // waitCM(); // server restart
+ // waitCM(); // server restart
+ //
+ // assertStatusOK("Application1");
+ //
+ // // test vaadin application 1
+ // Assert.assertEquals(404,
+ // httpGET("http://localhost:8091/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // // --> Switched to new server
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8099/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // }
+ //
+ // /**
+ // * Tests that requests are processed properly by the servlets.
+ // *
+ // * @throws IOException
+ // * @throws InvalidSyntaxException
+ // * @throws NamespaceException
+ // * @throws ServletException
+ // */
+ // @Test
+ // public void test_Servlet_Request_switch_webApp() throws IOException,
+ // InvalidSyntaxException, ServletException, NamespaceException {
+ //
+ // // create new applications
+ // startHttpApp1("Server1");
+ // startHttpApp7("Server2");
+ // waitCM();
+ //
+ // // start a new jetty server
+ // startJetty1();
+ // startJetty2();
+ //
+ // // create vaadin applications
+ // Configuration vaadinApp1Config = startVaadin1("HttpApp1");
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ //
+ // assertStatusOK("Application1");
+ //
+ // // test vaadin application 1
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8091/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // // test vaadin application 2
+ // Assert.assertEquals(404,
+ // httpGET("http://localhost:8099/app7/test/alias1")
+ // .getStatusLine().getStatusCode());
+ //
+ // // update the httpApplication 1 to run on server 2
+ // //
+ // Dictionary<String, Object> props1 = vaadinApp1Config.getProperties();
+ // props1.put(VaadinConstants.HTTP_APPLICATION_NAME, "HttpApp7");
+ // vaadinApp1Config.update(props1);
+ // waitCM(); // remounting servlets
+ //
+ // assertStatusOK("Application1");
+ //
+ // // test vaadin application 1
+ // Assert.assertEquals(404,
+ // httpGET("http://localhost:8091/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // // --> Switched to new server
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8099/app7/test/alias1")
+ // .getStatusLine().getStatusCode());
+ //
+ // }
+ //
+ // /**
+ // *
+ // * @throws IOException
+ // * @throws InvalidSyntaxException
+ // * @throws NamespaceException
+ // * @throws ServletException
+ // */
+ // @Test
+ // public void test_Servlet_Request_switch_usedWebApp() throws IOException,
+ // InvalidSyntaxException, ServletException, NamespaceException {
+ //
+ // // create new applications
+ // startHttpApp1("Server1");
+ // startHttpApp7("Server2");
+ // waitCM();
+ //
+ // // start a new jetty server
+ // startJetty1();
+ // startJetty2();
+ //
+ // // create vaadin applications
+ // Configuration vaadinApp1Config = startVaadin1("HttpApp1");
+ // startVaadin2("HttpApp7");
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ //
+ // assertStatusOK("Application1");
+ // assertStatusOK("Application2");
+ //
+ // // test vaadin application 1
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8091/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // // test vaadin application 2
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8099/app7/test/alias2")
+ // .getStatusLine().getStatusCode());
+ //
+ // // update the httpApplication 1 to run on already used webApp7
+ // //
+ // Dictionary<String, Object> props1 = vaadinApp1Config.getProperties();
+ // props1.put(VaadinConstants.HTTP_APPLICATION_NAME, "HttpApp7");
+ // vaadinApp1Config.update(props1);
+ // waitCM(); // remounting servlets
+ //
+ // IVaadinApplication app = getVaadinApplication("Application1");
+ // IStatus status = app.getStatus();
+ // Assert.assertEquals(VaadinStatusCodes.SETTING_HTTP_SERVICE,
+ // status.getCode());
+ // Assert.assertEquals(IStatus.ERROR, status.getSeverity());
+ // assertStatusOK("Application2");
+ //
+ // }
+ //
+ // /**
+ // *
+ // * @throws IOException
+ // * @throws InvalidSyntaxException
+ // * @throws NamespaceException
+ // * @throws ServletException
+ // */
+ // @Test
+ // public void test_StoppedOnError() throws IOException,
+ // InvalidSyntaxException, ServletException, NamespaceException {
+ //
+ // // create new applications
+ // startHttpApp1("Server1");
+ // startHttpApp7("Server2");
+ // waitCM();
+ //
+ // // start a new jetty server
+ // startJetty1();
+ // startJetty2();
+ //
+ // // create vaadin applications
+ // Configuration vaadinApp1Config = startVaadin1("HttpApp1");
+ // startVaadin2("HttpApp7");
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ // waitCM(); // restarting servers
+ //
+ // assertStatusOK("Application1");
+ // assertStatusOK("Application2");
+ //
+ // // test vaadin application 1
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8091/app1/test/alias1/")
+ // .getStatusLine().getStatusCode());
+ // // test vaadin application 2
+ // Assert.assertEquals(500,
+ // httpGET("http://localhost:8099/app7/test/alias2")
+ // .getStatusLine().getStatusCode());
+ //
+ // // update the httpApplication 1 to run on already used webApp7
+ // //
+ // Dictionary<String, Object> props1 = vaadinApp1Config.getProperties();
+ // props1.put(VaadinConstants.HTTP_APPLICATION_NAME, "HttpApp7");
+ // vaadinApp1Config.update(props1);
+ // waitCM(); // remounting servlets
+ // waitCM(); // remounting servlets
+ // waitCM(); // remounting servlets
+ //
+ // // test that the application is stopped!
+ // IVaadinApplication app1 = getVaadinApplication("Application1");
+ // Assert.assertFalse(app1.isStarted());
+ // IVaadinApplication app2 = getVaadinApplication("Application2");
+ // Assert.assertTrue(app2.isStarted());
+ //
+ // }
+ //
+ // /**
+ // * Asserts that the status of the application is OK.
+ // *
+ // * @param vaadinApp
+ // */
+ // protected void assertStatusOK(String vaadinApp) {
+ // Assert.assertSame(VaadinStatusCodes.OK_STATUS,
+ // getVaadinApplication(vaadinApp).getStatus());
+ // }
+ //
+ // private IVaadinApplication getVaadinApplication(String name) {
+ // for (IVaadinApplication app : activator.getVaadinApplications()) {
+ // if (app.getName().equals(name)) {
+ // return app;
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // /**
+ // * Returns the first line of the http GET content.
+ // *
+ // * @param url
+ // * @return
+ // * @throws IOException
+ // * @throws ClientProtocolException
+ // */
+ // @SuppressWarnings("unused")
+ // private String httpGETFirstLine(String url) throws IOException,
+ // ClientProtocolException {
+ // HttpResponse resp = httpGET(url);
+ // BufferedReader reader = new BufferedReader(new InputStreamReader(resp
+ // .getEntity().getContent()));
+ // String content = reader.readLine();
+ // reader.close();
+ // return content;
+ // }
+ //
+ // /**
+ // * Calls get at http client.
+ // *
+ // * @param url
+ // * @return
+ // * @throws IOException
+ // * @throws ClientProtocolException
+ // */
+ // private HttpResponse httpGET(String url) throws IOException,
+ // ClientProtocolException {
+ // HttpClient client = new DefaultHttpClient();
+ // HttpGet get = new HttpGet(url);
+ // HttpResponse resp = client.execute(get);
+ // return resp;
+ // }
+ //
+ // /**
+ // * Starts the vaadin application 1.
+ // *
+ // * @return
+ // * @throws IOException
+ // */
+ // private Configuration startVaadin1(String httpApp) throws IOException {
+ // Dictionary<String, Object> props = new Hashtable<String, Object>();
+ // props.put(VaadinConstants.APPLICATION_NAME, "Application1");
+ // props.put(VaadinConstants.UI_ALIAS, "alias1");
+ // props.put(VaadinConstants.HTTP_APPLICATION_NAME, httpApp);
+ // props.put(VaadinConstants.WIDGETSET, "widgetset1");
+ // Configuration httpAppConfig = cm.createFactoryConfiguration(
+ // VaadinConstants.OSGI__FACTORY_PID, null);
+ // httpAppConfig.update(props);
+ //
+ // toDelete.add(httpAppConfig);
+ //
+ // return httpAppConfig;
+ // }
+ //
+ // /**
+ // * Starts the vaadin application 2.
+ // *
+ // * @return
+ // * @throws IOException
+ // */
+ // private Configuration startVaadin2(String httpApp) throws IOException {
+ // Dictionary<String, Object> props = new Hashtable<String, Object>();
+ // props.put(VaadinConstants.APPLICATION_NAME, "Application2");
+ // props.put(VaadinConstants.UI_ALIAS, "alias2");
+ // props.put(VaadinConstants.HTTP_APPLICATION_NAME, httpApp);
+ // props.put(VaadinConstants.WIDGETSET, "widgetset2");
+ // Configuration httpAppConfig = cm.createFactoryConfiguration(
+ // VaadinConstants.OSGI__FACTORY_PID, null);
+ // httpAppConfig.update(props);
+ //
+ // toDelete.add(httpAppConfig);
+ //
+ // return httpAppConfig;
+ // }
+ //
+ // /**
+ // * Returns the HttpService by context path.
+ // *
+ // * @param contextPath
+ // * @return
+ // * @throws InvalidSyntaxException
+ // */
+ // public HttpService getHttpServiceByContextpath(String contextPath)
+ // throws InvalidSyntaxException {
+ // ServiceReference<HttpService> reference = Activator.context
+ // .getServiceReferences(
+ // HttpService.class,
+ // String.format("(osbp.http.contextPath=%s)",
+ // contextPath)).iterator().next();
+ // HttpService httpService = Activator.context.getService(reference);
+ // return httpService;
+ // }
+ //
+ // private void waitCM() {
+ // try {
+ // Thread.sleep(200);
+ // } catch (InterruptedException e) {
+ // }
+ // }
+ //
+ // public static class DefaultHttpContext implements HttpContext {
+ //
+ // private Bundle bundle;
+ //
+ // public DefaultHttpContext(Bundle bundle) {
+ // this.bundle = bundle;
+ // }
+ //
+ // public boolean handleSecurity(HttpServletRequest request,
+ // HttpServletResponse response) throws IOException {
+ // return true;
+ // }
+ //
+ // public URL getResource(String name) {
+ // return bundle.getResource(name);
+ // }
+ //
+ // public String getMimeType(String name) {
+ // return null;
+ // }
+ // }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_NoProviderFactory.java b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_NoProviderFactory.java
new file mode 100644
index 0000000..bb92d58
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_NoProviderFactory.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.UI;
+
+@SuppressWarnings("serial")
+public class UI_NoProviderFactory extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_WithProviderFactory.java b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_WithProviderFactory.java
new file mode 100644
index 0000000..1da26cb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi.tests/src/org/eclipse/osbp/runtime/web/vaadin/osgi/tests/context/helper/UI_WithProviderFactory.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2011, 2014 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.osgi.tests.context.helper;
+
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.CustomOSGiUiProvider;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IOSGiUiProviderFactory;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.UI;
+
+/**
+ * Registered for vaadin application "providerFactoryTest".
+ */
+@SuppressWarnings({ "restriction", "serial" })
+public class UI_WithProviderFactory extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+
+ }
+
+ /**
+ * An OSGi service that provides UiProvider.
+ */
+ public static class ProviderFactory implements IOSGiUiProviderFactory {
+
+ public ProviderFactory() {
+
+ }
+
+ @Override
+ public CustomOSGiUiProvider createUiProvider(String vaadinApplication,
+ Class<? extends UI> uiClass) {
+ return vaadinApplication.equals("providerFactoryTest") ? new UiProvider(
+ vaadinApplication, uiClass) : null;
+ }
+ }
+
+ /**
+ * The custom UIProvider.
+ */
+ public static class UiProvider extends CustomOSGiUiProvider {
+ public UiProvider(String vaadinApplication, Class<? extends UI> uiClass) {
+ super(vaadinApplication, uiClass);
+ }
+
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/.project b/org.eclipse.osbp.runtime.web.vaadin.osgi/.project
new file mode 100644
index 0000000..79fa0c5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/.project
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.osgi</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.osgi/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e748a10
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/MANIFEST.MF
@@ -0,0 +1,36 @@
+Manifest-Version: 1.0
+Service-Component: OSGI-INF/*.xml
+Bundle-ActivationPolicy: lazy
+Built-By: root
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.osgi
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.osgi;singleton:=true
+Created-By: ApacheMaven
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.100",
+ com.vaadin.server;bundle-version="[7.0.0,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.0.0,7.7.0)",
+ org.jsoup;bundle-version="1.7.2",
+ org.slf4j.api;bundle-version="1.7.2"
+Build-Jdk: 1.7.0_15
+Bundle-Vendor: Eclipse OSBP
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: org.eclipse.osbp.runtime.web.vaadin.osgi.Activator
+Bundle-ManifestVersion: 2
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ org.apache.shiro.web.servlet;version="1.2.0",
+ org.eclipse.equinox.http.servlet;version="1.1.0",
+ org.eclipse.osgi.framework.console;version="1.1.0",
+ org.eclipse.osbp.runtime.common.dispose;version="0.9.0",
+ org.osgi.framework;version="1.7.0",
+ org.osgi.framework.wiring;version="1.1.0",
+ org.osgi.service.cm;version="1.4.0",
+ org.osgi.service.component;version="1.2.0",
+ org.osgi.service.http;version="1.2.1",
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.util.tracker;version="1.5.1"
+Export-Package: org.eclipse.osbp.runtime.web.vaadin.osgi;x-internal:=true;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.osgi.common;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.osgi.servlet;x-internal:=true;version="0.9.0",
+ org.eclipse.osbp.runtime.web.vaadin.osgi.webapp;x-internal:=true;version="0.9.0"
+Archiver-Version: PlexusArchiver
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.html b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.ini b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.properties b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.properties
new file mode 100644
index 0000000..5236348
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.lunifera.runtime.web.vaadin.osgi
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.properties b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.properties
new file mode 100644
index 0000000..30ec45e
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed Aug 07 02:09:58 CEST 2013
+version=0.0.1-SNAPSHOT
+groupId=org.eclipse.osbp.runtime.web
+artifactId=org.eclipse.osbp.runtime.web.vaadin.osgi
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.xml
new file mode 100644
index 0000000..c81c3bb
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/META-INF/maven/org.lunifera.runtime.web/org.lunifera.runtime.web.vaadin.osgi/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.parent</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>../org.eclipse.osbp.runtime.web.parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.osgi</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/applicationFactory.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/applicationFactory.xml
new file mode 100644
index 0000000..07d83e5
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/applicationFactory.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" configuration-policy="require" immediate="true" name="osbp.vaadin.application.factory">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.osgi.webapp.VaadinApplication"/>
+ <reference bind="addUIFactory" cardinality="0..n" interface="org.osgi.service.component.ComponentFactory" name="ComponentFactory" policy="dynamic" target="(component.factory=org.eclipse.osbp.web.vaadin.UI/*)" unbind="removeUIFactory"/>
+ <reference bind="addUIProviderFactory" cardinality="0..n" interface="org.eclipse.osbp.runtime.web.vaadin.osgi.common.IOSGiUiProviderFactory" name="IOSGiUiProviderFactory" policy="dynamic" unbind="removeUIProviderFactory"/>
+ <service>
+ <provide interface="org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication"/>
+ </service>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/consolecommands.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/consolecommands.xml
new file mode 100644
index 0000000..a5469fe
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/OSGI-INF/consolecommands.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osbp.runtime.web.vaadin.osgi.commands">
+ <implementation class="org.eclipse.osbp.runtime.web.vaadin.osgi.webapp.ConsoleCommands"/>
+ <service>
+ <provide interface="org.eclipse.osgi.framework.console.CommandProvider"/>
+ </service>
+ <reference bind="bindConfigAdmin" cardinality="0..1" interface="org.osgi.service.cm.ConfigurationAdmin" name="ConfigurationAdmin" policy="dynamic" unbind="unbindConfigAdmin"/>
+</scr:component>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/about.html b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/about.ini b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/about.properties b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.properties
new file mode 100644
index 0000000..0954109
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.osgi
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/build.properties b/org.eclipse.osbp.runtime.web.vaadin.osgi/build.properties
new file mode 100644
index 0000000..145b8c9
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/build.properties
@@ -0,0 +1,7 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ OSGI-INF/,\
+ LICENSE.txt
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.osgi/pom.xml
new file mode 100644
index 0000000..1b165fe
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/pom.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.osgi</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <description>This feature contains implementations to run Vaadin UIs using the OSGi-HttpService based on DS (Declarative Services).</description>
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/Activator.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/Activator.java
new file mode 100644
index 0000000..60c5d59
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/Activator.java
@@ -0,0 +1,155 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.VaadinConstants;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+// TODO: Auto-generated Javadoc, check link in text
+/**
+ * Activator for this bundle.
+ *
+ *
+ * In order to turn production mode on a configuration must be provided for the
+ * application. The PID to use is
+ * <code>osbp.web.vaadin.config.<em>alias</em></code>. See also
+ * { link VaadinConstants#PROP_MANAGED_SERVICE_PREFIX}
+ *
+ *
+ * An easy way to provide this configuration is to use FileInstall and create a
+ * file of the same name as the PID but with the extension .cfg. e.g.
+ * <code>osbp.web.vaadin.config/guessit</code> would require a file called
+ * <code>osbp.web.vaadin.config.guessit.cfg</code>. The contents of this
+ * file would contain the property <code>productionMode=true</code> and any
+ * other parameters that would normally passed to the Vaadin servlet as init
+ * parameters.
+ *
+ * brindy (with help from Neil Bartlett) <br>
+ * cvgaviao - Integration with Shiro Security Framework.<br>
+ * florian pirchner - migration to vaadin 7
+ */
+public class Activator implements BundleActivator {
+
+ /** The Constant BUNDLE_NAME. */
+ public static final String BUNDLE_NAME = "org.eclipse.osbp.runtime.web.vaadin.osgi";
+
+ /** The log service. */
+ private LogService logService;
+
+ /** The bundle context. */
+ private static BundleContext bundleContext;
+
+ /**
+ * Gets the bundle context.
+ *
+ * @return the bundle context
+ */
+ public static BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ /**
+ * Bind log service.
+ *
+ * @param context
+ * the context
+ */
+ protected void bindLogService(BundleContext context) {
+ ServiceReference<LogService> ref = context
+ .getServiceReference(LogService.class);
+ logService = context.getService(ref);
+
+ logService.log(LogService.LOG_DEBUG, "Binded LogService.");
+ }
+
+ /**
+ * Returns the vaadin web application with the given name.
+ *
+ * @return the vaadin web applications
+ */
+ protected static Collection<IVaadinApplication> getVaadinWebApplications() {
+ List<IVaadinApplication> services = new ArrayList<IVaadinApplication>();
+ try {
+ for (ServiceReference<IVaadinApplication> reference : bundleContext
+ .getServiceReferences(IVaadinApplication.class, null)) {
+ services.add(bundleContext.getService(reference));
+ }
+ } catch (InvalidSyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ return services;
+ }
+
+ /**
+ * Returns the vaadin web application with the given name.
+ *
+ * @param name
+ * the name
+ * @return the vaadin web application
+ */
+ public static IVaadinApplication getVaadinWebApplication(String name) {
+ try {
+ Collection<ServiceReference<IVaadinApplication>> refs = bundleContext
+ .getServiceReferences(IVaadinApplication.class,
+ "(component.name=" + name + ")");
+ if (refs.size() > 0) {
+ ServiceReference<IVaadinApplication> ref = refs.iterator()
+ .next();
+ return bundleContext.getService(ref);
+ }
+ } catch (InvalidSyntaxException e) {
+ throw new RuntimeException(e);
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets the log service.
+ *
+ * @return the log service
+ */
+ protected LogService getLogService() {
+ return logService;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+
+ bundleContext = context;
+
+ // bind the log service
+ bindLogService(context);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+
+ logService = null;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/CustomOSGiUiProvider.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/CustomOSGiUiProvider.java
new file mode 100644
index 0000000..49b287f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/CustomOSGiUiProvider.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.osgi.common;
+
+import org.eclipse.osbp.runtime.web.vaadin.osgi.webapp.OSGiUIProvider;
+
+import com.vaadin.ui.UI;
+
+/**
+ * The base class for customer ui provider implementation.
+ */
+@SuppressWarnings("serial")
+public abstract class CustomOSGiUiProvider extends OSGiUIProvider {
+
+ public CustomOSGiUiProvider(String vaadinApplication,
+ Class<? extends UI> uiClass) {
+ super(vaadinApplication, uiClass);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IOSGiUiProviderFactory.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IOSGiUiProviderFactory.java
new file mode 100644
index 0000000..a1b4946
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IOSGiUiProviderFactory.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.osgi.common;
+
+import com.vaadin.ui.UI;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Is used to prepare customer ui provider for a UI.class or a vaadin
+ * application.
+ */
+public interface IOSGiUiProviderFactory {
+
+ /**
+ * Returns a new instance of the OSGI UI provider. May return null.
+ *
+ * @param vaadinApplication
+ * - the name of the UI provider
+ * @param uiClass
+ * - the UI class that will be instantiated by the provider
+ * @return the custom os gi ui provider
+ */
+ CustomOSGiUiProvider createUiProvider(String vaadinApplication,
+ Class<? extends UI> uiClass);
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IVaadinApplication.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IVaadinApplication.java
new file mode 100644
index 0000000..cb38f18
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/IVaadinApplication.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.common;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.webapp.OSGiUIProvider;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A wrapper that handles the registration of servlets, resources and filters at
+ * the HttpService.
+ */
+public interface IVaadinApplication {
+
+ /**
+ * Returns the current status of the vaadin application.
+ *
+ * @return the status
+ */
+ IStatus getStatus();
+
+ /**
+ * Returns the id of that application.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Returns the name of the application.
+ *
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Returns the alias to access the vaadin web UI.
+ *
+ * @return the UI alias
+ */
+ String getUIAlias();
+
+ /**
+ * Returns the name of the HTTP application that vaadin application should
+ * be deployed at.
+ *
+ * @return the http application
+ */
+ String getHttpApplication();
+
+ /**
+ * Returns the name of the widget set.
+ *
+ * @return the widget set name
+ */
+ String getWidgetSetName();
+
+ /**
+ * Returns true, if the application is running in production mode.
+ *
+ * @return true, if is production mode
+ */
+ boolean isProductionMode();
+
+ /**
+ * Returns a list of ui providers available for the vaadin web application.
+ *
+ * @return the ui providers
+ */
+ List<OSGiUIProvider> getUiProviders();
+
+ /**
+ * Returns true, if the application is started.
+ *
+ * @return true, if is started
+ */
+ boolean isStarted();
+
+ /**
+ * Returns true, if the application is deployed to a servlet container.
+ *
+ * @return true, if is deployed
+ */
+ boolean isDeployed();
+
+ /**
+ * Starts the application. All required servlets, resources and filters will
+ * be registered at the http service.
+ */
+ void start();
+
+ /**
+ * Stops the application. All servlets, resources and filters will be
+ * unregistered at the http service.
+ */
+ void stop();
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/OSGiUI.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/OSGiUI.java
new file mode 100644
index 0000000..c2dc5c8
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/OSGiUI.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.common;
+
+import org.eclipse.osbp.runtime.common.dispose.IDisposable;
+import org.osgi.service.component.ComponentInstance;
+
+import com.vaadin.server.SessionDestroyEvent;
+import com.vaadin.server.SessionDestroyListener;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.ui.UI;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class OSGiUI.
+ */
+@SuppressWarnings("serial")
+public abstract class OSGiUI extends UI implements SessionDestroyListener,
+ IDisposable.Listener {
+
+ /** The instance. */
+ private ComponentInstance instance;
+
+ /**
+ * Sets the component instance that can be used to dispose the instance of
+ * that UI.
+ *
+ * @param instance
+ * the new component instance
+ */
+ public void setComponentInstance(ComponentInstance instance) {
+ if (this.instance != null) {
+ throw new IllegalArgumentException(
+ "Component instance may only be set onece!");
+ }
+ this.instance = instance;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.UI#setSession(com.vaadin.server.VaadinSession)
+ */
+ @Override
+ public void setSession(VaadinSession session) {
+ super.setSession(session);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.UI#attach()
+ */
+ @Override
+ public void attach() {
+ super.attach();
+
+ getSession().getService().addSessionDestroyListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.server.SessionDestroyListener#sessionDestroy(com.vaadin.server.SessionDestroyEvent)
+ */
+ public void sessionDestroy(SessionDestroyEvent event) {
+ dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.common.dispose.IDisposable.Listener#notifyDisposed(org.eclipse.osbp.runtime.common.dispose.IDisposable)
+ */
+ @Override
+ public void notifyDisposed(IDisposable notifier) {
+ // context was disposed
+ if (!isClosing()) {
+ close();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.ui.UI#detach()
+ */
+ @Override
+ public void detach() {
+ getSession().getService().removeSessionDestroyListener(this);
+
+ super.detach();
+
+ dispose();
+ }
+
+ /**
+ * Is called to remove the instance as an OSGi service and to cleanup the
+ * OSGi runtime.
+ */
+ protected void dispose() {
+ if (instance != null) {
+ instance.dispose();
+ instance = null;
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinConstants.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinConstants.java
new file mode 100644
index 0000000..1eff2f6
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinConstants.java
@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.common;
+
+import org.osgi.service.cm.ManagedServiceFactory;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Constants for that bundle.
+ */
+public class VaadinConstants {
+
+ /** The persistence ID used for {@link ManagedServiceFactory}. */
+ public static final String OSGI_FACTORY_PID = "osbp.vaadin.application.factory";
+
+ /**
+ * Property for the external PID of vaadin application.
+ */
+ public static final String EXTERNAL_PID = "osbp.externalPid";
+
+ /**
+ * Property for the name of a HttpApplication.
+ */
+ public static final String APPLICATION_NAME = "osbp.web.vaadin.name";
+
+ /**
+ * Property for the url alias that is used to access the vaadin UI.
+ * <p>
+ * For instance:<br>
+ *
+ * <code>host:</code> localhost:8080<br>
+ * <code>context path:</code> app1/test<br>
+ * <code>uialias:</code> vaadinmain<br>
+ * <code>http://localhost:8080/app1/test/vaadinmain</code> will open the
+ * vaadin UI.
+ */
+ public static final String UI_ALIAS = "osbp.web.vaadin.uialias";
+
+ /**
+ * The OSGi property for specifying the widgetset.
+ */
+ public static final String WIDGETSET = "osbp.web.vaadin.widgetset";
+
+ /**
+ * The OSGi property for specifying the productionmode.
+ */
+ public static final String PRODUCTIONMODE = "osbp.web.vaadin.productionmode";
+
+ /**
+ * Property for the name of the IHttpApplication the
+ * {@link IVaadinApplication} should be deployed at.
+ * <p>
+ * See <code>org.eclipse.osbp.runtime.web.http.HttpConstants</code>.
+ */
+ public static final String HTTP_APPLICATION_NAME = "osbp.http.name";
+
+ /**
+ * The default name of the vaadin application.
+ */
+ public static final String DEFAULT_APPLICATION_NAME = "vaadindefault";
+
+ /**
+ * The default name of the UIAlias.
+ */
+ public static final String DEFAULT_UI_ALIAS = "osbp";
+
+ /**
+ * OSGi property component.factory for the vaadin UI (tab sheet). The
+ * vaadin.ui.class name is part of the factory name and putted after the /.
+ * The class name is required for lazy loading issues.
+ * <p>
+ * Example:
+ *
+ * factory=
+ * "org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.web.vaadin.example.Vaadin7DemoUI"
+ */
+ public static final String OSGI_COMP_FACTORY_VAADIN_UI = "org.eclipse.osbp.web.vaadin.UI";
+
+ /**
+ * The prefix of the factory component name before the UI class name starts. <br>
+ * UI-Class name: org.eclipse.osbp.web.vaadin.example.Vaadin7DemoUI<br>
+ * Factory name: org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.web.vaadin.example.
+ * Vaadin7DemoUI
+ */
+ public static final String PREFIX_UI_CLASS = OSGI_COMP_FACTORY_VAADIN_UI
+ + "/";
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinStatusCodes.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinStatusCodes.java
new file mode 100644
index 0000000..16beb9c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/common/VaadinStatusCodes.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.common;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.Activator;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A class that contains all status codes of that bundle and helper methods to
+ * create the status objects.
+ */
+public class VaadinStatusCodes {
+
+ /** The Constant OK. */
+ public static final int OK = IStatus.OK;
+
+ /**
+ * Indicates that a problem occurred setting the http service. See exception
+ * in status.
+ */
+ public static final int SETTING_HTTP_SERVICE = 1000;
+
+ /**
+ * Indicates that a problem occurred starting the http service tracker.
+ */
+ public static final int HTTP_SERVICE_TRACKER = 1001;
+
+ /**
+ * Represents the OK status.
+ */
+ public static final IStatus OK_STATUS = Status.OK_STATUS;
+
+ /**
+ * Creates a status that indicates that the given alias is already used.
+ *
+ * @return the i status
+ */
+ public static IStatus createOK() {
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Creates a status that indicates that a problem occurred setting the http
+ * service.
+ *
+ * @param e
+ * the thrown exception or <code>null</code>
+ * @return the i status
+ */
+ public static IStatus createSettingHttpService(Throwable e) {
+ return new Status(IStatus.ERROR, Activator.BUNDLE_NAME,
+ SETTING_HTTP_SERVICE, "Alias already used!", e);
+ }
+
+ /**
+ * Creates a status that a problem with the http service tracker occured.
+ *
+ * @param e
+ * the thrown exception or <code>null</code>
+ * @return the i status
+ */
+ public static IStatus createHttpServiceTracker(Throwable e) {
+ return new Status(IStatus.ERROR, Activator.BUNDLE_NAME,
+ HTTP_SERVICE_TRACKER, "Alias already used!", e);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/OSGiServletService.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/OSGiServletService.java
new file mode 100644
index 0000000..7a58f8c
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/OSGiServletService.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.servlet;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
+import com.vaadin.server.VaadinSession;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class OSGiServletService.
+ */
+@SuppressWarnings("serial")
+public class OSGiServletService extends VaadinServletService {
+
+ /** The factory. */
+ private final IVaadinSessionFactory factory;
+
+ /**
+ * Instantiates a new OS gi servlet service.
+ *
+ * @param servlet
+ * the servlet
+ * @param deploymentConfiguration
+ * the deployment configuration
+ * @param factory
+ * the factory
+ * @throws ServiceException
+ * the service exception
+ */
+ public OSGiServletService(VaadinServlet servlet,
+ DeploymentConfiguration deploymentConfiguration,
+ IVaadinSessionFactory factory) throws ServiceException {
+ super(servlet, deploymentConfiguration);
+ this.factory = factory;
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.server.VaadinServletService#getConfiguredWidgetset(com.vaadin.server.VaadinRequest)
+ */
+ @Override
+ public String getConfiguredWidgetset(VaadinRequest request) {
+ return super.getConfiguredWidgetset(request);
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.server.VaadinService#getClassLoader()
+ */
+ @Override
+ public ClassLoader getClassLoader() {
+ return getClass().getClassLoader();
+ }
+
+ /* (non-Javadoc)
+ * @see com.vaadin.server.VaadinService#createVaadinSession(com.vaadin.server.VaadinRequest)
+ */
+ @Override
+ protected VaadinSession createVaadinSession(VaadinRequest request)
+ throws ServiceException {
+ return factory.createSession(request, getCurrentServletRequest());
+ }
+
+ /**
+ * Creates new instances of vaadin sessions.
+ */
+ public interface IVaadinSessionFactory {
+
+ /**
+ * Returns a new instance of a vaadin session.
+ *
+ * @param request
+ * the request
+ * @param httpServletRequest
+ * the http servlet request
+ * @return the vaadin session
+ */
+ VaadinSession createSession(VaadinRequest request,
+ HttpServletRequest httpServletRequest);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/ServletContextListenerServletAdaptor.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/ServletContextListenerServletAdaptor.java
new file mode 100644
index 0000000..0e3a028
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/ServletContextListenerServletAdaptor.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+public class ServletContextListenerServletAdaptor implements Servlet {
+ private ServletConfig config;
+ private ServletContextListener listener;
+ private Servlet delegate;
+
+ public ServletContextListenerServletAdaptor(
+ ServletContextListener listener, Servlet delegate) {
+ this.listener = listener;
+ this.delegate = delegate;
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ this.config = config;
+ listener.contextInitialized(new ServletContextEvent(config
+ .getServletContext()));
+ delegate.init(config);
+ }
+
+ public void service(ServletRequest req, ServletResponse resp)
+ throws ServletException, IOException {
+ delegate.service(req, resp);
+ }
+
+ public void destroy() {
+ delegate.destroy();
+ listener.contextDestroyed(new ServletContextEvent(config
+ .getServletContext()));
+ config = null;
+ }
+
+ public ServletConfig getServletConfig() {
+ return config;
+ }
+
+ public String getServletInfo() {
+ return "";
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/VaadinOSGiServlet.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/VaadinOSGiServlet.java
new file mode 100644
index 0000000..be71e04
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/VaadinOSGiServlet.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.servlet;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication;
+
+import com.vaadin.server.DeploymentConfiguration;
+import com.vaadin.server.ServiceException;
+import com.vaadin.server.UIProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinSession;
+
+/**
+ * Used to create instances of applications that have been registered with the
+ * container via a component factory.
+ *
+ */
+public class VaadinOSGiServlet extends VaadinServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ private IVaadinApplication webApplication;
+
+ /**
+ * Default constructor.
+ *
+ * @param webApplication
+ * The vaadin web application.
+ */
+ public VaadinOSGiServlet(IVaadinApplication webApplication) {
+ this.webApplication = webApplication;
+ }
+
+ @Override
+ public void init(ServletConfig servletConfig) throws ServletException {
+ try {
+ super.init(servletConfig);
+ } catch (ServletException e) {
+ if (e.getMessage().equals(
+ "Application not specified in servlet parameters")) {
+ // Ignore if application is not specified to allow the same
+ // servlet to be used for only push in portals
+ } else {
+ throw e;
+ }
+ }
+
+ }
+
+ @Override
+ protected OSGiServletService createServletService(
+ DeploymentConfiguration deploymentConfiguration)
+ throws ServiceException {
+
+ // create the servlet service initialized with the ui provider
+ OSGiServletService service = new OSGiServletService(this,
+ deploymentConfiguration,
+ new OSGiServletService.IVaadinSessionFactory() {
+ @Override
+ public VaadinSession createSession(VaadinRequest request,
+ HttpServletRequest httpServletRequest) {
+ VaadinSession session = new VaadinSession(request
+ .getService());
+ for (UIProvider provider : webApplication
+ .getUiProviders()) {
+ session.addUIProvider(provider);
+ }
+ return session;
+ }
+ });
+ service.init();
+ return service;
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/WebResourcesHttpContext.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/WebResourcesHttpContext.java
new file mode 100644
index 0000000..43821ed
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/servlet/WebResourcesHttpContext.java
@@ -0,0 +1,156 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.servlet;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.service.http.HttpContext;
+
+public class WebResourcesHttpContext implements HttpContext, BundleListener {
+
+ private Set<Bundle> resourceBundles = new HashSet<Bundle>();
+ private Bundle bundle;
+
+ public WebResourcesHttpContext(Bundle bundle) {
+ this.bundle = bundle;
+ init(bundle.getBundleContext());
+ }
+
+ @Override
+ public boolean handleSecurity(final HttpServletRequest request,
+ final HttpServletResponse response) throws IOException {
+ return true;
+ }
+
+ @Override
+ public URL getResource(String name) {
+ URL resource = null;
+ // iterate the server bundle, client bundle and fragments
+ for (Bundle bundle : resourceBundles) {
+ String uri = "";
+ if (isServerBundle(bundle) || isClientBundle(bundle)
+ || isThemesBundle(bundle) || isPushBundle(bundle)) {
+ uri = name.startsWith("/") ? name : "/" + name;
+ } else {
+ uri = name.startsWith("/") ? name : "/" + name;
+ String root = (String) bundle.getHeaders().get(
+ "Vaadin-Resources");
+ if (root != null && !root.equals("") && !".".equals(root)) {
+ uri = "/" + root + uri;
+ }
+ }
+
+ if (null != (resource = bundle.getResource(uri))) {
+ break;
+ }
+ }
+ return resource;
+ }
+
+ @Override
+ public String getMimeType(final String name) {
+ URL resource = getResource(name);
+ if (null != resource) {
+ try {
+ return resource.openConnection().getContentType();
+ } catch (final IOException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ private void checkBundleForResources(Bundle bundle) {
+ if (isClientBundle(bundle) || isServerBundle(bundle)
+ || isThemesBundle(bundle) || isPushBundle(bundle)) {
+ resourceBundles.add(bundle);
+ } else if (null != bundle.getHeaders().get("Vaadin-Resources")) {
+ resourceBundles.add(bundle);
+ } else {
+ resourceBundles.remove(bundle);
+ }
+ }
+
+ /**
+ * Returns true if the bundle is the vaadin server bundle.
+ *
+ * @param bundle
+ * @return
+ */
+ private boolean isServerBundle(Bundle bundle) {
+ return bundle.getSymbolicName().equals("com.vaadin.server");
+ }
+
+ /**
+ * Returns true, if the bundle is the vaadin client bundle.
+ *
+ * @param bundle
+ * @return
+ */
+ private boolean isClientBundle(Bundle bundle) {
+ return bundle.getSymbolicName().equals("com.vaadin.client")
+ || bundle.getSymbolicName()
+ .equals("com.vaadin.client-compiled");
+ }
+
+ /**
+ * Returns true, if the bundle is the vaadin push bundle.
+ *
+ * @param bundle
+ * @return
+ */
+ private boolean isPushBundle(Bundle bundle) {
+ return bundle.getSymbolicName().equals("com.vaadin.push");
+ }
+
+ /**
+ * Returns true, if the bundle is the vaadin themes bundle.
+ *
+ * @param bundle
+ * @return
+ */
+ private boolean isThemesBundle(Bundle bundle) {
+ return bundle.getSymbolicName().equals("com.vaadin.themes");
+ }
+
+ @Override
+ public void bundleChanged(BundleEvent event) {
+ if (event.getBundle() == this.bundle) {
+ if (event.getType() == BundleEvent.STOPPED) {
+ this.bundle.getBundleContext().removeBundleListener(this);
+ return;
+ }
+ }
+
+ if (event.getType() == BundleEvent.UNINSTALLED) {
+ resourceBundles.remove(event.getBundle());
+ } else {
+ checkBundleForResources(event.getBundle());
+ }
+ }
+
+ public void init(BundleContext ctx) {
+ ctx.addBundleListener(this);
+ for (Bundle bundle : ctx.getBundles()) {
+ checkBundleForResources(bundle);
+ }
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/AppException.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/AppException.java
new file mode 100644
index 0000000..970a166
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/AppException.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.webapp;
+
+@SuppressWarnings("serial")
+public class AppException extends Exception {
+
+ public AppException() {
+ super();
+ }
+
+ public AppException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AppException(String message) {
+ super(message);
+ }
+
+ public AppException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/ConsoleCommands.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/ConsoleCommands.java
new file mode 100644
index 0000000..b2eabde
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/ConsoleCommands.java
@@ -0,0 +1,400 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.webapp;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.VaadinConstants;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Console commands for the vaadin bundle.
+ */
+public class ConsoleCommands implements CommandProvider {
+
+ /** The Constant TAB. */
+ private final static String TAB = "\t"; //$NON-NLS-1$
+
+ /** The Constant NEW_LINE. */
+ private final static String NEW_LINE = "\r\n"; //$NON-NLS-1$
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(ConsoleCommands.class);
+
+ /** The Constant COMMANDS. */
+ private static final Set<Command> COMMANDS = new HashSet<ConsoleCommands.Command>();
+ static {
+ COMMANDS.add(new Command("<ls>", "",
+ "Lists all registered vaadin applications"));
+ COMMANDS.add(new Command("<properties>", "",
+ "Lists all available service properties"));
+ COMMANDS.add(new Command("<start|stop>", "[application id]",
+ "Starts or stops the vaadin application with the given id"));
+ COMMANDS.add(new Command("<dlt>", "[application id]",
+ "Deletes the vaadin application with the given id"));
+ }
+
+ /** The bundle context. */
+ private BundleContext bundleContext;
+
+ /** The config admin. */
+ private ConfigurationAdmin configAdmin;
+
+ /**
+ * Called by OSGi-DS.
+ *
+ * @param context
+ * the context
+ */
+ protected void activate(ComponentContext context) {
+ this.bundleContext = context.getBundleContext();
+ }
+
+ /**
+ * Called by OSGi-DS.
+ *
+ * @param context
+ * the context
+ */
+ protected void deactivate(ComponentContext context) {
+ bundleContext = null;
+ }
+
+ /**
+ * _lvaadin.
+ *
+ * @param ci
+ * the ci
+ * @throws Exception
+ * the exception
+ */
+ public void _lvaadin(final CommandInterpreter ci) throws Exception {
+ String argument = ci.nextArgument();
+ if (argument == null) {
+ ci.println(getHelp());
+ } else if (argument.equals("ls")) {
+ printApplication(ci);
+ } else if (argument.equals("properties")) {
+ printFilterProperties(ci);
+ } else if (argument.equals("start")) {
+ startApplication(ci);
+ } else if (argument.equals("stop")) {
+ stopApplication(ci);
+ } else if (argument.equals("dlt")) {
+ deleteApplication(ci);
+ } else {
+ ci.println("ERROR - not a valid command!");
+ ci.println(getHelp());
+ }
+ }
+
+ /**
+ * Prints the application.
+ *
+ * @param ci
+ * the ci
+ */
+ private void printApplication(CommandInterpreter ci) {
+ try {
+ ci.println("\t---- Available vaadin application instances ----");
+ for (ServiceReference<IVaadinApplication> reference : bundleContext
+ .getServiceReferences(IVaadinApplication.class, null)) {
+ IVaadinApplication service = bundleContext
+ .getService(reference);
+ printApplication(ci, service);
+ }
+ } catch (InvalidSyntaxException e) {
+ LOGGER.error("{}", e);
+ }
+ }
+
+ /**
+ * Prints the application.
+ *
+ * @param ci
+ * the ci
+ * @param service
+ * the service
+ */
+ public void printApplication(CommandInterpreter ci,
+ IVaadinApplication service) {
+ ci.println(String
+ .format("\t id: %s \t name: %s \t http-application: %s \t ui alias: %s \t widgetset: %s \t started: %s \t pid: %s",
+ service.getId(), service.getName(),
+ service.getHttpApplication(), service.getUIAlias(),
+ service.getWidgetSetName(),
+ Boolean.toString(service.isStarted()),
+ findVaadinApplicationPID(service.getId())));
+ }
+
+ /**
+ * Prints the available OSGi properties to filter.
+ *
+ * @param ci
+ * the ci
+ */
+ private void printFilterProperties(CommandInterpreter ci) {
+ ci.println("\t---- Available OSGi properties ----");
+ ci.println("\t" + VaadinConstants.EXTERNAL_PID);
+ ci.println("\t" + VaadinConstants.APPLICATION_NAME);
+ ci.println("\t" + VaadinConstants.UI_ALIAS);
+ ci.println("\t" + VaadinConstants.WIDGETSET);
+ }
+
+ /**
+ * Stop application.
+ *
+ * @param ci
+ * the ci
+ */
+ private void stopApplication(CommandInterpreter ci) {
+ String id = ci.nextArgument();
+ if (id == null) {
+ ci.println("\tERROR: No id specified!");
+ return;
+ }
+
+ VaadinApplication application = (VaadinApplication) findVaadinApplication(id);
+ if (application == null) {
+ ci.println("\tERROR: Application not found!");
+ return;
+ }
+
+ if (!application.isStarted()) {
+ ci.println("\tApplication already stopped!");
+ } else {
+ application.stop();
+ ci.println("\tApplication was stopped.");
+ }
+ printApplication(ci, application);
+
+ }
+
+ /**
+ * Deletes the application with the given id.
+ *
+ * @param ci
+ * the ci
+ */
+ private void deleteApplication(CommandInterpreter ci) {
+
+ if (configAdmin == null) {
+ ci.println("\tERROR: ConfigAdmin not available. Start equinox.cm!");
+ return;
+ }
+
+ String id = ci.nextArgument();
+ if (id == null) {
+ ci.println("\tERROR: No id specified!");
+ return;
+ }
+
+ VaadinApplication application = (VaadinApplication) findVaadinApplication(id);
+ if (application == null) {
+ ci.println("\tERROR: Application not found!");
+ return;
+ }
+
+ String pid = findVaadinApplicationPID(id);
+ Configuration config;
+ try {
+ config = configAdmin.getConfiguration(pid);
+ if (config != null) {
+ config.delete();
+ }
+ } catch (IOException e) {
+ LOGGER.error("{}", e);
+ }
+
+ ci.println("\tVaadinApplication successfully deleted!");
+ }
+
+ /**
+ * Looks for the application with the given id.
+ *
+ * @param id
+ * the id
+ * @return the i vaadin application
+ */
+ public IVaadinApplication findVaadinApplication(String id) {
+ IVaadinApplication application = null;
+ try {
+ Collection<ServiceReference<IVaadinApplication>> refs = bundleContext
+ .getServiceReferences(IVaadinApplication.class,
+ String.format("(%s=%s)",
+ VaadinConstants.EXTERNAL_PID, id));
+ if (refs.size() == 1) {
+ application = bundleContext.getService(refs.iterator().next());
+ }
+ } catch (InvalidSyntaxException e) {
+ LOGGER.error("{}", e);
+ }
+ return application;
+ }
+
+ /**
+ * Looks for the application pid with the given id.
+ *
+ * @param id
+ * the id
+ * @return the string
+ */
+ public String findVaadinApplicationPID(String id) {
+ String pid = null;
+ try {
+ Collection<ServiceReference<IVaadinApplication>> refs = bundleContext
+ .getServiceReferences(IVaadinApplication.class,
+ String.format("(%s=%s)",
+ VaadinConstants.EXTERNAL_PID, id));
+ if (refs.size() == 1) {
+ pid = (String) refs.iterator().next()
+ .getProperty(Constants.SERVICE_PID);
+ }
+ } catch (InvalidSyntaxException e) {
+ LOGGER.error("{}", e);
+ }
+ return pid;
+ }
+
+ /**
+ * Start application.
+ *
+ * @param ci
+ * the ci
+ */
+ private void startApplication(CommandInterpreter ci) {
+ String id = ci.nextArgument();
+ if (id == null) {
+ ci.println("\tERROR: No id specified!");
+ return;
+ }
+
+ VaadinApplication application = (VaadinApplication) findVaadinApplication(id);
+ if (application == null) {
+ ci.println("\tERROR: Application not found!");
+ return;
+ }
+
+ if (application.isStarted()) {
+ ci.println("\tApplication already started!");
+ } else {
+ application.start();
+ ci.println("\tApplication was started.");
+ }
+ printApplication(ci, application);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osgi.framework.console.CommandProvider#getHelp()
+ */
+ @Override
+ public String getHelp() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("---- OSBP vaadin application commands ----");
+ builder.append(NEW_LINE);
+
+ builder.append(TAB);
+ builder.append("lvaadin <cmd> [args]");
+ builder.append(NEW_LINE);
+
+ for (Command command : COMMANDS) {
+ command.writeTo(builder);
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Called by OSGi DS.
+ *
+ * @param configAdmin
+ * the config admin
+ */
+ protected void bindConfigAdmin(ConfigurationAdmin configAdmin) {
+ this.configAdmin = configAdmin;
+ }
+
+ /**
+ * Called by OSGi DS.
+ *
+ * @param configAdmin
+ * the config admin
+ */
+ protected void unbindConfigAdmin(ConfigurationAdmin configAdmin) {
+ this.configAdmin = null;
+ }
+
+ /**
+ * The Class Command.
+ */
+ private static class Command {
+
+ /** The command. */
+ private String command;
+
+ /** The description. */
+ private String description;
+
+ /** The parameter. */
+ private String parameter;
+
+ /**
+ * Instantiates a new command.
+ *
+ * @param command
+ * the command
+ * @param parameter
+ * the parameter
+ * @param description
+ * the description
+ */
+ public Command(String command, String parameter, String description) {
+ super();
+ this.command = command;
+ this.parameter = parameter;
+ this.description = description;
+ }
+
+ /**
+ * Write the command to the given builder.
+ *
+ * @param builder
+ * the builder
+ */
+ public void writeTo(StringBuilder builder) {
+ builder.append(TAB);
+ builder.append(TAB);
+ builder.append(command);
+ builder.append(" ");
+ builder.append(parameter);
+ builder.append(" - ");
+ builder.append(description);
+ builder.append(NEW_LINE);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/OSGiUIProvider.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/OSGiUIProvider.java
new file mode 100644
index 0000000..05b9a77
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/OSGiUIProvider.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.webapp;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.OSGiUI;
+import org.osgi.service.component.ComponentFactory;
+import org.osgi.service.component.ComponentInstance;
+
+import com.vaadin.server.UIClassSelectionEvent;
+import com.vaadin.server.UICreateEvent;
+import com.vaadin.server.UIProvider;
+import com.vaadin.ui.UI;
+
+@SuppressWarnings("serial")
+public class OSGiUIProvider extends UIProvider {
+
+ private ComponentFactory uiFactory;
+ private final Class<? extends UI> uiClass;
+ private final String vaadinApplication;
+
+ public OSGiUIProvider(String vaadinApplication, Class<? extends UI> uiClass) {
+ super();
+ this.uiClass = uiClass;
+ this.vaadinApplication = vaadinApplication;
+ }
+
+ /**
+ * Sets the component factory used to create new UI instances.
+ *
+ * @param uiFactory
+ */
+ void setUIFactory(ComponentFactory uiFactory) {
+ this.uiFactory = uiFactory;
+ }
+
+ /**
+ * Returns the component factory.
+ *
+ * @return factory
+ */
+ ComponentFactory getUIFactory() {
+ return this.uiFactory;
+ }
+
+ /**
+ * Returns the vaadin application this UI provider belongs to. If
+ * <code>null</code> then this UI provider can be used for each vaadin
+ * application.
+ *
+ * @return the vaadinApplication
+ */
+ protected String getVaadinApplication() {
+ return vaadinApplication;
+ }
+
+ @Override
+ public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
+ return uiClass;
+ }
+
+ @Override
+ public UI createInstance(UICreateEvent event) {
+ Dictionary<String, Object> properties = new Hashtable<String, Object>();
+
+ ComponentInstance instance = uiFactory.newInstance(properties);
+ OSGiUI ui = (OSGiUI) instance.getInstance();
+ ui.setComponentInstance(instance);
+
+ return ui;
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java
new file mode 100644
index 0000000..19ddedf
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.osgi/src/org/eclipse/osbp/runtime/web/vaadin/osgi/webapp/VaadinApplication.java
@@ -0,0 +1,1029 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+package org.eclipse.osbp.runtime.web.vaadin.osgi.webapp;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.servlet.ServletException;
+
+import org.apache.shiro.web.servlet.IniShiroFilter;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.http.servlet.ExtendedHttpService;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.Activator;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IOSGiUiProviderFactory;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.VaadinConstants;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.common.VaadinStatusCodes;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.servlet.VaadinOSGiServlet;
+import org.eclipse.osbp.runtime.web.vaadin.osgi.servlet.WebResourcesHttpContext;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.ComponentFactory;
+import org.osgi.service.http.NamespaceException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.vaadin.server.UIProvider;
+import com.vaadin.ui.UI;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Default implementation of {@link IVaadinApplication}.
+ */
+@SuppressWarnings("deprecation")
+public class VaadinApplication implements IVaadinApplication {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(VaadinApplication.class);
+
+ /** The resource base. */
+ private final String RESOURCE_BASE = "/VAADIN";
+
+ /** The context. */
+ // OSGi
+ private ComponentContext context;
+
+ /** The service tracker. */
+ private HttpServiceTracker serviceTracker;
+
+ /** The id. */
+ // properties
+ private String id;
+
+ /** The status. */
+ private IStatus status;
+
+ /** The name. */
+ private String name = VaadinConstants.DEFAULT_APPLICATION_NAME;
+
+ /** The ui alias. */
+ private String uiAlias = VaadinConstants.DEFAULT_UI_ALIAS;
+
+ /** The widgetset. */
+ private String widgetset = "";
+
+ /** The production mode. */
+ private boolean productionMode;
+
+ /** The http application. */
+ private String httpApplication = "";
+
+ /** The ui providers. */
+ private List<OSGiUIProvider> uiProviders = new ArrayList<OSGiUIProvider>(1);
+
+ /** The http service. */
+ private ExtendedHttpService httpService;
+
+ /** The provider factories. */
+ private List<IOSGiUiProviderFactory> providerFactories = new CopyOnWriteArrayList<IOSGiUiProviderFactory>();
+
+ /** The ui factories. */
+ private List<UiFactoryWrapper> uiFactories = new CopyOnWriteArrayList<UiFactoryWrapper>();
+
+ /** The started. */
+ // lifecycle
+ private boolean started;
+
+ /** The access lock. */
+ private final Lock accessLock = new ReentrantLock();
+
+ /** The filter. */
+ // web
+ private IniShiroFilter filter;
+
+ /** The servlet. */
+ private VaadinOSGiServlet servlet;
+
+ /** The default context. */
+ private WebResourcesHttpContext defaultContext;
+
+ /** The servlet alias. */
+ private String servletAlias;
+
+ /**
+ * Called by OSGi-DS.
+ *
+ * @param context
+ * the context
+ * @param properties
+ * the properties
+ */
+ protected void activate(ComponentContext context,
+ Map<String, Object> properties) {
+ LOGGER.debug("{} started", getName());
+ this.context = context;
+ this.id = UUID.randomUUID().toString();
+
+ modified(context, properties);
+ }
+
+ /**
+ * Called by OSGi-DS.
+ *
+ * @param context
+ * the context
+ * @param properties
+ * the properties
+ */
+ protected void deactivate(ComponentContext context,
+ Map<String, Object> properties) {
+
+ destroy();
+
+ this.context = null;
+
+ LOGGER.debug("{} stopped", getName());
+ }
+
+ /**
+ * Called by OSGi-DS if service properties became changed.
+ *
+ * @param context
+ * the context
+ * @param properties
+ * the properties
+ */
+ protected void modified(ComponentContext context,
+ Map<String, Object> properties) {
+
+ System.out.println("Update");
+ LOGGER.debug("Calling update");
+
+ try {
+ accessLock.lock();
+
+ stop();
+
+ id = "NOT SPECIFIED";
+ if (properties.get(VaadinConstants.EXTERNAL_PID) != null) {
+ id = (String) properties.get(VaadinConstants.EXTERNAL_PID);
+ }
+
+ String name = VaadinConstants.DEFAULT_APPLICATION_NAME;
+ if (properties.get(VaadinConstants.APPLICATION_NAME) != null) {
+ name = (String) properties
+ .get(VaadinConstants.APPLICATION_NAME);
+ }
+
+ String httpApplicationName = null;
+ if (properties.get(VaadinConstants.HTTP_APPLICATION_NAME) != null) {
+ httpApplicationName = (String) properties
+ .get(VaadinConstants.HTTP_APPLICATION_NAME);
+ }
+
+ String widgetsetName = null;
+ if (properties.get(VaadinConstants.WIDGETSET) != null) {
+ widgetsetName = (String) properties
+ .get(VaadinConstants.WIDGETSET);
+ }
+
+ String uialias = null;
+ if (properties.get(VaadinConstants.UI_ALIAS) != null) {
+ uialias = (String) properties.get(VaadinConstants.UI_ALIAS);
+ }
+
+ boolean productionMode = false;
+ if (properties.get(VaadinConstants.PRODUCTIONMODE) != null) {
+ productionMode = Boolean.valueOf((String) properties
+ .get(VaadinConstants.PRODUCTIONMODE));
+ }
+
+ setName(name);
+ setWidgetSetName(widgetsetName);
+ setHttpApplication(httpApplicationName);
+ setUIAlias(uialias);
+ setProductionMode(productionMode);
+
+ // create and set the UI provider to the application
+ OSGiUIProvider provider = createUIProvider();
+ if (provider != null) {
+ addUIProvider(provider);
+ }
+
+ // properties.put(VaadinConstants.APPLICATION_ID, getId());
+
+ // start the application again
+ //
+ start();
+
+ LOGGER.debug(
+ "New IVaadinApplication {} deployed on 'http application' {}",
+ getName(), getHttpApplication());
+
+ } finally {
+ accessLock.unlock();
+ }
+ }
+
+ /**
+ * Creates the UI provider for the given application name.
+ *
+ * @return the OS gi ui provider
+ */
+ protected OSGiUIProvider createUIProvider() {
+
+ // iterate all the factories with match application name filter
+ OSGiUIProvider provider = null;
+ for (UiFactoryWrapper factory : uiFactories) {
+ if (name.equals(factory.vaadinApplicationFilter)) {
+ provider = factory.createProvider(name);
+ break;
+ }
+ }
+
+ // if no UI provider was found, try to find a factory with empty
+ // application name filter
+ if (provider == null) {
+ for (UiFactoryWrapper factory : uiFactories) {
+ if (factory.vaadinApplicationFilter == null) {
+ provider = factory.createProvider(name);
+ break;
+ }
+ }
+ }
+ return provider;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#getStatus()
+ */
+ @Override
+ public IStatus getStatus() {
+ return status != null ? status : Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#getId()
+ */
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the name of that http application.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of that application.
+ *
+ * @param name
+ * the new name
+ */
+ protected void setName(String name) {
+ this.name = isStringValid(name) ? name
+ : VaadinConstants.DEFAULT_APPLICATION_NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#getUIAlias()
+ */
+ @Override
+ public String getUIAlias() {
+ return uiAlias;
+ }
+
+ /**
+ * Sets the alias that is used to access the vaadin UI.
+ *
+ * @param uiAlias
+ * the new UI alias
+ */
+ protected void setUIAlias(String uiAlias) {
+ this.uiAlias = isStringValid(uiAlias) ? uiAlias
+ : VaadinConstants.DEFAULT_UI_ALIAS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#getHttpApplication()
+ */
+ @Override
+ public String getHttpApplication() {
+ return httpApplication;
+ }
+
+ /**
+ * Sets the name of the IHttpApplication that vaadin application
+ * should be deployed at.
+ *
+ * @param httpApplication
+ * the httpApplication to set
+ */
+ protected void setHttpApplication(String httpApplication) {
+ this.httpApplication = isStringValid(httpApplication) ? httpApplication
+ : "";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#getWidgetSetName()
+ */
+ @Override
+ public String getWidgetSetName() {
+ return widgetset;
+ }
+
+ /**
+ * Sets the name of the widgetset.
+ *
+ * @param widgetset
+ * the new widget set name
+ */
+ protected void setWidgetSetName(String widgetset) {
+ this.widgetset = isStringValid(widgetset) ? widgetset : "";
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#isProductionMode()
+ */
+ @Override
+ public boolean isProductionMode() {
+ return productionMode;
+ }
+
+ /**
+ * Sets the production mode.
+ *
+ * @param productionMode
+ * the productionMode to set
+ */
+ protected void setProductionMode(boolean productionMode) {
+ this.productionMode = productionMode;
+ }
+
+ /**
+ * Returns true if the string is not <code>null</code> and not empty string.
+ *
+ * @param value
+ * the value
+ * @return true, if is string valid
+ */
+ private boolean isStringValid(String value) {
+ return value != null && !value.trim().equals("");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#isStarted()
+ */
+ public boolean isStarted() {
+ return started;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#isDeployed()
+ */
+ public boolean isDeployed() {
+ return httpService != null;
+ }
+
+ /**
+ * Is called to start the application. All resources should be registered
+ * and the http service is registered.
+ */
+ public void start() {
+ if (started) {
+ LOGGER.debug("HttpApplication {} is already started", getName());
+ return;
+ }
+
+ // ensure that only one threas manipulates the contents
+ accessLock.lock();
+ try {
+ // start the tracker to observe handler
+ try {
+ serviceTracker = new HttpServiceTracker(
+ context.getBundleContext(), this);
+ serviceTracker.open();
+ } catch (InvalidSyntaxException e) {
+ LOGGER.error("{}", e);
+ setStatus(VaadinStatusCodes.createHttpServiceTracker(e));
+
+ // stop the application
+ stop(true);
+ return;
+ }
+
+ // add all yet existing handler from the tracker
+ ExtendedHttpService httpService = serviceTracker.getService();
+ if (httpService != null) {
+ try {
+ setHttpService(httpService);
+ } catch (AppException e) {
+ LOGGER.error(String
+ .format("Stopping vaadin application %s since setting http service caused a problem.",
+ getName()));
+ setStatus(VaadinStatusCodes.createSettingHttpService(e));
+
+ // stop the application
+ stop(true);
+ return;
+ }
+ }
+
+ started = true;
+ } finally {
+ accessLock.unlock();
+ }
+
+ setStatus(VaadinStatusCodes.OK_STATUS);
+ }
+
+ /**
+ * Is called by the service tracker to add a new http service.
+ *
+ * @param httpService
+ * the http service
+ */
+ protected void httpServiceAdded(ExtendedHttpService httpService) {
+ if (!isStarted()) {
+ return;
+ }
+
+ // ensure that only one threads manipulates the contents
+ accessLock.lock();
+ try {
+ setHttpService(httpService);
+ } catch (AppException e) {
+ LOGGER.error(String
+ .format("Stopping vaadin application %s since setting http service caused a problem.",
+ getName()));
+ setStatus(VaadinStatusCodes.createSettingHttpService(e));
+
+ // stop the application
+ stop();
+ return;
+
+ } finally {
+ accessLock.unlock();
+ }
+
+ setStatus(VaadinStatusCodes.OK_STATUS);
+ }
+
+ /**
+ * Is called by the service tracker to remove a registered http service.
+ *
+ * @param httpService
+ * the http service
+ */
+ protected void httpServiceRemoved(ExtendedHttpService httpService) {
+ if (!isStarted()) {
+ return;
+ }
+
+ // ensure that only one threas manipulates the contents
+ accessLock.lock();
+ try {
+ unsetHttpService(httpService);
+ } finally {
+ accessLock.unlock();
+ }
+ }
+
+ /**
+ * Sets the given http service to the internal cache.
+ *
+ * @param httpService
+ * the new http service
+ * @throws AppException
+ * the app exception
+ */
+ protected void setHttpService(ExtendedHttpService httpService)
+ throws AppException {
+ if (this.httpService != null) {
+ LOGGER.error("HttpService already present. Abort operation!");
+ return;
+ }
+
+ this.httpService = httpService;
+
+ registerWebArtifacts();
+ }
+
+ /**
+ * Registers servlets, filters and resources.
+ *
+ * @throws AppException
+ * the app exception
+ */
+ protected void registerWebArtifacts() throws AppException {
+ Hashtable<String, String> properties = new Hashtable<String, String>();
+ properties.put(VaadinConstants.EXTERNAL_PID, getId());
+ properties.put(VaadinConstants.APPLICATION_NAME, getName());
+ properties.put(VaadinConstants.WIDGETSET, getWidgetSetName());
+ properties.put("widgetset", getWidgetSetName());
+ properties.put("productionMode", Boolean.toString(isProductionMode()));
+
+ servlet = new VaadinOSGiServlet(this);
+ servletAlias = String.format("/%s", getUIAlias());
+ defaultContext = new WebResourcesHttpContext(Activator
+ .getBundleContext().getBundle());
+ filter = new IniShiroFilter();
+ try {
+ try {
+ httpService.registerFilter("/", filter, properties,
+ defaultContext);
+ } catch (Exception e) {
+ LOGGER.error("{}", e);
+ throw new AppException(e);
+ }
+ httpService.registerResources(RESOURCE_BASE, RESOURCE_BASE,
+ defaultContext);
+ httpService.registerServlet(servletAlias, servlet, properties,
+ defaultContext);
+ } catch (ServletException e) {
+ LOGGER.error("{}", e);
+ throw new AppException(e);
+ } catch (NamespaceException e) {
+ LOGGER.error("{}", e);
+ throw new AppException(e);
+ }
+ }
+
+ /**
+ * Sets the current status.
+ *
+ * @param status
+ * the new status
+ */
+ private void setStatus(IStatus status) {
+ this.status = status;
+
+ if (status != null && status != VaadinStatusCodes.OK_STATUS) {
+ LOGGER.warn("Status was set to vaadin application {}: {}",
+ getName(), status);
+ }
+ }
+
+ /**
+ * Unregisters all registered servlets, filters and resources.
+ */
+ protected void unregisterWebArtifacts() {
+ try {
+ if (servletAlias != null) {
+ httpService.unregister(servletAlias);
+ }
+ } catch (Exception e) {
+ // May throw exception if http service was stopped by
+ // tracker.close()
+ LOGGER.info("{}", e.getMessage());
+ } finally {
+ servletAlias = null;
+ servlet = null;
+ }
+
+ try {
+ if (filter != null) {
+ httpService.unregisterFilter(filter);
+ }
+ } catch (Exception e) {
+ LOGGER.info("{}", e.getMessage());
+ } finally {
+ filter = null;
+ }
+
+ try {
+ httpService.unregister(RESOURCE_BASE);
+ } catch (Exception e) {
+ LOGGER.info("{}", e.getMessage());
+ } finally {
+ }
+ }
+
+ /**
+ * Removes the given http service from the internal cache.
+ *
+ * @param httpService
+ * the http service
+ */
+ protected void unsetHttpService(ExtendedHttpService httpService) {
+ if (this.httpService == null) {
+ LOGGER.error("HttpService can not be unset! No instance set yet!");
+ return;
+ }
+
+ if (this.httpService != httpService) {
+ LOGGER.error("Tries to unset different http service. Operation aborted.");
+ return;
+ }
+
+ // unregister all registered artifacts
+ unregisterWebArtifacts();
+
+ this.httpService = null;
+ }
+
+ /**
+ * Is called to stop the application. All resources should be unregistered
+ * and the http service will become disposed.
+ */
+ public void stop() {
+ stop(false);
+ }
+
+ /**
+ * Stops the application. If true, then the started state will no be
+ * checked.
+ *
+ * @param force
+ * the force
+ */
+ protected void stop(boolean force) {
+ if (!force && !started) {
+ LOGGER.debug("HttpApplication {} not started", getName());
+ return;
+ }
+
+ // ensure that only one threads manipulates the contents
+ accessLock.lock();
+ try {
+ if (serviceTracker != null) {
+ serviceTracker.close();
+ serviceTracker = null;
+ }
+
+ } finally {
+ accessLock.unlock();
+ started = false;
+ }
+ }
+
+ /**
+ * Destroys the http application.
+ */
+ public void destroy() {
+ try {
+ accessLock.lock();
+ if (isStarted()) {
+ stop();
+ }
+
+ uiProviders = null;
+
+ } finally {
+ accessLock.unlock();
+ }
+ }
+
+ /**
+ * Adds a new {@link UIProvider} to the web application.
+ *
+ * @param provider
+ * the provider
+ */
+ protected void addUIProvider(OSGiUIProvider provider) {
+ if (!uiProviders.contains(provider)) {
+ uiProviders.add(provider);
+ }
+ }
+
+ /**
+ * Removes an {@link UIProvider} from the web application.
+ *
+ * @param provider
+ * the provider
+ */
+ protected void removeUIProvider(OSGiUIProvider provider) {
+ if (!isActive()) {
+ // component deactivated
+ return;
+ }
+
+ uiProviders.remove(provider);
+ }
+
+ /**
+ * Removes an {@link UIProvider} for the given component factory that is
+ * used created UI instances.
+ *
+ * @param uiFactory
+ * the ui factory
+ */
+ protected void removeUIProviderForFactory(ComponentFactory uiFactory) {
+ if (!isActive()) {
+ return;
+ }
+
+ for (Iterator<OSGiUIProvider> iterator = uiProviders.iterator(); iterator
+ .hasNext();) {
+ OSGiUIProvider provider = (OSGiUIProvider) iterator.next();
+ if (provider.getUIFactory() == uiFactory) {
+ iterator.remove();
+ }
+ }
+ }
+
+ /**
+ * Returns true if the component is active.
+ *
+ * @return true, if is active
+ */
+ private boolean isActive() {
+ return context != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.runtime.web.vaadin.osgi.common.IVaadinApplication#getUiProviders()
+ */
+ @Override
+ public List<OSGiUIProvider> getUiProviders() {
+ return Collections.unmodifiableList(uiProviders);
+ }
+
+ /**
+ * Creates a filter string.
+ *
+ * @param httpApplication
+ * the http application
+ * @return the string
+ */
+ private String createHttpServiceFilterString(String httpApplication) {
+ String filterString = null;
+ if (httpApplication != null && !httpApplication.equals("")) {
+ filterString = String
+ .format("(&(objectClass=org.eclipse.equinox.http.servlet.ExtendedHttpService)(osbp.http.name=%s))",
+ httpApplication);
+ } else {
+ filterString = String
+ .format("(objectClass=org.eclipse.equinox.http.servlet.ExtendedHttpService)",
+ httpApplication);
+ }
+ return filterString;
+ }
+
+ /**
+ * Adds the OSGi UI provider factory.
+ *
+ * @param providerFactory
+ * the provider factory
+ */
+ protected void addUIProviderFactory(IOSGiUiProviderFactory providerFactory) {
+ providerFactories.add(providerFactory);
+ }
+
+ /**
+ * Removes the OSGi UI provider factory.
+ *
+ * @param providerFactory
+ * the provider factory
+ */
+ protected void removeUIProviderFactory(
+ IOSGiUiProviderFactory providerFactory) {
+ if (!isActive()) {
+ // component deactivated
+ return;
+ }
+ providerFactories.remove(providerFactory);
+ }
+
+ /**
+ * Called by OSGi-DS and adds a component factory that is used to create
+ * instances of UIs.
+ *
+ * @param reference
+ * the reference
+ */
+ protected void addUIFactory(ServiceReference<ComponentFactory> reference) {
+ try {
+ accessLock.lock();
+
+ LOGGER.debug("Adding ui factory");
+
+ // parse the target of service
+ //
+ String name = (String) reference.getProperty("component.factory");
+ String[] tokens = name.split("/");
+ if (tokens.length != 2) {
+ LOGGER.error(
+ "UiFactory {} does not meet syntax. (org.eclipse.osbp.web.vaadin.UI/[uiclass]@[vaadinApp]) Eg: org.eclipse.osbp.web.vaadin.UI/org.eclipse.osbp.examples.runtime.web.vaadin.standalone.Vaadin7StandaloneDemoUI@StandaloneDemo",
+ name);
+ return;
+ }
+
+ String uiClassName;
+ String vaadinApplication;
+ String[] innerTokens = tokens[1].split("@");
+ if (innerTokens.length == 1) {
+ uiClassName = innerTokens[0];
+ vaadinApplication = null;
+ } else {
+ uiClassName = innerTokens[0];
+ vaadinApplication = innerTokens[1];
+ }
+
+ // register factory internally
+ //
+ uiFactories.add(new UiFactoryWrapper(vaadinApplication,
+ uiClassName, reference));
+
+ } finally {
+ accessLock.unlock();
+ }
+ }
+
+ /**
+ * Called by OSGi-DS and removes a component factory that is used to create
+ * instances of UIs.
+ *
+ * @param factory
+ * the factory
+ * @param properties
+ * the properties
+ */
+ protected void removeUIFactory(ComponentFactory factory,
+ Map<String, Object> properties) {
+ try {
+ accessLock.lock();
+ removeUIProviderForFactory(factory);
+ } finally {
+ accessLock.unlock();
+ }
+ }
+
+ /**
+ * Update the web application with the new UI provider.
+ *
+ * @param uiProvider
+ * the ui provider
+ */
+ private void uiProviderAdded(OSGiUIProvider uiProvider) {
+ try {
+ accessLock.lock();
+ if (uiProvider.getVaadinApplication() == null) {
+ addUIProvider(uiProvider);
+ } else {
+ if (uiProvider.getVaadinApplication().equals(getName())) {
+ addUIProvider(uiProvider);
+ }
+ }
+ } finally {
+ accessLock.unlock();
+ }
+ }
+
+ /**
+ * A wrapper class to keep information about pending factory. Pending means
+ * that the service was not activated yet.
+ */
+ private class UiFactoryWrapper {
+
+ /** The vaadin application filter. */
+ private final String vaadinApplicationFilter;
+
+ /** The reference. */
+ private final ServiceReference<ComponentFactory> reference;
+
+ /** The ui class name. */
+ private final String uiClassName;
+
+ /**
+ * Instantiates a new ui factory wrapper.
+ *
+ * @param vaadinApplicationFilter
+ * the vaadin application filter
+ * @param uiClassName
+ * the ui class name
+ * @param reference
+ * the reference
+ */
+ public UiFactoryWrapper(String vaadinApplicationFilter,
+ String uiClassName, ServiceReference<ComponentFactory> reference) {
+ super();
+ this.vaadinApplicationFilter = vaadinApplicationFilter;
+ this.uiClassName = uiClassName;
+ this.reference = reference;
+ }
+
+ /**
+ * Creates the provider.
+ *
+ * @param vaadinApplication
+ * the vaadin application
+ * @return the OS gi ui provider
+ */
+ @SuppressWarnings("unchecked")
+ public OSGiUIProvider createProvider(String vaadinApplication) {
+ if (vaadinApplicationFilter != null
+ && !vaadinApplicationFilter.equals(vaadinApplication)) {
+ return null;
+ }
+
+ ComponentFactory uiFactory = reference.getBundle()
+ .getBundleContext().getService(reference);
+
+ Class<? extends UI> uiClass = null;
+ try {
+ uiClass = (Class<? extends UI>) reference.getBundle()
+ .loadClass(uiClassName);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // iterates all UI provider factories to find a proper UI provider
+ OSGiUIProvider uiProvider = null;
+ for (IOSGiUiProviderFactory providerFactory : providerFactories) {
+ uiProvider = providerFactory.createUiProvider(
+ vaadinApplication, uiClass);
+ if (uiProvider == null) {
+ continue;
+ }
+ uiProvider.setUIFactory(uiFactory);
+ break;
+ }
+
+ // If no provider was found for the given vaadin application, then
+ // add a default one
+ if (uiProvider == null) {
+ uiProvider = new OSGiUIProvider(vaadinApplication, uiClass);
+ uiProvider.setUIFactory(uiFactory);
+ }
+
+ // handle added UI provider
+ uiProviderAdded(uiProvider);
+
+ return uiProvider;
+ }
+ }
+
+ /**
+ * The Class HttpServiceTracker.
+ */
+ public class HttpServiceTracker extends
+ ServiceTracker<ExtendedHttpService, ExtendedHttpService> {
+
+ /** The logger. */
+ @SuppressWarnings("unused")
+ private Logger logger = LoggerFactory
+ .getLogger(HttpServiceTracker.class);
+
+ /**
+ * Instantiates a new http service tracker.
+ *
+ * @param ctx
+ * the ctx
+ * @param webApplication
+ * the web application
+ * @throws InvalidSyntaxException
+ * the invalid syntax exception
+ */
+ public HttpServiceTracker(BundleContext ctx,
+ IVaadinApplication webApplication)
+ throws InvalidSyntaxException {
+ super(ctx, ctx
+ .createFilter(createHttpServiceFilterString(webApplication
+ .getHttpApplication())), null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.util.tracker.ServiceTracker#addingService(org.osgi.framework.ServiceReference)
+ */
+ @Override
+ public ExtendedHttpService addingService(
+ ServiceReference<ExtendedHttpService> reference) {
+ ExtendedHttpService service = super.addingService(reference);
+
+ VaadinApplication.this.httpServiceAdded(service);
+
+ return service;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.util.tracker.ServiceTracker#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
+ */
+ @Override
+ public void removedService(
+ ServiceReference<ExtendedHttpService> reference,
+ ExtendedHttpService service) {
+ super.removedService(reference, service);
+
+ VaadinApplication.this.httpServiceRemoved(service);
+ }
+ }
+
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/.project b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.project
new file mode 100644
index 0000000..8eeeeda
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/.project
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osbp.runtime.web.vaadin.widgetset</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.babel.editor.rbeBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.babel.editor.rbeNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/LICENSE.txt b/org.eclipse.osbp.runtime.web.vaadin.widgetset/LICENSE.txt
new file mode 100644
index 0000000..ff42ad4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/LICENSE.txt
@@ -0,0 +1,161 @@
+Eclipse Public License -v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION
+OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.
+A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate
+modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of
+its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute
+and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code
+form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the
+combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not
+apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no
+assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property
+rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the
+Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to
+grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including
+warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any
+other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it
+in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and
+the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes
+the Program in a commercial product offering should do so in a manner which does not create potential liability for
+other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions
+brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual
+property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may
+ participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is
+then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.
+Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to
+those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result,
+the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for
+determining the appropriateness of using and distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance
+with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS),
+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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such
+Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such
+noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution
+of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses
+ granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement
+is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish
+new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the
+right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the
+new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States
+of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause
+of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF b/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b59301d
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.osbp.runtime.web.vaadin.widgetset
+Bundle-SymbolicName: org.eclipse.osbp.runtime.web.vaadin.widgetset
+Bundle-Version: 0.9.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Eclipse OSBP
+Require-Bundle: com.vaadin.client;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.server;bundle-version="[7.5.7,7.7.0)",
+ com.vaadin.shared;bundle-version="[7.5.7,7.7.0)",
+ com.google.guava;bundle-version="[10.0.0,19.0.0)",
+ org.eclipse.core.databinding;bundle-version="[1.4.1,1.5.0)",
+ org.eclipse.core.databinding.beans;bundle-version="[1.2.200,1.5.0)",
+ org.eclipse.core.databinding.observable;bundle-version="[1.4.1,1.5.0)",
+ org.eclipse.core.databinding.property;bundle-version="[1.4.200,1.5.0)",
+ org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
+ org.jsoup;bundle-version="1.7.2"
+Export-Package: org.eclipse.osbp.runtime.web.vaadin.widgetset;
+ uses:="com.vaadin.server,
+ com.vaadin.ui";version="0.9.0"
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.html b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.html
new file mode 100644
index 0000000..64c0598
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 1, 2016</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.ini b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.ini
new file mode 100644
index 0000000..7df671f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.ini
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.mappings b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.mappings
new file mode 100644
index 0000000..4511a0a
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=qualifier
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.properties b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.properties
new file mode 100644
index 0000000..b539f8f
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/about.properties
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2012, 2016 - Loetz GmbH&Co.KG (Heidelberg)
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Loetz GmbH&Co.KG - initial API and implementation
+#
+
+# NLS_MESSAGEFORMAT_VAR
+
+featureName=org.eclipse.osbp.runtime.web.vaadin.widgetset
+
+################ blurb property ####################################
+featureText=\
+Copyright (c) 2012-2016 - Loetz GmbH&Co.KG \n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Loetz GmbH&Co.KG - implementation\n
+################ end of blurb property ####################################
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/build.properties b/org.eclipse.osbp.runtime.web.vaadin.widgetset/build.properties
new file mode 100644
index 0000000..b1feaef
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/build.properties
@@ -0,0 +1,8 @@
+output.. = target/classes/
+bin.includes = about.properties, about.mappings, about.ini, about.html, META-INF/,\
+ .,\
+ VAADIN/,\
+ src/,\
+ LICENSE.txt
+source.. = src/
+src.includes = about.properties, about.mappings, about.ini, about.html, LICENSE.txt
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/pom-compileWidgetset.xml b/org.eclipse.osbp.runtime.web.vaadin.widgetset/pom-compileWidgetset.xml
new file mode 100644
index 0000000..d974ec3
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/pom-compileWidgetset.xml
@@ -0,0 +1,202 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.widgetset.compilews</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <vaadin.version>7.5.7</vaadin.version>
+ <osbp.runtimeweb.version>0.9.1-SNAPSHOT</osbp.runtimeweb.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.components</artifactId>
+ <version>${osbp.runtimeweb.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared-deps</artifactId>
+ <scope>provided</scope>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <scope>provided</scope>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <!-- This add sources, .gwt.xml files etc to jar from source directory.
+ Not quite maven convention byt easiest to setup this way. -->
+ <directory>src</directory>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
+ <!-- <runTarget>mobilemail</runTarget> -->
+ <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
+ way compatible with Vaadin eclipse plugin. -->
+ <webappDirectory>${basedir}/VAADIN/widgetsets
+ </webappDirectory>
+ <hostedWebapp>${basedir}/VAADIN/widgetsets
+ </hostedWebapp>
+ <noServer>true</noServer>
+ <!-- Remove draftCompile when project is ready -->
+ <draftCompile>true</draftCompile>
+ <strict>true</strict>
+ <compileReport>false</compileReport>
+ <style>PRETTY</style>
+ <runTarget>http://localhost:8080/</runTarget>
+
+ <!-- Remove these when going to release dependencies -->
+ <force>true</force>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
+ <!-- directory is cleaned properly -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${basedir}/VAADIN/widgetsets</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.12</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project> \ No newline at end of file
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/pom.xml b/org.eclipse.osbp.runtime.web.vaadin.widgetset/pom.xml
new file mode 100644
index 0000000..8e5bbce
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/pom.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.widgetset</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <version>${vaadin.plugin.version}</version>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
+ <!-- <runTarget>mobilemail</runTarget> -->
+ <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This
+ way compatible with Vaadin eclipse plugin. -->
+ <webappDirectory>${basedir}/VAADIN/widgetsets
+ </webappDirectory>
+ <hostedWebapp>${basedir}/VAADIN/widgetsets
+ </hostedWebapp>
+ <noServer>true</noServer>
+ <!-- Remove draftCompile when project is ready -->
+ <draftCompile>true</draftCompile>
+ <strict>true</strict>
+ <compileReport>false</compileReport>
+ <style>PRETTY</style>
+ <runTarget>http://localhost:8080/</runTarget>
+
+ <!-- Remove these when going to release dependencies -->
+ <force>true</force>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>resources</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
+ <!-- directory is cleaned properly -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>VAADIN/gwt-unitCache</directory>
+ </fileset>
+ <fileset>
+ <directory>VAADIN/widgetsets</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <excludeDefaultDirectories>true</excludeDefaultDirectories>
+ <filesets>
+ <fileset>
+ <directory>VAADIN/gwt-unitCache</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ <executions>
+ <execution>
+ <id>cleanUnitCache</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[2.3.0-1,)</versionRange>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-maven-plugin</artifactId>
+ <versionRange>[1.0.2,)</versionRange>
+ <goals>
+ <goal>update-widgetset</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <description>Default widgetset for OSBP Runtime Web</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.vaadin.components.widget</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-server</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiled</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-shared</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-client-compiler</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.vaadin</groupId>
+ <artifactId>vaadin-themes</artifactId>
+ <version>${vaadin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidget.gwt.xml b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidget.gwt.xml
new file mode 100644
index 0000000..4eb89b4
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidget.gwt.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
+<module>
+ <inherits name="com.vaadin.DefaultWidgetSet" />
+ <inherits name="org.eclipse.osbp.runtime.web.vaadin.components.widget.OSBPWidgetsWidgetset" />
+
+ <!-- Uncomment the following to compile the widgetset for one browser only.
+ Multiple browsers can be specified as a comma separated list. The supported
+ user agents at the moment of writing were: ie8,ie9,gecko1_8,safari,opera
+ The value gecko1_8 is used for Firefox and safari is used for webkit based
+ browsers including Google Chrome. -->
+ <!-- <set-property name="user.agent" value="safari"/> -->
+
+ <!-- To enable SuperDevMode, uncomment this line. See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode
+ for more information and instructions. -->
+ <!-- <set-configuration-property name="devModeRedirectEnabled" value="true"
+ /> -->
+
+ <stylesheet src="osbp-components/styles.css" />
+
+</module>
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidgetUI.java b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidgetUI.java
new file mode 100644
index 0000000..afead79
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/OSBPWidgetUI.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Florian Pirchner - Initial implementation
+ */
+
+package org.eclipse.osbp.runtime.web.vaadin.widgetset;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+@SuppressWarnings("serial")
+@Theme("clientsidewidget")
+public class OSBPWidgetUI extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ final VerticalLayout layout = new VerticalLayout();
+ layout.setMargin(true);
+ setContent(layout);
+
+ Button button = new Button("Click Me");
+ button.addClickListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ layout.addComponent(new Label("Thank you for clicking"));
+ }
+ });
+ layout.addComponent(button);
+ }
+}
diff --git a/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/public/lunifera-components/styles.css b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/public/lunifera-components/styles.css
new file mode 100644
index 0000000..1fe0eaa
--- /dev/null
+++ b/org.eclipse.osbp.runtime.web.vaadin.widgetset/src/org/eclipse/osbp/runtime/web/vaadin/widgetset/public/lunifera-components/styles.css
@@ -0,0 +1,177 @@
+.lun-negative-value {
+ color: red !important;
+}
+
+.l-debug-show-layout-bounds {
+ border-width: 1px;
+ border-style: solid;
+ background-color: #8C698A;
+ border-color: #8C698A;
+}
+
+.l-debug-show-layout-bounds .l-control {
+ background-color: #A68095;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #A68095;
+}
+
+.l-debug-show-layout-bounds .l-control .v-slot,
+ .l-debug-show-layout-bounds .l-control .v-gridlayout-slot {
+ background-color: #D9A9BF;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #D9A9BF;
+}
+
+.l-debug-show-layout-bounds .l-control .v-slot-l-layout-compressor {
+ background-color: #BFA8B1;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #BFA8B1;
+}
+
+.v-layout {
+/* overflow: scroll; */
+}
+
+.v-slot-l-formlayout {
+ min-width: 200px;
+}
+
+.l-form-defaultwidth {
+ width: 300px !important;
+}
+
+.l-background-red {
+ background-color: red !important;
+}
+
+.l-background-white {
+ background-color: white !important;
+}
+
+.l-background-blue {
+ background-color: blue !important;
+}
+
+.l-background-green {
+ background-color: green !important;
+}
+
+.l-background-black {
+ background-color: black !important;
+}
+
+.l-background-yellow {
+ background-color: yellow !important;
+}
+
+.l-background-gray {
+ background-color: gray !important;
+}
+
+.l-background-light-gray {
+ background-color: gray !important;
+}
+
+.l-background-dark-gray {
+ background-color: gray !important;
+}
+
+.l-foreground-red {
+ color: red !important;
+}
+
+.l-foreground-white {
+ color: white !important;
+}
+
+.l-foreground-blue {
+ color: blue !important;
+}
+
+.l-foreground-green {
+ color: green !important;
+}
+
+.l-foreground-black {
+ color: black !important;
+}
+
+.l-foreground-yellow {
+ color: yellow !important;
+}
+
+.l-foreground-gray {
+ color: gray !important;
+}
+
+.l-foreground-light-gray {
+ color: gray !important;
+}
+
+.l-foreground-dark-gray {
+ color: yellow !important;
+}
+
+.l-bold {
+ font-weight: bold !important;
+}
+
+.l-italic {
+ font-style: italic !important;
+}
+
+.l-strikethrough {
+ text-decoration: line-through !important;
+}
+
+.l-underline {
+ text-decoration: underline !important;
+}
+
+.l-border {
+ border: medium !important;
+ border-style: dotted !important;
+}
+
+.l-beansearchfield .v-nativebutton {
+ display: inline-block;
+ zoom: 1;
+ text-align: center !important;
+ text-decoration: none;
+ background: none;
+ background-image: none;
+ border: none;
+ cursor: pointer;
+ white-space: nowrap;
+ margin: 0;
+ color: inherit;
+ font: inherit;
+ font-size: 16px;
+ line-height: normal;
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+.l-beansearchfield .v-nativebutton:active {
+ background: #ddd;
+ padding: 0px;
+}
+
+.l-beansearchfield .v-nativebutton:focus {
+ outline: none;
+}
+
+.reindeer .v-disabled {
+ opacity: 0.7 !important;
+ filter: alpha(opacity=70) !important;
+} \ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..17156d3
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--#======================================================================= -->
+<!--# Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) -->
+<!--# All rights reserved. This program and the accompanying materials -->
+<!--# are made available under the terms of the Eclipse Public License v1.0 -->
+<!--# which accompanies this distribution, and is available at -->
+<!--# http://www.eclipse.org/legal/epl-v10.html -->
+<!--# -->
+<!--# Contributors: -->
+<!--# Christophe Loetz (Loetz GmbH&Co.KG) - initial API and implementation -->
+<!--#======================================================================= -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osbp.releng.maven</groupId>
+ <artifactId>org.eclipse.osbp.releng.maven.parent.tycho</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.eclipse.osbp.runtime.web</groupId>
+ <artifactId>org.eclipse.osbp.runtime.web.aggregator</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <osbp.gitrepo.name>${project.groupId}</osbp.gitrepo.name>
+ </properties>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>vaadin-snapshots</id>
+ <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <modules>
+ <module>org.eclipse.osbp.runtime.web.common</module>
+ <module>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin</module>
+ <module>org.eclipse.osbp.runtime.web.ecview.services.vaadin</module>
+ <module>org.eclipse.osbp.runtime.web.atmosphere.fragment</module>
+
+ <module>org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin</module>
+ <module>org.eclipse.osbp.runtime.web.feature.vaadin.addon.osgi</module>
+ <module>org.eclipse.osbp.runtime.web.feature.vaadin.common</module>
+ <module>org.eclipse.osbp.runtime.web.feature.vaadin.components</module>
+ <module>org.eclipse.osbp.runtime.web.feature.vaadin.databinding</module>
+ <module>org.eclipse.osbp.runtime.web.feature.vaadin.osgi</module>
+
+ <module>org.eclipse.osbp.runtime.web.vaadin.common</module>
+ <module>org.eclipse.osbp.runtime.web.vaadin.components</module>
+ <module>org.eclipse.osbp.runtime.web.vaadin.components.widget</module>
+ <module>org.eclipse.osbp.runtime.web.vaadin.databinding</module>
+ <module>org.eclipse.osbp.runtime.web.vaadin.osgi</module>
+ <module>org.eclipse.osbp.runtime.web.vaadin.widgetset</module>
+
+<!-- <module>org.eclipse.osbp.runtime.web.common.tests</module> -->
+ <module>org.eclipse.osbp.runtime.web.ecview.presentation.vaadin.tests</module>
+<!-- <module>org.eclipse.osbp.runtime.web.vaadin.common.tests</module> -->
+ <module>org.eclipse.osbp.runtime.web.vaadin.databinding.tests</module>
+<!-- <module>org.eclipse.osbp.runtime.web.vaadin.osgi.tests</module> -->
+ </modules>
+
+ <profiles>
+ <profile>
+ <id>build.widgetset</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <defaultGoal>clean verify</defaultGoal>
+ </build>
+ <modules>
+ <module>org.eclipse.osbp.runtime.web.parent</module>
+ <module>org.eclipse.osbp.runtime.web.vaadin.widgetset</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <resolver>p2</resolver>
+ <pomDependencies>consider</pomDependencies>
+ <environments>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86_64</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/setup/target-luna.target b/setup/target-luna.target
new file mode 100644
index 0000000..248464e
--- /dev/null
+++ b/setup/target-luna.target
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde version="3.8"?><target includeMode="feature" name="org.eclipse.osbp.xtext.builder.target.luna" sequenceNumber="105">
+<locations>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.apache.commons.lang3" version="3.1.0.v201403281430"/>
+<unit id="org.apache.commons.collections.source" version="3.2.0.v2013030210310"/>
+<unit id="org.apache.commons.beanutils.source" version="1.8.0.v201205091237"/>
+<unit id="org.apache.commons.beanutils" version="1.8.0.v201205091237"/>
+<unit id="org.apache.commons.lang3.source" version="3.1.0.v201403281430"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
+</location>
+<location path="${eclipse_home}" type="Profile"/>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.atmosphere.feature.group" version="2.1.2.vaadin3"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.xtext.builder.feature.service.xbase.source.feature.group" version="0.8.2.201408121142"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.source.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.xtext.builder.feature.service.jvmtypes.source.feature.group" version="0.8.2.201408121142"/>
+<unit id="org.eclipse.osbp.dependencies.feature.vaadin.feature.group" version="7.2.5"/>
+<unit id="org.eclipse.osbp.xtext.builder.feature.types.feature.group" version="0.8.2.201408121142"/>
+<unit id="org.eclipse.osbp.dependencies.feature.jetty.websockets.feature.group" version="8.1.14"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.source.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.common.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.components.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.source.feature.group" version="0.7.1.201407011710"/>
+<unit id="org.eclipse.osbp.xtext.builder.feature.service.jvmtypes.feature.group" version="0.8.2.201408121142"/>
+<unit id="org.eclipse.osbp.xtext.builder.feature.types.source.feature.group" version="0.8.2.201408121142"/>
+<unit id="org.eclipse.osbp.runtime.feature.common.feature.group" version="0.7.1.201407011710"/>
+<unit id="org.eclipse.osbp.xtext.builder.feature.service.xbase.feature.group" version="0.8.2.201408121142"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.ecview.presentation.vaadin.source.feature.group" version="0.0.1.201408110750"/>
+<unit id="org.eclipse.osbp.runtime.web.feature.vaadin.databinding.source.feature.group" version="0.0.1.201408110750"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/luna/latest/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.apache.commons.collections.source" version="3.2.0.v2013030210310"/>
+<unit id="javax.xml.bind" version="2.2.0.v201105210648"/>
+<unit id="org.apache.commons.collections" version="3.2.0.v2013030210310"/>
+<unit id="javax.xml.stream" version="1.0.1.v201004272200"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="javax.activation.source" version="1.1.0.v201211130549"/>
+<unit id="javax.activation" version="1.1.0.v201211130549"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.feature.group" version="0.7.0"/>
+<unit id="org.eclipse.emf.ecp.ecview.feature.core.source.feature.group" version="0.7.0"/>
+<repository location="http://lun.lunifera.org/downloads/p2/ecview/nightly/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.osbp.dependencies.feature.security.shiro.feature.group" version="1.2.3"/>
+<repository location="http://lun.lunifera.org/downloads/p2/lunifera/luna/latest/"/>
+</location>
+</locations>
+</target>

Back to the top